所以我在这里阅读了有关分层构建的问题,例如:使用SCons创建分层构建
我想做两个独立的回购的真正的分层构造,它们都使用我设置为使用mercurial的子回购的scons.下面是说明我想要做什么的文件布局.
期望的布局:
project_root/ (new project that builds bar app using the libfoo built from source)
libfoo_subrepo/ (standalone project repo from bitbucket)
src/
SConscript
libfoo.c
libfoo.h
test/
SConscript
test_foo.c
SConstruct
barapp_subrepo/ (standalone project repo from bitbucket that uses libfoo)
src/
SConscript
bar.c
bar.h
test/
SConscript
test_bar.c
SConstruct
test/
SConscript
test_bar_with_foo.c
SConstruct
Run Code Online (Sandbox Code Playgroud)
所以我有两个单独的回购,都使用scons.第一个是libfoo,可以单独克隆并使用scons构建.当在libfoo根目录中运行scons时,它在src /中构建一个libfoo的静态库,并在test /中构建一个单元测试可执行文件,链接到src /中的静态库.
第二个回购有依赖libfoo的酒吧应用程序.它也可以单独克隆,如果在构建系统上安装了libfoo,它可以使用scons构建.
我想要做的是设置一个新的repo(project_root),它使用mercurial将libfoo和bar app repos设置为subrepos.所以当你克隆这个新的repo时,它会自动拉下bar app和它的依赖,libfoo.然后我希望能够在这个新的repo的根目录中运行scons并让它在libfoo_subrepo/root中执行scons来构建libfoo并进行单元测试.然后我希望它在barapp_subrepo/root中运行scons来构建栏并告诉它链接libfoo_subrepo/src /中的libfoo静态库.最后,我希望它在测试中构建一些新的单元测试/使用libfoo静态库和bar app中的源文件来组合测试bar app和libfoo.
据我所知,从阅读scons文档可以看出,我需要为"subrepo"创建一个自定义Builder,它将在子shell中运行scons.然后我可以将libfoo.subrepo和barapp.subrepo添加到project_root /目录以及一些方法,以便当构建器执行命令构建libfoo.subrepo时,它将源名称转换为它执行scons的路径.
building 'libfoo.subrepo' translates into executing 'cd libfoo_subrepo; scons'
Run Code Online (Sandbox Code Playgroud)
在我看来,scons无法递归地构建独立的scons项目.我读过的所有内容都假定您能够在子文件夹中创建SConscript文件,然后让根SConstruct文件依赖于SConscript文件.请告诉我有办法用scons做我想做的事.我不想回去做.
谢谢.