[Scons-users] detecting Visual Studio Commandline

Kraus Philipp philipp.kraus at flashpixx.de
Sat Aug 11 14:32:58 EDT 2012



Am 11.08.2012 um 17:28 schrieb Gary Oberbrunner:


> On Sat, Aug 11, 2012 at 11:21 AM, Kraus Philipp

> <philipp.kraus at flashpixx.de> wrote:

>> Hello,

>>

>> I'm using platform scripts for getting the different environmental information.

>> If call a scons subscript on the result of env["platform"], this works with darwin (OSX), posix and cygwin

>> very well, but can I detect if the script is run under the Visual Studio Command Line?

>>

>> If I run my scons script on the VS CLI the platform returns "win32" so is there an option something like "msvc" ?

>> I need an information about the "toolkit".

>

> All the VS command line does is start cmd.exe with a bat script. The

> bat script sets up various env vars, so you can probably just check

> for something in os.environ(...).

>

> But note that unless you change something, SCons does not import the

> user's OS environment and pass it to the executed commands -- this is

> to ensure builds are reproducible by anyone. SCons insteads finds the

> VS bat scripts and runs them itself to get the proper OS environment

> to pass to cl, link.exe and so on. This means any SConstruct should

> work the same in a VS CLI or a simple cmd.exe window, so perhaps

> you're asking the wrong question above. (If you want to import the

> incoming environment, of course you can do that -- see the man page.)



Thanks Gary,

I don't know in which way VS works, but this makes my problems easier.
I'm working primary with *nix system, but at this time I need also the VS env.
But the os.environ checking is very easy, so I will do this.

Phil


More information about the Scons-users mailing list