我有一个SConscript被复制到构建目录(variant_dir = ...
)进行构建。作为not being able to express dependencies的解决方法,我正在尝试将一些其他文件复制到构建目录中。
如何在SConscript中确定当前构建目录是什么?
例如,在以下布局中,内部SConscript文件应将my_build_directory
设置为“build / something”。
project/
SConstruct # "SConscript('something/SConscript', variant_dir = 'build/something')
something/
SConscript # "my_build_directory = ..."
答案 0 :(得分:2)
我的回答似乎太简单了,所以也许我误解了这个问题,但是......
对我来说,在subdir / SConscript中:
my_build_directory = '.'
echo_cmd = Command('always.echo', [], "echo %s" % (Dir('.').abspath))
Alias('echo', echo_cmd)
产生
# => cd test-scons
# => ls
# build/ SConstruct subdir/
# => scons echo
# scons: Building targets ...
# echo HOME/test-scons/build/subdir
# HOME/test-scons/build/subdir
# scons: done building targets.