Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Visual Studio x64 prompt (for CMake and Ninja)

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.

like image 360
Lars Bilke Avatar asked Mar 10 '14 15:03

Lars Bilke


People also ask

How to open Visual Studio x64 win64 command prompt?

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.

What is x64 native tools command prompt?

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.


1 Answers

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
       ..."""
like image 160
Lars Bilke Avatar answered Oct 03 '22 00:10

Lars Bilke