Skip to content

Commit 5e53c5a

Browse files
authored
Merge pull request #11 from ecstatic-morse/vcpkg
Make libraries installed by `vcpkg` usable by crates.
2 parents f000fe2 + d301671 commit 5e53c5a

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

azure-pipelines.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ variables:
33

44
jobs:
55
- job: Windows
6+
timeoutInMinutes: 0
67
pool:
78
vmImage: win1803
89
variables:

windows/Dockerfile

+26-2
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,42 @@ RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
1515
--includeRecommended `
1616
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
1717

18-
SHELL ["powershell", "-Command"]
18+
SHELL ["powershell", "-ExecutionPolicy", "Bypass", "-Command"]
19+
20+
# Install chocolatey
21+
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
22+
23+
# Install packages
24+
#
25+
# We need to get the new value of `$PATH` after `choco install`, but
26+
# chocolatey's `refreshenv` won't be available until we restart the shell.
27+
# Make `refreshenv` available right away, by importing the Chocolatey profile
28+
# module. See https://stackoverflow.com/a/46760714.
29+
COPY choco-packages.txt C:\
30+
RUN $ErrorActionPreference = 'Stop'; `
31+
choco install -y @(Get-Content C:\choco-packages.txt); `
32+
Import-Module "C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1"; `
33+
refreshenv
1934

2035
# Install vcpkg
2136
ADD https://github.com/Microsoft/vcpkg/archive/master.zip C:\TEMP\vcpkg-master.zip
2237
RUN $ErrorActionPreference = 'Stop'; `
2338
Expand-Archive -Path C:\TEMP\vcpkg-master.zip -DestinationPath .; `
39+
rm C:\TEMP\vcpkg-master.zip; `
2440
cd .\vcpkg-master; `
2541
.\bootstrap-vcpkg.bat; `
2642
.\vcpkg integrate install
2743

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

53+
# Tell the `vcpkg` crate to generate dynamically linked executables
54+
ENV VCPKGRS_DYNAMIC=1
55+
3256
CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

windows/choco-packages.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake
2+
--installargs='ADD_CMAKE_TO_PATH=System'
3+
git
4+
llvm
5+
mingw
6+
netfx-4.6.1-devpack
7+
ninja

windows/vc-packages.txt

+9
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
curl
2+
libpq
3+
libsodium
4+
libssh2
5+
openal-soft
6+
openssl
7+
portmidi
8+
sdl2
9+
sqlite3
110
zlib

0 commit comments

Comments
 (0)