boost编译备忘

初始化

windows:

bootstrap.bat

linux:

bootstart.sh

参数

link=static|shared

threading=single|multi

runtime-link=static|shared

--with-

variant=debug|release

--build-type=complete 

--toolset=msvc-10.0 

address-model=64

代表编译成64位版本,如省略此项,默认为编译成32位版本。

linux编译:

./b2 --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-random --with-chrono variant=release link=static threading=multi address-model=64 stage

window编译:

bjam.exe --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-random toolset=msvc-12.0 variant=release link=static threading=multi address-model=32 stage

生成目录

--stagedir=./stage_debug


使用bcp.exe剪切boost库
1、把bjam.exe拷贝到tools/bcp 目录下,使用vs的命令行运行 bjam.exe,参数随意,无非也就是toolset选择 release/debug选择等等,没有参数也能编译成功。

2、在bin.v2/tools/bcp/...  (再后面是根据你的编译选项而生成的文件夹,如msvc-9.0/release/link-static/threading-multi)  目录下可以找到 bcp.exe。这就是我们所需要的程序了。

3、bcp的使用是简单的,假设我们允许程序员用A、B、C、D这样四个模块,那么我们可以这样:
bcp --boost: A B C D
这里A、B、C、D可以是:
Boost的头文件名。如: boost/shared_ptr.hpp
Boost的库名。如:regex
Boost的头文件标题:boost/shared_ptr 或者 shared_ptr

如果是在boost根目录下,那指定boost目录的参数也可以省去。

猜你喜欢

转载自my.oschina.net/u/3773235/blog/1621036
今日推荐