文件夹层次结构中的多个位置可从中运行 SCons
到目前为止,我只看到过在单个 SConstruct 文件所在的同一文件夹中运行 SCons 的示例。假设我的项目结构如下:
- src/*.(cpp|h)
- tools/mytool/*.(cpp|h)
我想要的是能够在根目录以及 tools/ 内部运行“scons”我的工具。后者仅编译 mytool。这对于 SCons 来说可能吗?
我认为它涉及创建另一个 SConstruct 文件。我做了另一个:tools/mytool/SConstruct
我让它只包含:
SConscript('../../SConstruct')
并且我正在考虑执行 Import('env mytoolTarget') 并调用 Default(mytoolTarget),但仅使用上面的运行在当前目录中运行它而不是从根开始,因此包含路径被破坏。
这样做的正确方法是什么?
So far, I've only seen examples of running SCons in the same folder as the single SConstruct file resides. Let's say my project structure is like:
- src/*.(cpp|h)
- tools/mytool/*.(cpp|h)
What I'd like is to be able to run 'scons' at the root and also inside tools/mytool. The latter compiles only mytool. Is this possible with SCons?
I assume it involves creating another SConstruct file. I've made another one: tools/mytool/SConstruct
I made it contain only:
SConscript('../../SConstruct')
and I was thinking of doing Import('env mytoolTarget') and calling Default(mytoolTarget), but running it with just the above runs in the current directory instead of from the root, so the include paths are broken.
What's the correct way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
-u
选项来执行此操作。从任何子目录中,scons -u
都会在目录树中向上搜索SConstruct
文件。You can use the
-u
option to do this. From any subdirectory,scons -u
will search upwards in the directory tree for anSConstruct
file.