[Scons-users] Code generation and VariantDir?
Jason Fritz
jasonfritzpublic at gmail.com
Mon Apr 28 16:00:30 EDT 2014
Hi Dirk,
First of all, thank you for your response! Comments below.
On Mon, Apr 28, 2014 at 12:19 PM, Dirk Bächle <tshortik at gmx.de> wrote:
> [...]
> ### 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)
>
I tried using the "exports" named variable once and had trouble that I
didn't have with Export() (and of course I've forgotten what happened).
I'll try it again. Thank you for this suggestion.
>
> 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.
>
The reason I was Clone()ing was a misguided attempt to encapsulate
environments to SConscript files, because yes I was modifying the
environment directly and I didn't want that to spill over to other
directories. Not to mention, I'm afraid of untrained developers who will
someday be touching these files and may break other directories.
Anyway, by removing the Clone() calls, I got rid of the first warning: "scons:
warning: Two different environments were specified for target
src/autogen/foo.h"
However, I'm still getting the second error/warning: "scons: *** Multiple
ways to build the same target were specified for: src/autogen/foo.h (from
['src/autogen/foo.tsn'] and from ['src/autogen/foo.tsn'])". It lists the
same .tsn file twice. It also says the error is coming from the SConscript
line that calls my custom Builder: "fileList = codegenEnv.TsncCpp(tsnFile)"
Any idea how to get rid of this second error?
Thanks!!!!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140428/af6ab193/attachment-0001.htm
More information about the Scons-users
mailing list