How to configure SCons to use a specific MSVC install

154 Views Asked by At

We have just starting to use conan as an package manager and SCons as construction tool. One of the package that I have download as package is also MSVC. So, MSVC is now locally available in project folder. The question is how reference the local folder/compiler to the SCons construction tool? What should be the syntax in sconstruct?

One example what does not work is here:

import os

# compiler path
path = ['D:/Git/project/08_tools/pcks/MSVC_13_10_3052/bin/']
# new environment instance
e = Environment(tools = ['msvc'], ENV = {'PATH' : path})

This is only a basic example. I don't know where to put in the MSVC local path that will work? I have also install Visual Studio with actual MSVC compiler and have worked with same example.

1

There are 1 best solutions below

0
bdbaddog On

Configuring MSVC for use is unfortunately more complicated than just adding it to your path. (MSVC's setup script set LINK, PATH, and other shell variables which are used when building/linking/etc with MSVC)

Likely the best solution for you is something like this:

# compiler path
path = ['D:/Git/project/08_tools/pcks/MSVC_13_10_3052/bin/']
msvc_script='D:/Git/project/08_tools/pcks/MSVC_13_10_3052/path_to../vcvars.bat'
# new environment instance
e = Environment(tools = ['msvc','mslink','mslib'], MSVC_USE_SCRIPT=msvc_script)

You can see more info on the MSVC_USE_SCRIPT in the manpage.