[Scons-users] Fwd: Support for automatic fetching of environment build variables

Kalrish Bäakjen kalrish.antrax at gmail.com
Sun Nov 10 13:22:59 EST 2013


Hello.

With Autotools-based builds, it is possible to set CC, CFLAGS, LDFLAGS...
and the rest of the family on the environment; the various Makefiles will
automatically handle them. With SCons, however, that functionality has to
be added by hand. It's not something tedious, as can be seen in the
following example:

import os

> for V in [ 'CXX' , 'CPPFLAGS' , 'CXXFLAGS' , 'LDFLAGS' ]:

> if V in os.environ:

> DefaultEnvironment()[ V ] = os.environ[ V ]



but I think it would be desirable to add it as a SCons built-in.
*SConscript*s are compiler-agnostic; you just have to tell the build system
to "build a library" or "build a program", without taking care of command
invocation. Including compiler flags in the build system would bind your
project to the toolchain of your choice. Personally, I think that setting
the appropiate compiler and linker flags is -or should be- completely up to
the user:

export CXX='g++ -std=c++11' CXXFLAGS='-O2 -march=native -mfpmath=sse -flto

> -fno-fat-lto-objects -fipa-pta -fuse-linker-plugin -pipe'



I'd like SCons to add the value of the traditional variables to the
*DefaultEnvironment* object.

(I'm not an expert, so please excuse me if my proposal is just silly. I
would like to see the pros and cons of this approach - maybe I'm wrong with
my understanding.)

Thanks in advance, best regards
Kalrish Bäakjen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131110/1dd476b3/attachment.html


More information about the Scons-users mailing list