【问题标题】:How to write a Bazel BUILD file for this Boost.Build Jamfile?如何为此 Boost.Build Jamfile 编写 Bazel BUILD 文件?
【发布时间】:2017-04-10 18:30:13
【问题描述】:

我正在尝试从 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 文件?

【问题讨论】:

    标签: c++ gradle bazel boost-build


    【解决方案1】:

    抱歉,我没有使用 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 以查看所有属性。这有帮助吗?

    【讨论】:

    • 这根本没有帮助
    猜你喜欢
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-02
    • 1970-01-01
    • 2021-06-02
    相关资源
    最近更新 更多