scons:让 glob 与构建目录配合得很好
我想在子目录中构建所有 .c 文件。我想我会做这样的事情:
src/foo/SConscript
contains:
import glob;
here = Dir('.');
sourcefiles_raw = glob.glob(here.path+'/*.c');
print(sourcefiles_raw);
# print them for debugging
# ... then build them (in the process, making scons aware of dependencies)
src/SConscript
contains:
SConscript(['foo/SConscript']);
SConstruct
contains:
SConscript(['src/SConscript'],build_dir='build');
但它打印 []
,因为 glob.glob()
在目录 build/foo
中运行,然后 scons 才能决定需要从 src 复制哪些源文件/foo
到 build/foo
。
我该如何解决这个问题?
I would like to build all .c files in a subdirectory. I figured I would do something like this:
src/foo/SConscript
contains:
import glob;
here = Dir('.');
sourcefiles_raw = glob.glob(here.path+'/*.c');
print(sourcefiles_raw);
# print them for debugging
# ... then build them (in the process, making scons aware of dependencies)
src/SConscript
contains:
SConscript(['foo/SConscript']);
SConstruct
contains:
SConscript(['src/SConscript'],build_dir='build');
But it prints []
, since glob.glob()
runs in the directory build/foo
before scons can decide which sourcefiles need to be copied from src/foo
to build/foo
.
How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系,看来你应该(RTFM )并使用 scons 的
Glob()
而不是glob.glob()
。never mind, it seems you're supposed to (RTFM) and use scons's
Glob()
rather thanglob.glob()
.