boost编译
boost1.7 静态链接编译方法
bjam stage --toolset=msvc-14.1 --stagedir="stage\vc15x86" address-model=32 link=static runtime-link=static threading=multi debug release
bjam stage --toolset=msvc-14.1 --stagedir="stage\vc15x64" address-model=64 link=static runtime-link=static threading=multi debug release
b2 stage --toolset=msvc-14.1 --stagedir="stage\vc15x86" address-model=32 link=static runtime-link=static threading=multi debug release
b2 stage --toolset=msvc-14.1 --stagedir="stage\vc15x64" address-model=64 link=static runtime-link=static threading=multi debug release
32位
//编译atomic
b2 --stagedir=./vc2010/win32 toolset=msvc-10.0 --with-atomic
//编译所有
b2 --stagedir=./vc2012/win32 toolset=msvc-11.0 --build-type=complete
64位
//编译atomic
bjam --stagedir=./vc2010/x64 toolset=msvc-10.0 address-model=64 --with-atomic
//编译所有
bjam --stagedir=./vc2012/x64 toolset=msvc-11.0 address-model=64 --build-type=complete
build-all.bat
b2 --stagedir=./vc2010/win32 toolset=msvc-10.0
b2 --stagedir=./vc2012/win32 toolset=msvc-11.0
bjam --stagedir=./vc2010/x64 toolset=msvc-10.0 address-model=64
bjam --stagedir=./vc2012/x64 toolset=msvc-11.0 address-model=64
//编译boost1.62静态库
bjam stage --toolset=msvc-10.0 --stagedir="C:\MinGW\boost_1_62_0" link=static runtime-link=static threading=multi debug release
//32位编译1.5.7
bjam link=static runtime-link=static
rem bjam link=static runtime-link=static address-model=64
rem bjam --build-type=complete toolset=msvc-9.0 threading=multi link=static runtime-link=static address-model=64
//64位编译1.5.7
bjam link=static runtime-link=static address-model=64
rem bjam --build-type=complete toolset=msvc-9.0 threading=multi link=static runtime-link=static address-model=64
rem 编译64位boost
rem 一直以来都是在Win32环境下Build和使用boost,但现在基本上每天都在64位Win7下工作,
rem 所以很有必要把这几天的经验总结下来。和32位环境不同,
rem x64环境下编译得先从开始菜单启动Visual Studio的Visual Studio 2008 x64 Win64 Command Prompt进入命令提示符,
rem 而不是随便打开任意一个命令行窗口就行。然后转到boost根文件夹,运行bootstrap.bat生成x64版的bjam.exe。然后运行命令:
rem bjam --build-type=complete toolset=msvc-9.0 threading=multi link=shared address-model=64
rem 即可生成DLL版平台库,如果要编译静态库版就把shared改为static。
rem 只生成一个库的话加上例如--with-python得编译选项,避免生成东西太多、时间太长。
rem 要有address-model=64属性,如果没有这个属性的话,会默认生成32位的平台库,加入这个选项才能生成64位的DLL。
rem 如果要生成Boost.Python库,需要先下载安装x64版的Python安装包,我用的版本是3.2.3。
rem 在使用这个库编写Python扩展DLL时,默认是使用动态库版的Boost.Python,要使用静态版的必须
rem 在C++项目中定义BOOST_PYTHON_STATIC_LIB宏,这样就不用在使用或发布扩展时带着boost_python-vc90-mt-1_50.dll一起了,
rem 当然扩展DLL的尺寸会大些,如果做实验没必要这样,编译又慢生成的文件也大。
rem vs工具链版本:vs2003 : msvc-7.1,vs2005 : msvc-8.0,vs2008 : msvc-9.0,vs2010 : msvc-10.0
//-----------------------------------------------------------------------------------
//下面是通用编译脚本
@echo off
cls
title boost编译中... 阿甘制作
@COLOR E2
REM 编译器版本号处理
@set VCID=12
@set /p VCID=VC版本填写?(10:VC2010/12:VC2013[默认]等等):
REM 处理运行库
@set VCKILL=1
@set /p VCKILL=如何编译操作?(1.独立静态库(默认),2.依赖msvc库):
@if %VCKILL%==1 ( set BOOSTSTATIC=static )
@if %VCKILL%==2 ( set BOOSTSTATIC=shared )
REM 处理平台
@set VCX64=1
@set /p VCX64=如何编译平台?(1.X86(默认),2.X64):
@if %VCX64%==1 ( Goto BOOSTX86 )
@if %VCX64%==2 ( Goto BOOSTX64 )
:BOOSTX86
bjam stage --toolset=msvc-%VCID%.0 --stagedir="stage\vc%VCID%" link=static runtime-link=%BOOSTSTATIC% threading=multi debug release
Goto END
:BOOSTX64
bjam stage --toolset=msvc-%VCID%.0 --stagedir="stage\vc%VCID%x64" address-model=64 link=static runtime-link=%BOOSTSTATIC% threading=multi debug release
Goto END
REM 清理文件
:END
rd bin.v2\ /s /q
cls
EXIT
//-----------------------------------------------------------------------------------
设置环境变量
BOOST_ROOT = C:\Boost
cmake就能找到boost
4.thread库无法解析外部符号void __cdecl boost::tss_cleanup_implemented(void) 问题
#define BOOST_HAS_WINTHREADS
#define BOOST_THREAD_BUILD_DLL
定义这两个宏