Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to webmaster@scons.org. Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).

Same as SconstructMultiple with an 'all' Alias used.

Now the command line also allows:

scons mode=release all  ; build all subprojects
scons mode=debug all

The Sconstruct does not change from SconstructMultiple. The Sconscript changes slightly (the last 2 lines):

   1 import glob
   2 
   3 Import('env', 'project', 'mymode', 'debugcflags', 'releasecflags')
   4 localenv = env.Copy()
   5 
   6 buildroot = '../' + mymode  #holds the root of the build directory tree
   7 builddir = buildroot + '/' + project   #holds the build directory for this project
   8 targetpath = builddir + '/' + project  #holds the path to the executable in the build directory
   9 
  10 #append the user's additional compile flags
  11 #assume debugcflags and releasecflags are defined
  12 if mymode == 'debug':
  13    localenv.Append(CCFLAGS=debugcflags)
  14 else:
  15    localenv.Append(CCFLAGS=releasecflags)
  16 
  17 #specify the build directory
  18 localenv.BuildDir(builddir, ".", duplicate=0)
  19 
  20 srclst = map(lambda x: builddir + '/' + x, glob.glob('*.cpp'))
  21 pgm = localenv.Program(targetpath, source=srclst)
  22 env.Alias('all', pgm)

The difference is that the Node from Program() is saved in variable 'pgm' and is used in an Alias(). The Alias() in the three sconscripts name the same alias name (i.e. 'all'). When the alias name is used on the command line, scons builds everything associated with it.

Note a couple of things:

SconstructMultipleAll (last edited 2008-03-12 02:46:57 by localhost)