您的位置:首页 > 其它

编译boost

2015-08-05 16:01 239 查看
原文出处: /article/1432915.html
写在最前:老版本的boost编译可以参考以下:(其实boost的所有版本编译都差不多)Boost_1_46_1编译: /article/1359130.htmlBoost_1_47_0编译: /article/1359129.htmlBoost_1_48_0编译: /article/1359128.htmlBoost_1_49_0编译: http://blog.csdn.net/great3779/article/details/7310392Boost_1_52_0编译:/article/1432922.html Boost社区早在2013年2月4日即发布了boost_1_53_0,由于最近工作上比较忙,因此直到今天才有空将此最新版本的boost编译指南放上来。原来的编译脚本在1_53_0上是完全兼容的,同样能自动将boost编译成vs2008、vs2010的32位及64位版本(注:编译之前须确保电脑已经安装了vs2008/vs2010)。过程复述如下:1. 至http://sourceforge.net/projects/boost/files/boost/1.53.0/下载boost_1_53_0.7z。(说点题外话,.7z是7zip下的一种通用压缩格式,具有比.rar和.zip更优秀的性能,并且还是开源的(可获取到所有源代码!),最近我也正在研读其源代码,其实现的string-like类(CStringBase)以及vector-like类(CBaseRecordVector)具有和STL相似的功能,且可读性更好。网址为 http://www.7-zip.org/ )2. 解压至D:\boost_1_53_0\(当然也可以是其他文件夹,仅作示例。)3. 将批处理文件放在D:\boost_1_53_0\下。批处理文件可至http://download.csdn.net/detail/great3779/4104039免费下载。(也即附在最后的脚本)(如图)4. 接下来,你只需要启动批处理,然后端一杯咖啡,等待脚本为你做完一切。完成后的效果如下图:5. 最后,去设置你的编译器,开始使用最新版的boost吧。(注:boost头文件位置:D:\boost_1_53_0\boost,静态lib文件目录:D:\boost_1_53_0\stage\lib)

[plain] view plaincopyprint?




rem 创建者:黄志丹 great3779@sina.com 20130403

rem @echo off

rem 先编译bjam

start bootstrap.bat

rem 等待一分钟待bjam编译完成(如果电脑性能过差,可以设置等待时间更长一些)

SET SLEEP=ping 127.0.0.1 -n

%SLEEP% 60 > nul

rem 利用bjam编译boost库

rem 在此,我们编译vs2008和vs2010下的x86及x64共4类boost库文件

rem 建立库文件夹

rem vs2008 win32库文件夹

md stage\lib\win32\vs9_0\

rem vs2008 x64库文件夹

md stage\lib\x64\vs9_0\

rem vs2010 win32库文件夹

md stage\lib\win32\vs10_0\

rem vs2010 x64库文件夹

md stage\lib\x64\vs10_0\

rem ******************************************************************

rem 先删除lib下所有文件(不删除文件夹)

del stage\lib\*.* /Q

rem 编译vs2008 win32库文件

bjam --toolset=msvc-9.0 architecture=x86 --with-system --with-thread --with-date_time --with-filesystem --with-serialization

rem 拷贝至\stage\lib\win32\vs9_0

copy stage\lib\*.* stage\lib\win32\vs9_0\*.* /Y

rem ##################################################################

rem ******************************************************************

rem 先删除lib下所有文件(不删除文件夹)

del stage\lib\*.* /Q

rem 编译vs2008 x64库文件

bjam --toolset=msvc-9.0 architecture=x86 address-model=64 --with-system --with-thread --with-date_time --with-filesystem --with-serialization

rem 拷贝至\stage\lib\x64\vs9_0

copy stage\lib\*.* stage\lib\x64\vs9_0\*.* /Y

rem ##################################################################

rem ******************************************************************

rem 先删除lib下所有文件(不删除文件夹)

del stage\lib\*.* /Q

rem 编译vs2010 win32库文件

bjam --toolset=msvc-10.0 architecture=x86 --with-system --with-thread --with-date_time --with-filesystem --with-serialization

rem 拷贝至\stage\lib\win32\vs10_0

copy stage\lib\*.* stage\lib\win32\vs10_0\*.* /Y

rem ##################################################################

rem ******************************************************************

rem 先删除lib下所有文件(不删除文件夹)

del stage\lib\*.* /Q

rem 编译vs2010 x64库文件

bjam --toolset=msvc-10.0 architecture=x86 address-model=64 --with-system --with-thread --with-date_time --with-filesystem --with-serialization

rem 拷贝至\stage\lib\x64\vs10_0

copy stage\lib\*.* stage\lib\x64\vs10_0\*.* /Y

rem ##################################################################

rem 删除lib下所有文件(不删除文件夹)

del stage\lib\*.* /Q

--------------------------add------------------------------------------编译regex的命令为[plain] view plaincopyprint?




bjam --toolset=msvc-10.0 architecture=x86 --with-regex

编译静态连接的regexbjam --toolset=msvc-9.0 architecture=x86 --with-regex -link=static runtime-link=static debug release

http://jingyan.baidu.com/article/a3aad71aa1ebe7b1fb009681.html

// 如果要获取动态库:bjam install stage --toolset=msvc-12.0 --stagedir="C:\Boost\boost_vc_120" link=shared runtime-link=shared threading=multi debug release

// 如果是要获取静态库:

bjam install stage --toolset=msvc-12.0 --stagedir="C:\Boost\boost_vc_120" link=static runtime-link=static threading=multi debug release
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: