I would like SCons to create some source files for me in my src/ directory, and then create them like any other source file in my build/variantX .
This is my SCons file:
import SCons def my_builder(env, target, source): # do stuff pass env = Environment() env.VariantDir('build/variant1/', 'src', duplicate=0) env.Command('src/foobar.cc', 'src/foobar.input', action=my_builder) env.Program('bin/test', [ 'build/variant1/foobar.cc', 'build/variant1/test.cc', ])
These are errors with the following message:
Source src/foobar.cc not found, target build/variant1/foobar.o
which, in my opinion, is not true, given that I really provide a command to build src/foobar.cc .
Now I have tried some workarounds:
if I replace build/variant1/foobar.cc in the program with src/foobar.cc , it works, but obviously foobar.o is created in src/ and not build/variant1
if I replaced src/foobar.cc in Command with build/variant1/foobar.cc , it works, but I would like the code to be generated in src/ ; (also because things like relative paths in include directories won't work if duplicate=1 )
if duplicate=1 , I get a similar error message, but this time mentioned the options directory:
Source build/variant1/foobar.cc not found, target build/variant1/foobar.o
Is there any way around this? Is this a limitation / error in SCons, or is there a fundamental misunderstanding on my side?
Unclezeiv
source share