[Scons-users] Code generation and VariantDir?

Dirk Bächle tshortik at gmx.de
Mon Apr 28 14:19:14 EDT 2014


Hi Jason,

On 28.04.2014 19:52, Jason Fritz wrote:

> Hi all,

>

> I'm hoping somebody can give me a recommendation on "best practice"

> for arrangement of SConscript files for my situation involving code

> generation and different VariantDir's for compilation.

>


your basic setup and directory structure looks fine.


> [...]

> ### Define Build Hierarchy

> # Release variant

> Export(env = releaseEnv)

> SConscript('SConscript', variant_dir='release', duplicate=0)

>

Here I'd rather write:

SConscript('SConscript', variant_dir='release', exports={'env' :
releaseEnv}, duplicate=0)

and

> # Debug variant

> Export(env = debugEnv)

> SConscript('SConscript', variant_dir='debug', duplicate=0)

SConscript('SConscript', variant_dir='debug', exports={'env' :
debugEnv}, duplicate=0)

, accordingly.


> -----

>

> My SConscript file in the autogen directory looks roughly like this

> (simplified):

> -----

> Import('env codegenEnv')

> env = env.Clone()

> codegenEnv = codegenEnv.Clone()

>

You don't have to Clone() here, since you're sticking different
environments in from the top anyway. Skip this step, as long as you
don't want to heavily modify your environment locally, but then would
reach it down further the folder hierarchy to other SConscripts that
shouldn't be affected by your changes.

But for the codegenEnv this doesn't make sense anyway, since you want to
use the same environment all over the place. By Clone()ing, you're
creating copies...that's where the warning comes from.

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140428/2f7dec41/attachment.htm


More information about the Scons-users mailing list