Executing the binary after compilation using scons
I am using the scons to compile 2 binaries. Compilation happens in 2 stages. The compilation and execution of开发者_如何学JAVA the first binary generates files needed for compilation of second binary.
Each compilation is done via separate Environment(). The relevant portion of SConstruct file looks like this:
env_gen.Program('#gen', gen_src)
env_gen.Command(ker_src + generated_src, "./gen")
env_ker.Program('#ker', ker_src + generated_src)
The problem that I am having is that even though the compilation of 'ker' happens after the execution of the 'gen', 'ker' compilation complains about missing generated files.
Is this because the list of dependency for 'ker' is generated before './gen' is executed? Does anyone know how to overcome this??
TIA
Assuming "ker" depends on the files generated by "gen", I think this might be what you want:
GENERATED_FILES = env_gen.Command(ker_src + generated_src, "./gen")
env_ker.Depends(GENERATED_FILES)
env_ker.Program('#ker', ker_src + generated_src)
Check the Scons manual for details on explicitly defining dependencies using env.Depends()
精彩评论