[Scons-users] Fwd: More than one source directory for a single variant directory

Dirk Bächle tshortik at gmx.de
Thu Oct 24 19:12:35 EDT 2013


Hi Yann,

On 24.10.2013 23:51, Yann Bane wrote:

> Hello all,

>

> I'm trying to build several programs from source files (in different

> directory for each program) into a single variant directory (bin).

>

> However, scons is erroring out on me with the following message:

>

> >scons: *** 'bin' already has a source directory: 'source/prog1'.

>

> What's going on here?

>


I'm not quite sure, since the code in your SConstruct and the project
tree in your SO question are slightly out of sync. But I'd like to
suggest, turning the setup of the SConstructs/SConscripts around a bit
for your case.
I'm assuming that you only need a single "bin" output folder, in which
case the usage of variant_dir is not necessary.

Try to create simple SConscripts in your "obj" folders and the "bin"
folder directly, which you include via SConscript() from the top-level
SConstruct:

env = Environment()
Export('env')

SConscript('object/prog1/SConscript')
SConscript('object/prog2/SConscript')

SConscript('bin/SConscript')

The sub-SConscripts then look like:

Import('env')

env.SharedObject('program1.os','#src/prog1/program1.cpp')


and:

Import('env')
env.Program('program1','#object/prog1/program1.os')


Best regards,

Dirk



More information about the Scons-users mailing list