Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export environment from vcvars64.bat #17

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,14 @@ RUN .\vcpkg-master\vcpkg install @(Get-Content C:\vc-packages.txt)
# Tell the `vcpkg` crate to generate dynamically linked executables
ENV VCPKGRS_DYNAMIC=1

# Export environment from `vcvars64.bat` in powershell. This puts `cl.exe` and
# others on our `PATH`.
#
# Powershell doesn't have an equivalent of `source`, so we use `cmd` to run
# `vcvars64.bat`, then parse each environment variable and set it manually.
# See https://stackoverflow.com/a/2124759.
RUN cd 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build'; `
cmd /c 'vcvars64.bat & set' | `
%{ if ($_ -match '=') { $v = $_.split('='); [System.Environment]::SetEnvironmentVariable($v[0], $v[1], [System.EnvironmentVariableTarget]::Machine) } }

CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]