[Scons-users] Code generation and VariantDir?

Jason Fritz jasonfritzpublic at gmail.com
Mon Apr 28 18:10:44 EDT 2014


On Mon, Apr 28, 2014 at 3:42 PM, Dirk Bächle <tshortik at gmx.de> wrote:


> On 28.04.2014 23:24, Jason Fritz wrote:

>

>> The setup you sent me has one serious difference from my setup: the

>> auto-generated foo.h gets copied to the variant directory. In my setup,

>> the .h is generated within the same dir as the .tsn. The reason I'm doing

>> it this way is for legacy reasons: I'm converting an old recursive

>> Makefile-based build system into SCons, and there are hundreds of

>> directories that are importing the header files from existing source dirs.

>> I suppose I could re-work the build system to put the generated source

>> under the variant dirs if necessary, but would prefer not to.

>>

>

>> Is there an easy way to get the .h file into the same dir but have the .o

>> files go into the variant dirs?

>>

>> Can't think of anything simple right now. But if you specify the header

> include paths via CPPPATH, relative within each SConscript, they should

> automatically get expanded for the variant dirs by prepending the output

> directory to each "-I" option. Like this, your header files should get

> found even when created in "debug"/"release", and you have a clear

> separation between inputs and outputs.

> Wouldn't that do?



This legacy build system is kind of messy, as I'm sure you can imagine.
For example, one directory I've converted has a CPPPATH with 60 different
entries. Each entry in CPPPATH is relative to the root dir, e.g.
"#/src/autogen".

I think what you're saying is that any paths in CPPPATH that are relative
from the SConscript dir will be expanded to include the output dir. Is
that correct? E.g. "../autogen" would become "release/src/autogen"

I like the idea of a clear separation between inputs/outputs, but I'm not
sure yet if that's a good enough goal to make this change. My existing
script is putting the .h files into the source dir, I just need to find
some way to get rid of the "Multiple ways to build the same target" error.

What did you think of my idea of having two hierarchies of SConscript
files? SConscript_autogen would be used first without any
VariantDir/variant_dir option, then the normal SConscript hierarchy would
be used with VariantDir.

Thanks again.
- Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140428/9536df51/attachment-0001.html


More information about the Scons-users mailing list