boost编译 Win10+VS2015

本文详细介绍了如何在VS2015 x64环境下编译Boost库,包括配置参数、生成模式、链接类型等关键信息,并提供了具体示例,帮助读者理解和掌握Boost库的编译流程。

VS2015 x64 本机工具命令提示符,以管理员身份运行

::compile_boost.bat
cd C:/caffe_draft/thirdparty/boost_1_68_0
::dir
::bjam --show-libraries


goto begin

(1)默认是32位库 address-model=64,生成64位库

(2)默认所有libraries全部编译,但是加上--with-XXX后,只编译XXX

(3)stage表示只生成库,install还会生成包含头文件的include目录。默认是stage模式,install模式会在拷贝文件上耗费大量时间
	一般刚开始编译都要修改几次参数,所以刚开始不建议使用install模式
	stage --stagedir=""
	install --prefix=""

(4)编译时不指定debug和release,会同时生成debug和release版本

(5)默认link=static runtime-link=shared

(6)默认是多线程库threading=multi

(7)msvc和python的版本和路径在project-config.jam中指定,一定要注意.jam文件书写格式,空格不能省略

(8)一个参考编译指令
b2 install --prefix="C:/caffe_draft/thirdparty/boost_1_68_0/build/x64/Debug" --toolset=msvc-14.0 address-model=64 --with-python link=static runtime-link=static threading=multi debug

b2 address-model=64 --with-python


:begin
b2 install --prefix="C:/caffe_draft/thirdparty/boost_1_68_0/build/x64"  address-model=64 --with-python threading=multi --with-thread  --with-date_time

goto end
libboost_python36-vc140-mt-sgd-x64-1_68.lib
| ||   | |      | |   | || ||| | | |  |
 -  ---   ------   ---  -- - -  -   --
1   2       3      4    5 6 7  8    9

link=static runtime-link=shared 
静态库以 lib 开头,动态库开头没有 lib。
所有的库都含有 boost 前缀。
Boost 库名称,本例中为 python36。
vc140 指的是 msvc-14.0,对应 Visual Studio 2015。
有 mt 代表 threading=multi,没有则代表 threading=single, 但实际验证是都带有mt
有 s 代表 runtime-link=static,没有则代表 runtime-link=shared。
有 gd 代表 debug 版本,没有则代表 release 版本。 
x32 代表 32 位,x64 代表 64 位。
Boost 1.68 版本。
:end

 

 

#project-config.jiam

import option ; 

using msvc : 14.0 : "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl" ; 

using python
    : 3.6
    : "C:/caffe_draft/thirdparty/Python-3.6.8/Python-3.6.8/PCbuild/amd64/python.exe"
    : "C:/caffe_draft/thirdparty/Python-3.6.8/Python-3.6.8/Include"
    : "C:/caffe_draft/thirdparty/Python-3.6.8/Python-3.6.8/PCbuild/amd64"
    : <define>BOOST_ALL_NO_LIB=1
    ;


option.set keep-going : false ; 
 

fatal error C1083: 无法打开包括文件: “pyconfig.h”: No such file or directory

把C:/caffe_draft/thirdparty/Python-3.6.8/Python-3.6.8/pyconfig.h 复制到 C:/caffe_draft/thirdparty/Python-3.6.8/Python-3.6.8/Include

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值