c++ - 为仅包含标题的库创建 block

标签 c++ boost biicode

我正在尝试将仅包含 header 的库转换为 block 。该库已经使用 CMake 并包含测试和示例程序。我已经阅读了 biicode 文档,但不清楚如何为现有项目创建 block 。我很困惑是否应该执行 bii init -Lbii cpp:configure。我尝试在 biicode.conf 中将 Boost 指定为要求,但得到 WARN: Removing unused reference to "biicode/boost: 0"

请告诉我为现有项目创建区 block 的步骤,谢谢。

最佳答案

您应该开始使用库文件夹中的 bii init -L。然后,following this steps on the docs , 使用 bii deps 命令检查未解析的依赖项,调整 biicode.conf 文件(如果需要),并添加外部依赖项。

同时调整您当前的 CMakeLists.txt :

IF(BIICODE)
   INCLUDE("biicode.cmake")
   RETURN()
ENDIF()

biicode.cmake 文件中至少应包含 ADD_BII_TARGETS(),因为您依赖于 Boost,您的应该类似于下面的代码,here's a guide explaining how depend on Boost .

#Include the biicode Boost setup script
include(biicode/boost/setup)

ADD_BII_TARGETS()

#Setup Boost and build (if needed) the required Boost components
#Since lambda is header-only, there are no components to build and find
bii_find_boost()

#Add Boost headers to the block include directories
target_include_directories(${BII_BLOCK_TARGET} INTERFACE ${Boost_INCLUDE_DIRS})

运行 bii find 检索依赖关系,运行 bii configure 将其配置为您当前的配置并使用 bii build 构建。检查common issues building in the docs here .

对于使用 boost 的问题 - biicode has a boost repository in github .

关于c++ - 为仅包含标题的库创建 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29988398/

相关文章:

biicode - biicode 上的 libpng 有问题吗?

c++ - 使用 Cuda Thrust device_vector 崩溃

c++ - 使用 ICU_REJECT_USERPWD 标志集调用 WinHttpCreateUrl 在 Windows 7 中工作,但在 Windows XP 中不工作(使用虚拟 PC)

c++ - 使用 boost::proto 在 C++ 中编写 DSL

sockets - gethostbyname()(实际上,Boost Asio resolve())完全在2小时(120分钟,7200秒)后发生段故障

boost - Travis-ci boost 日志编译与 biicode 超时

c++ - 如何最小化更新一系列收集数据的节点的成本?

.net - 在 vector 的非托管 vector 中访问二维数组 (C++)

c++ - 如何优雅地从 C++ vector 中提取二维矩形区域

c++ - 在 TravisCI 下为 cmake 更改 C++ 编译器