boost库编译选项

编译的临时文件存放位置
    --build-dir=<builddir>

存放编译后库文件的路径,默认stage
    --stagedir=<stagedir>
    
编译所有版本
    --build-type=complete
    不然只会编译一小部分(相当于:variant=release,threading=multi;link=shared|static;runtime-link=shared)

编译版本
    variant=debug|release

静态库|动态库
    link=static|shared

多线程|单线程
    threading=single|multi

静态|动态连接C/C++标准
    runtime-link=static|shared
    
指定编译库
    --with-<library>
    
指定不编译的库
    --without-<library>
    
显示需要编译的库名称
    --show-libraries
    
编译不通系统位
    32:architecture=x86 address-model=32
    64: architecture=x86 address-model=64
    其中architecture=x86指定cpu为x86系列,address-model指定使用32位地址还是64位地址
    
编译工具
    toolset=msvc-9.0
    msvc-6.0 :  VC6.0
    msvc-7.0:  VS2003
    msvc-8.0:  VS2005
    msvc-9.0:  VS2008
    msvc-10.0:  VS2010
    
    
b2 toolset=msvc-9.0
    architecture=x86 
    address-model=64 
    link=static 
    variant=debug,release 
    threading=multi 
    runtime-link=static 
    --with-coroutine 
    --with-context 
    --with-container 
    --with-graph 
    --with-signals 
    --with-signals 
    --with-iostreams 
    --with-filesystem 
    --with-date_time 
    --with-thread 
    --with-serialization 
    --with-regex 
    --with-system 
    --with-program_options 
    --with-math 
    --with-mpi 
    --with-python 
    --with-wave 
    --with-test 
    --with-atomic 
    --with-chrono 
    --with-exception 
    --with-locale 
    --with-log 
    --with-random 
    --with-timer  
    --stagedir="E:\boost_1_69_0\64" 
    --build-dir="E:\boost_1_69_0\64\build"
    
    

1:生成 Release 版本,多线程,动态链接C++标准库的regex 动态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=shared  threading=multi  variant=release  runtime-link=shared  stage address-model=64
    输出:boost_regex-vc90-mt-x64-1_69.lib boost_regex-vc90-mt-x64-1_69.dll

2: 生成 Release 版本,多线程,静态链接C++标准库的regex 动态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=shared  threading=multi  variant=release  runtime-link=static  stage address-model=64
    输出:没有这种配置
    
3: 生成 Release 版本,多线程,动态链接C++标准库的regex 静态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=static  threading=multi  variant=release  runtime-link=shared  stage address-model=64
    输出:boost_regex-vc90-mt-x64-1_69.lib

4: 生成 Release 版本,多线程,静态链接C++标准库的regex 静态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=static  threading=multi  variant=release  runtime-link=static  stage address-model=64
    输出:libboost_regex-vc90-mt-s-x64-1_69.lib
    
5:生成 Debug 版本,多线程,动态链接C++标准库的regex 静态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=static  threading=multi  variant=debug  runtime-link=shared  stage address-model=64
    输出:libboost_regex-vc90-mt-gd-x64-1_69.lib

6: 生成 Debug 版本,多线程,静态链接C++标准库的regex 静态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=static  threading=multi  variant=debug  runtime-link=static  stage address-model=64
    输出:libboost_regex-vc90-mt-sgd-x64-1_69.lib
    
7: 生成 Debug 版本,多线程,动态链接C++标准库的regex 动态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=shared  threading=multi  variant=debug  runtime-link=shared  stage address-model=64
    输出:boost_regex-vc90-mt-gd-x64-1_69.lib boost_regex-vc90-mt-gd-x64-1_69.dll

4: 生成 Debug 版本,多线程,静态链接C++标准库的regex 动态库
b2 --toolset=msvc-9.0 
    --stagedir=E:\boost_1_69_0\mylib
    --with-regex   link=shared  threading=multi  variant=debug  runtime-link=static  stage address-model=64
    输出:没有这种配置

link=static:                    静态库。 生成的库文件名称以 “lib”开头
link=shared:                    动态库。生成的库文件名称无“lib”开头
threading=multi:            支持多线程。 生成的库文件名称中包含 “-mt”
variant=release:            生成的库文件名称不包含 “-gd”
variant=debug:                生成的库文件名称包含 “-gd”
runtime-link=static:    生成的库文件名称包含 “-s”
runtime-link=shared:    生成的库文件名称不包含 “-s”

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Boost是一个开源的C++集合,提供了许多功能强大的组件和工具,用于增强C++语言的功能和性能。Qt是一个跨平台的应用程序开发框架,而MinGW是一个在Windows平台上使用的GNU工具集。 要编译Boost并与Qt和MinGW一起使用,可以按照以下步骤进行操作: 1. 下载Boost:首先,你需要从Boost官方网站(https://www.boost.org/)下载Boost的源代码。选择适合你的操作系统和编译器的版本。 2. 解压Boost:将下载的Boost源代码解压到你选择的目录中。 3. 打开命令提示符:在Windows上,按下Win + R键,输入"cmd"并按下Enter键,打开命令提示符。 4. 进入Boost目录:使用cd命令进入你解压Boost源代码的目录。 5. 运行bootstrap.bat:在命令提示符中运行bootstrap.bat脚本文件,它将为你的系统配置编译环境。 6. 编译Boost:运行b2命令来编译Boost。你可以使用一些选项来指定编译器和其他参数。例如,如果你想使用MinGW编译器,可以运行以下命令: ``` b2 toolset=gcc ``` 7. 安装Boost编译完成后,运行b2 install命令来安装Boost。这将把编译好的文件复制到指定的目录中。 8. 配置Qt项目:在Qt项目中使用Boost时,你需要在项目文件(.pro文件)中添加相应的配置。例如,如果你想使用Boost的某个模块,可以在.pro文件中添加以下行: ``` LIBS += -lboost_module INCLUDEPATH += /path/to/boost ``` 以上是编译Boost并与Qt和MinGW一起使用的基本步骤。具体的配置和使用方法可能因你的项目需求和环境而有所不同。如果遇到问题,可以参考Boost官方文档或在相关社区寻求帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值