Scons help!

Anuj Goyal angoyal at siebel.com
Wed Mar 24 14:29:18 EST 2004


Does anyone have a scons file that make use of multiple compilers on
win32 and linux?

I am trying to get my scons script to work on win32 (using cl.exe) and
linux (using gcc) .

it is a nightmare! I need a builder (or set of builders) that is
flexible enough for both platforms.  I tried to find projects that
make use of this on the net, but could not find any :(


opt = Options(None, ARGUMENTS)
opt.AddOptions(
	EnumOption(
		'COMPILER',
		'The compiler you want to use',
		'cl',
		['cl','gcc']))

env = Environment(options=opt)

CLDEBUGCPPFLAGS = r'/nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG"
/D "WIN32" /D "_WINDOWS" /D "BOBO_DLL_EXPORT" /D "USE_STANDARD_HEAP"
/YX /FD /c'

env['BUILDERS']['cl'] = Builder(action = 'cl '+ CLDEBUGCPPFLAGS +'
%SOURCE')
env['BUILDERS']['gcc'] = Builder(action = 'gcc -co %TARGET %SOURCE') 


env['BUILDERS']['MyCompiler'] = env['BUILDERS'][env['COMPILER']]

env.MyCompiler('myheap.cpp')


and here is the output.

F:\work\src\mallocheap>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D
"_WINDOWS" /D "BOBO_DLL_EXPORT" /D "USE_STANDARD_HEAP"
 /YX /FD /c %SOURCE
Command line warning D4024 : unrecognized source file type '%SOURCE',
object file assumed
Command line warning D4027 : source file '%SOURCE' ignored
Command line warning D4021 : no action performed
scons: done building targets.



More information about the Python-list mailing list