[Scons-users] Confused on VariantDir and build outputs on large project

Francis Bolduc fbolduc at gmail.com
Mon Nov 25 09:07:39 EST 2013


I do something similar with VariantDir in my project. Here is what I
would do with yours:

1- Put your SConstruct and SConscript files at the top-level (P1 and
P2 should have their own SConscripts).

2- In your SConstruct, set a variable called NAME in both your debug
and release environments.
envDebug['NAME'] = 'debug'
envRelease['NAME'] = 'release'

3- In your SConstruct, set your VariantDir to be: 'build/${NAME}'

4- In your SConstruct, call the SConscripts


This ought to give you the following tree:
build/debug/src/A
build/debug/src/B
build/debug/src/C
build/debug/src/P1
build/debug/src/P2
build/release/src/A
build/release/src/B
build/release/src/C
build/release/src/P1
build/release/src/P2

And, assuming you didn't do anything fancy with the Program and
Library builders, your binaries will be located in the following
directories:
build/debug
build/release


This is not exactly what you wanted, but it is similar. Using
VariantDir can get tricky, especially if you want to do something
fancy. I found that it was not worth the trouble. That is why I ended
up doing something simple that I could reason with.


--
Francis Bolduc, B.Sc.


More information about the Scons-users mailing list