嗯,我也不太清楚在MergeLib一步的細節,但它似乎像你想別的東西依賴於你的合併LIB一步..喜歡你的最終方案?
import SCons
env = Environment()
def merge_libs(self, target, source, env):
print "hi"
return env.StaticLibrary(target, source)
env.Append(BUILDERS = {'MergeLibs' : merge_libs})
lib = env.MergeLibs('mrglibs', ['some_file.cpp', 'some_file2.cpp'], env)
prog = env.Program('test.cpp')
env.Depends(prog, lib)
這使我的輸出:
scons: Reading SConscript files ...
hi
scons: done reading SConscript files.
scons: Building targets ...
g++ -o some_file.o -c some_file.cpp
g++ -o some_file2.o -c some_file2.cpp
ar rc libmrglibs.a some_file.o some_file2.o
ranlib libmrglibs.a
g++ -o test.o -c test.cpp
g++ -o test test.o
scons: done building targets.
因此,它肯定是在分析階段(我認爲這是)還是讀,但它應該得到你想要的東西。
來源
2011-07-01 22:36:23
Tom