I have a Jenkins slave with Visual Studio 2012 and want to build for x64. What I need is the prompt environment I get when I run the tools prompt link in the Windows Start Menu. People suggest to do it like this (in a Jenkins Windows Batch prompt):
call "%VS110COMNTOOLS%vsvars32.bat" x86_amd64
But this is not enough. There are small differences in the PATH
, LIB
and LIBPATH
environment variables: the paths in there point to the x32 paths only, e.g. to
...;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;...
instead of
...;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;...
In fact I am trying to build with the Ninja generator from CMake where the build configuration is determined by the prompt environment.
Use a 64-bit hosted developer command prompt shortcut To access these command prompts on Windows, on the Start menu, open the folder for your version of Visual Studio, and then choose one of the x64 native or cross-tool developer command prompts.
x64 Native Tools Command Prompt - Sets the environment to use 64-bit, x64-native tools to build 64-bit, x64-native code. x86_x64 Cross Tools Command Prompt - Sets the environment to use 32-bit, x86-native tools to build 64-bit, x64-native code.
You need to call vcvarsall.bat x86_amd64
which is located in the VC
-subdirectory (and eventually remove parentheses from the PATH
):
set path=%path:"=%
call "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" x86_amd64
If you want to run this in a Pipeline script:
bat """set path=%path:\"=%
call "%vs110comntools%..\\..\\VC\\vcvarsall.bat" x86_amd64
..."""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With