Boost provides free peer-reviewed portable C++ source libraries.
1、下载源码
https://www.boost.org/users/download/
2、Bootstrapping :Building B2 engine
$ cd .../boost_1_79_0
$ ./bootstrap.sh
# 带选项
$ ./bootstrap.sh --with-libraries=all --with-toolset=clang
编译完成后,bjam 会被安装在 tools/build/src/engine/b2 目录下。
通过编辑 project-config.jam 来使用 --with-toolset 选项或调整配置。
# 查看 bjam 版本
$ cd tools/build/src/engine
$ ./bjam --version
B2 4.8-git
# 查看帮助
$ ./b2 --help
3、build
# 编译, 带上 -j8 命令 ,不然就是单核心编译
$ ./b2 -j8
# clean
./b2 clean -j8
# 生成头文件
./b2 headers
$ ./b2 -h
Invalid option: -h
usage: ./b2 [ options ] targets...
-a Build all targets, even if they are current.
-dx Set the debug level to x (0-13,console,mi).
-fx Read x instead of bootstrap.
-jx Run up to x shell commands concurrently.
-lx Limit actions to x number of seconds after which they are stopped.
-mx Maximum target output saved (kb), default is to save all output.
-n Don't actually execute the updating actions.
-ox Mirror all output to file x.
-px x=0, pipes action stdout and stderr merged into action output.
-q Quit quickly as soon as a target fails.
-sx=y Set variable x=y, overriding environment.
-tx Rebuild x, even if it is up-to-date.
-v Print the version of jam and exit.
--x Option is ignored.
使用 brew时,bjam 和 boost 是分开安装的。
$ brew install boost
$ brew install bjam
安装成功后,安装包地址位于 /usr/local/Cellar/boost/
并软链接到 /usr/local/include 和 /usr/local/lib
你可以在 /usr/local/lib 下找到 libboost_* 文件
可参考文章:https://huangkx.blog.csdn.net/article/details/80323743
伊织 2022-06-23(四)