Windows上编译Boost

Boost做得很好,有自己的build系统,可以几乎一键式编译,这才是尼玛世界一流质量的良心开源库啊。

将Boost 1.49.0解压到boost/boost_1_49_0里面,然后在boost目录底下创建以下bat脚本:

@echo off

cd boost_1_49_0

:: build
call bootstrap.bat
bjam -j4 variant=release link=static runtime-link=static threading=multi --with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time --with-wave stage
bjam -j4 variant=debug link=static runtime-link=static threading=multi --with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time --with-wave stage

:: copy files
mkdir ..\elvic\lib
mkdir ..\elvic\include\boost
xcopy /E /Y stage\lib ..\elvic\lib
xcopy /E /Y boost ..\elvic\include\boost

cd..

用Visual Studio 2008命令行运行这个脚本就会把32位的Debug和Release都生成到boost/elvic目录底下了。

如果要编译64位的build请使用以下脚本:

@echo off

cd boost_1_49_0

:: build
call bootstrap.bat
bjam -j4 architecture=x86 address-model=64 variant=release link=static runtime-link=static threading=multi --with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time stage --with-wave
bjam -j4 architecture=x86 address-model=64 variant=debug link=static runtime-link=static threading=multi --with-filesystem --with-locale --with-thread --with-regex --with-system --with-date_time stage --with-wave

:: copy files
mkdir ..\elvic64\lib
mkdir ..\elvic64\include\boost
xcopy /E /Y stage\lib ..\elvic64\lib
xcopy /E /Y boost ..\elvic64\include\boost

cd..

-j4是指定使用4个进程来编译。

上一篇:多态性Polymorphism


下一篇:Xdebug在PHP中的安装配置