跳转至

boost

1 boost 库编译

1.1 常用的 boost 库编译指令解释

  • 常用的编译指令
  • 示例
  • 扩展部分visual studio的msvc版本
  • link=static|shared 指 boost 生成的动态库还是静态库,如:生成 regex 库时是生成静态库还是动态库
  • static 静态库
  • shared 动态库
  • 默认值: static
  • runtime-link=static|shared 指 boost 链接系统运行时库的方式,如:regex 库需要其它库时,是使用静态链接还是动态链接
  • static 静态库
  • shared 动态库
  • 默认值: shared
  • --with--<library> 指定哪一个库需要编译,如 --with-regex 则会指编译 regex 库,忽略 --with- 默认编译所以库
  • --without-<library> 指定哪一个库不需要编译,如 ``--without-regex 则除了 regex 库外,编译其它所有库
  • threading=single|multi 指定是否生成多线程库
  • single 生成单线程库
  • multi 生成多线程库
  • 默认值: multi
  • toolset=<toolset> 指定编译库的工具集,如:toolset=msvc-12.0
  • variant=debug|release 指定生成 debug 还是 release 版的库
  • install 会同时生成 lib 和 include 文件
  • stage 只会生成 lib 文件
  • --prefix=<INSTALLDIR>install 选项一起用,指定 include 和 lib 文件生成目录
  • --stagedir=<STAGEDIR>stage 选项一起用,指定 lib 文件生成目录
  • 默认值:./stage

1.2 示例

  • 常用的编译命令
b2 stage --with-regex toolset=msvc-14.2 link=static runtime-link=shared --stagedir="E:\boost\lib"
  • 查询需要编译的库
b2 --show-libraries

以上命令会在 E:\boost\lib 目录下生成静态、多线程、适用 vs2019 的 32|64 位、debug|release 版的 regex 库。

1.3 扩展:部分 visual studio 的 msvc 版本

  • msvc-14.2 是 vs2019
  • msvc-14.1 是 vs2017
  • msvc-14.0 是 vs2015
  • msvc-12.0 是 vs2013
  • msvc-10.0 是 vs2010

2 boost 库常用部分

  • [ ] Asio (Portable networking and other low-level I/O, including sockets, timers, hostname resolution, socket iostreams, serial ports, file descriptors and Windows HANDLEs.)
  • [ ] Compute (Parallel/GPU-computing library)
  • [ ] DLL (Library for comfortable work with DLL and DSO.)
  • [ ] format 字符串的格式化
  • [ ] filesystem 文件系统(c++17)
  • [ ] Interprocess (进程间通讯)
  • [ ] JSON (JSON parsing, serialization, and DOM in C++11)
  • [ ] lexical_cast 字符串与数值的转换
  • [ ] log 日志
  • [ ] Timer (Event timer, progress timer, and progress display classes.)
  • [ ] Pool (Memory pool management.)
  • [ ] Parameter (Boost.Parameter Library - Write functions that accept arguments by name)
  • [x] Process 可移植创建进程
  • [x] Serialization (序列化)
  • [ ] Stacktrace (Gather, store, copy and print backtraces.)
  • [ ] System (错误处理)
  • [ ] Timer (Event timer, progress timer, and progress display classes.)
  • [ ] Units (Zero-overhead dimensional analysis and unit/quantity manipulation and conversion.)