是否有适用于VS2008的64位Boost库版本?或者我必须自己编译一个?如果是,则有人有经验吗?
是否有适用于VS2008的64位Boost库版本?或者我必须自己编译一个?如果是,则有人有经验吗?
简短回答:
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete
作为更长的答案,以下是我关于在同一目录结构中拥有 VS .NET 2008 32 位和 64 位 Boost 库的构建笔记(我认为这是一个常见的用例):
构建 win32 二进制文件
bjam --toolset=msvc-9.0 --build-type=complete stage
创建目录lib\win32
构建x64二进制文件
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
创建目录 lib\x64
我在我的网站上有编译好的二进制文件: http://boost.teeks99.com
编辑 2013-05-13:从1.53版本开始,我的构建版本直接可以从sourceforge页面获得。
更新(2017年9月19日):添加了VS2017的脚本行。请注意,Boost从某个版本开始支持VS2017编译器。我使用了最新版本(1.65.1)。
我使用这些脚本为x64和x86平台构建Boost,包括VS2017、VS2015和VS2013的lib和dll,debug和release版本:
md stage\VS2017\x64
md stage\VS2015\x64
md stage\VS2013\x64
b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release
md stage\VS2017\win32
md stage\VS2015\win32
md stage\VS2013\win32
b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release
pause
你可以制作一个 .bat
文件并运行它来构建你的 Boost 二进制文件。
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64
然后进入 boost 目录:
bootstrap.bat
b2 -a -sBZIP2_SOURCE="C:\bzip2-1.0.6" -sZLIB_SOURCE="C:\zlib-1.2.5" --toolset=msvc-10.0 architecture=x86 address-model=64 link=static --with-date_time --with-filesystem --with-serialization --with-test --with-thread --with-system --with-regex --with-iostreams stage
最后一个命令是根据我所需进行的定制(只需要一些静态链接库)。
我写了一个小脚本,用于将它们编译为VS2005和VS2008:
md stage\lib\win32
md stage\lib\x64
REM Visual Studio 2005
bjam --toolset=msvc-8.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\
bjam --toolset=msvc-8.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\
REM Visual Studio 2008
bjam --toolset=msvc-9.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\