使用 SCons 构建外部代码树
我正在尝试使用 SCons 来构建一个软件,该软件依赖于系统中安装的源中可用的库。例如在 /usr/share/somewhere/src
中。该目录中的 *.cpp
应该内置到静态库中并与我自己的代码链接。库源中没有 SConscript
。
由于库位于系统目录中,我没有权限,也不想将构建工件放在 /usr
下的某个位置。当前工作目录中的 /tmp
或 .build
即可。我怀疑这可以很容易地完成,但我被所有这些 SConscripts
和 VariantDirs
所困扰。
env = Environment()
my_things = env.SConscript('src/SConsctipt', variant_dir='.build/my_things')
sys_lib = env.SConscript(????)
result = env.Program('result', [my_things, sys_lib])
解决 SCons 问题的预期方法是什么?
I'm trying to use SCons for building a piece of software that depends on a library that is available in sources that are installed in system. For example in /usr/share/somewhere/src
. *.cpp
in that directory should be built into static library and linked with my own code. Library sources have no SConscript
among them.
Since library is in system directory I have no rights and don't want to put build artefacts somewhere under /usr
. /tmp
or .build
in current working directory is OK. I suspect this can be done easily but I've got entangled by all these SConscripts
and VariantDirs
.
env = Environment()
my_things = env.SConscript('src/SConsctipt', variant_dir='.build/my_things')
sys_lib = env.SConscript(????)
result = env.Program('result', [my_things, sys_lib])
What is intended way to solve the problem with SCons?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 存储库 来做这个。例如,在 SConstruct 中,您可以编写:
然后在
external.scons
文件(位于源代码树中)中,添加外部源代码树的路径以及如何在其中构建库。You could use a Repository to do this. For example, in your SConstruct you could write:
Then in the
external.scons
file (which is in your source tree), you add the path to the external source tree and how to build the library therein.