SCons fails to find generated file

I am tring to generate some source file, and use the generated file to compile..

gen = env.Command("/tmp/dummy", "demo.json","demo.py $SOURCE > $TARGET")
env.AlwaysBuild(gen)

bin=env.Program(target='demo', source=[Glob("*.cc")])
env.Depends(bin, gen)

the gen will generate required demo.cc

gen = env.Command("/tmp/dummy", "demo.json","demo.py $SOURCE > $TARGET")

But get error when compiling demo as follows:

failed: Source demo.cc' not found, needed by target demo.o'.

By ls demo.cc, I am sure that the required file demo.cc is indeed generated in the correct directory.

The cause should be something with dependency. Noted that I specify explicit dependency of the bin on demo.cc. Still failed.

Any ideas why ?

===== More details =====

Every clean build, ie scons -c && scons -j4, works. But afterword build fails even with the demo.cc file in place.


You are telling SCons that the result (=target) of your env.Command() is " /tmp/dummy ". Try to use

gen = env.Command("demo.cc", "demo.json","demo.py $SOURCE > $TARGET")

instead, such that SCons can pick up the dependency automatically. You don't need the explicit Depends() .

链接地址: http://www.djcxy.com/p/67926.html

上一篇: 在Flash 9,Actionscript 3中播放短音时的延迟

下一篇: SCons未能找到生成的文件