如何使用 Boost 和 Jamroot 构建多个目标?
How to build multiple targets with Boost and Jamroot?
我想创建一个项目,我可以使用定义标志选择两个不同的目标来构建。
例如,在我的代码中,我有多个部分
#ifdef LINUX
...
#else
...
#
在 Jamroot 文件中的两个目标之间进行选择的最佳做法是什么?甚至可能吗?我应该在根目录中创建两个不同的 Jamroot 文件并使用 bjam 调用它们吗?根据我在手册部分中发现的内容,无法使用特定的 Jamroot 文件调用 bjam。
假设我的示例 Jammroot 文件如下所示;
project myproj_linux
:
requirements
<define>LINUX
;
exe myprog_linux:
test/Jamfile
myprog.cpp
;
是否可以在同一个文件中添加一个额外的项目,例如 myproj_ose,或者应该如何完成?或者我可以有不同的 Jamfiles,例如 Jamroot 根据指定的目标调用的子目录中的 Jamfile.linux?
如果我的任何建议都不可行,那么这个问题怎么解决?
我想你想要这样的东西:
project myproj
: requirements
<target-os>linux:<define>LINUX
<target-os>windows:<define>WINDOWS
;
exe myprog : test/Jamfile myprog.cpp ;
您可以在 docs. But that just builds the same program with different options. It's also possible to change what variations of a target to build 中阅读有关条件要求的更多信息。例如:
exe myprog : test/Jamfile myprog_linux.cpp : <target-os>linux ;
exe myprog : test/Jamfile myprog_windows.cpp : <target-os>windows ;
我想创建一个项目,我可以使用定义标志选择两个不同的目标来构建。
例如,在我的代码中,我有多个部分
#ifdef LINUX
...
#else
...
#
在 Jamroot 文件中的两个目标之间进行选择的最佳做法是什么?甚至可能吗?我应该在根目录中创建两个不同的 Jamroot 文件并使用 bjam 调用它们吗?根据我在手册部分中发现的内容,无法使用特定的 Jamroot 文件调用 bjam。
假设我的示例 Jammroot 文件如下所示;
project myproj_linux
:
requirements
<define>LINUX
;
exe myprog_linux:
test/Jamfile
myprog.cpp
;
是否可以在同一个文件中添加一个额外的项目,例如 myproj_ose,或者应该如何完成?或者我可以有不同的 Jamfiles,例如 Jamroot 根据指定的目标调用的子目录中的 Jamfile.linux?
如果我的任何建议都不可行,那么这个问题怎么解决?
我想你想要这样的东西:
project myproj
: requirements
<target-os>linux:<define>LINUX
<target-os>windows:<define>WINDOWS
;
exe myprog : test/Jamfile myprog.cpp ;
您可以在 docs. But that just builds the same program with different options. It's also possible to change what variations of a target to build 中阅读有关条件要求的更多信息。例如:
exe myprog : test/Jamfile myprog_linux.cpp : <target-os>linux ;
exe myprog : test/Jamfile myprog_windows.cpp : <target-os>windows ;