Skip to content

Commit

Permalink
Merge pull request rust-lang#11 from ecstatic-morse/vcpkg
Browse files Browse the repository at this point in the history
Make libraries installed by `vcpkg` usable by crates.
  • Loading branch information
pietroalbini authored Jul 28, 2019
2 parents f000fe2 + d301671 commit 5e53c5a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ variables:

jobs:
- job: Windows
timeoutInMinutes: 0
pool:
vmImage: win1803
variables:
Expand Down
28 changes: 26 additions & 2 deletions windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,42 @@ RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--includeRecommended `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0

SHELL ["powershell", "-Command"]
SHELL ["powershell", "-ExecutionPolicy", "Bypass", "-Command"]

# Install chocolatey
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install packages
#
# We need to get the new value of `$PATH` after `choco install`, but
# chocolatey's `refreshenv` won't be available until we restart the shell.
# Make `refreshenv` available right away, by importing the Chocolatey profile
# module. See https://stackoverflow.com/a/46760714.
COPY choco-packages.txt C:\
RUN $ErrorActionPreference = 'Stop'; `
choco install -y @(Get-Content C:\choco-packages.txt); `
Import-Module "C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1"; `
refreshenv

# Install vcpkg
ADD https://github.com/Microsoft/vcpkg/archive/master.zip C:\TEMP\vcpkg-master.zip
RUN $ErrorActionPreference = 'Stop'; `
Expand-Archive -Path C:\TEMP\vcpkg-master.zip -DestinationPath .; `
rm C:\TEMP\vcpkg-master.zip; `
cd .\vcpkg-master; `
.\bootstrap-vcpkg.bat; `
.\vcpkg integrate install

# Install packages
# Install C libraries
#
# The `vcpkg` crate searches for libraries matching the target architecture
# exactly. It won't use x86 libraries on a 64-bit system. Setting the default
# triplet tells `vcpkg` to install 64-bit versions.
ENV VCPKG_DEFAULT_TRIPLET=x64-windows
COPY vc-packages.txt C:\
RUN .\vcpkg-master\vcpkg install @(Get-Content C:\vc-packages.txt)

# Tell the `vcpkg` crate to generate dynamically linked executables
ENV VCPKGRS_DYNAMIC=1

CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
7 changes: 7 additions & 0 deletions windows/choco-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake
--installargs='ADD_CMAKE_TO_PATH=System'
git
llvm
mingw
netfx-4.6.1-devpack
ninja
9 changes: 9 additions & 0 deletions windows/vc-packages.txt
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
curl
libpq
libsodium
libssh2
openal-soft
openssl
portmidi
sdl2
sqlite3
zlib

0 comments on commit 5e53c5a

Please sign in to comment.