开发者

Executing the binary after compilation using scons

开发者 https://www.devze.com 2023-01-23 07:31 出处:网络
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.

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消