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

Carl Cerecke carl.cerecke at compacsort.com
Sun Nov 24 21:06:52 EST 2013


Hi,

I'm porting a large, complex C++ program from MSVC to Linux. I've chosen
scons for the build system, but I've come across a bit of a showstopper (at
least, I can't figure out what the right solution is. I'm pretty sure there
is one) when it comes to build outputs and intermediate files.

I'm trying to keep the Linux build system reasonably similar to the Visual
Studio build system to make it an easier transition for the other
developers.

We have, for example, Program P1 and P2, and library A, B, and C like so:

/src/A/
/src/B/
/src/C/
/src/P1/
/src/P2/

Let's say P1 requires A, which requires B, which requires C.
P2 requires B, which requires C.

So P1 and P2 should each have a SConstruct file. And A, B, and C will have
a SConscript file.

Here's the tricky part:
I want the intermediate files and build results to be in dirs like so:
/build/A/debug
/build/B/debug
/build/C/debug
/build/P1/debug
/build/P2/debug
(Also corresponding /build/<X>/release hierarchy)

So, assuming empty build directories:
"scons" in /src/P2/ will build C, then B, then P2 in debug mode
"scons" in /src/P1/ will build A, then P1 in debug mode (C and B were
already built by prev scons command)

Building in "release" should build everything required:

"scons --release" in /src/P2/ will build C, then B, then P2 in release mode.

Building again in debug should not build anything, because the intermediate
files from the debug build are still present:

"scons" in /src/P2/ will not have anything to do.


>From the documentation, and my own experimentation, I cannot figure out how

to wield VariantDir (or variant_dir) to do what I want.

If this a reasonable thing to want to do, how do I do it? If it isn't the
right way, what is a Better Way?

Thanks,
Carl
--
Carl Cerecke
SENIOR SOFTWARE DEVELOPER



*M:* +64 21 205 0239
*F:* +64 9 634 4491
*Skype:* carl-compac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131125/d580ed07/attachment.html


More information about the Scons-users mailing list