现在的位置: 首页 > 综合 > 正文

boost编译

2013年09月18日 ⁄ 综合 ⁄ 共 4716字 ⁄ 字号 评论关闭

注:只有十来个库需要编译,其余的只需要头文件即可使用

 

1. 下载

http://www.boost.org/users/download/下载boost库和jam(自己编译也可)

2. 编译库

常用编译示例:bjam stage --toolset=msvc-8.0 --without-python --stagedir="D:/zzsoft/boost_1_43_0/libboost/vc8" link=static runtime-link=static threading=multi release 

编译模式:stage(只生成库) 环境vc8 系统没装python 其它库都编译 stagedir:编译后的库所在目录 boost和c++都动态链接 多线程版本 release版本

 

4. 使用

把include和lib文件夹包含到查找文件夹中

 

详细使用说明推荐看这里:http://www.pin5i.com/showtopic-24150.html

 

--------------------------------------

另一示例

 

bjam.exe --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread toolset=msvc-9.0 variant=release link=static threading=multi stage

--------------------------------------

bjam 命令说明 

Boost.Build V2 (Milestone 12) 
Boost.Jam 03.1.16 

Project-specific help: 

  Project has jamfile at Jamroot 

Usage: 

  bjam [options] [properties] [install|stage] 

  Builds and installs Boost. 

Targets and Related Options: 

  install                 Install headers and compiled library files to the 
  =======                 configured locations (below). 

  --prefix=<PREFIX>       Install architecture independent files here. 
                          Default; C:/Boost on Win32 
                          Default; /usr/local on Unix. Linux, etc. 

  --exec-prefix=<EPREFIX> Install architecture dependent files here. 
                          Default; <PREFIX> 

  --libdir=<DIR>          Install library files here. 
                          Default; <EPREFIX>/lib 

  --includedir=<HDRDIR>   Install header files here. 
                          Default; <PREFIX>/include 

  stage                   Build and install only compiled library files 
  =====                   to the stage directory. 

  --stagedir=<STAGEDIR>   Install library files here 
                          Default; ./stage 

Other Options: 

  --build-type=<type>     Build the specified pre-defined set of variations 
                          of the libraries. Note, that which variants get 
                          built depends on what each library supports. 

                              minimal (default) - Builds the single 
                              "release" version of the libraries. This 
                              release corresponds to specifying: 
                              "release <threading>multi <link>shared 
                              <link>static <runtime-link>shared" as the 
                              Boost.Build variant to build. 

                              complete - Attempts to build all possible 
                              variations. 

  --build-dir=DIR         Build in this location instead of building 
                          within the distribution tree. Recommended! 

  --show-libraries        Displays the list of Boost libraries that require 
                          build and installation steps, then exit. 

  --layout=<layout>       Determines whether to choose library names 
                          and header locations such that multiple 
                          versions of Boost or multiple compilers can 
                          be used on the same system. 

                              versioned (default) - Names of boost 
                              binaries include the Boost version 
                              number and the name and version of the 
                              compiler.  Boost headers are installed 
                              in a subdirectory of <HDRDIR> whose 
                              name contains the Boost version 
                              number. 

                              system - Binaries names do not include 
                              the Boost version number or the name 
                              and version number of the compiler. 
                              Boost headers are installed directly 
                              into <HDRDIR>.  This option is 
                              intended for system integrators who 
                              are building distribution packages. 

  --buildid=ID            Adds the specified ID to the name of built 
                          libraries.  The default is to not add anything. 

  --help                  This message. 

  --with-<library>        Build and install the specified <library> 
                          If this option is used, only libraries 
                          specified using this option will be built. 

  --without-<library>     Do not build, stage, or install the specified 
                          <library>. By default, all libraries are built. 

Properties: 

  toolset=toolset         Indicates the toolset to build with. 

  variant=debug|release   Select the build variant 

  link=static|shared      Whether to build static or shared libraries 

  threading=single|multi  Whether to build single or multithreaded binaries 

  runtime-link=static|shared     
                          Whether to link to static or shared C and C++ runtime. 

 

----------------------======================-------------------------------

linux:适用1.45 ,详见 INSTALL

down boost

进boost文件夹

./bootstrap.sh

sudo ./bjam install     // linux下很快,不用担心编译要几个小时,只需要二十分钟左右吧

测试例子

 

抱歉!评论已关闭.