SCons code generation and VariantDir -
i scons generate source files me in src/ directory, , build them other source file in build directory build/variantx.
this scons file:
import scons  def my_builder(env, target, source):     # 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',     ]) this errors following message:
source
src/foobar.ccnot found, needed targetbuild/variant1/foobar.o
which don't think correct, considering indeed providing command build src/foobar.cc.
now, tried few workarounds:
- if replace - build/variant1/foobar.ccin program- src/foobar.cc, work,- foobar.ogets created in- src/rather- build/variant1
- if replace - src/foobar.ccin command- build/variant1/foobar.cc, work, code generated in- src/; (also because things relative paths in include directories won't work unless- duplicate=1)
- if - duplicate=1, similar error message, time mentioning variant directory:- source - build/variant1/foobar.ccnot found, needed target- build/variant1/foobar.o
is there way around this? limitation/bug in scons, or there fundamental misunderstanding on side?
i suggest creating explicit dependency between command() , program() calls follows:
target1 = env.command('src/foobar.cc', 'src/foobar.input', action=my_builder) target2 = env.program('bin/test', [                       'build/variant1/foobar.cc',                       'build/variant1/test.cc',                       ]) depends(target2, target1) # should work # depends(target2, "src/foobar.cc") or specify target command() part of source program() follows:
target1 = env.command('src/foobar.cc', 'src/foobar.input', action=my_builder) env.program('bin/test', [             target1,             'build/variant1/test.cc',             ]) i havent tested this, im not sure how work in conjunction call variantdir()
here info regarding generating source code scons.
Comments
Post a Comment