我正在尝试从Boost.Build迁移到Bazel构建系统。我需要为正在构建库的目录编写Jamfile。
我的Jamfile是
project : usage-requirements <include>$(PROJECT_INSTALL)
<linkflags>-lboost_system
;
lib CommonDataStructures : [ glob *.cpp ] : <link>static ;
install libCommonDataStructures
: CommonDataStructures
: <install-type>LIB
<variant>release:<location>"$(PROJECT_INSTALL)/lib"
<variant>debug:<location>"$(PROJECT_INSTALL)/libdebug"
: release debug
;
如何为Bazel编写BUILD文件?
最佳答案
抱歉,但是我没有Boost.Build的经验,但是我会尽力的。
BUILD文件可能仅包含:
cc_library(
name = "common_data_structures",
srcs = glob(["*.cpp"]),
)
要构建它,只需运行
bazel build //:common_data_structures
。 Bazel将同时生成静态库和共享库,并且当其他cc_library或cc_binary依赖它时,默认情况下它将静态链接。查看我们的c++ rules documentation以查看所有属性。这对您有帮助吗?
关于c++ - 如何为此Boost.Build Jamfile编写Bazel BUILD文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43330414/