BOOST

来自bbxwiki
跳转至: 导航搜索

Windows下编译安装

  • 生成bjam
  • 编译不同编译器,不同位数的版本.
SET OPS_BOOST_LIBS=--with-date_time --with-program_options --with-filesystem --with-system --with-thread --with-regex --with-serialization --with-signals
SET OPS_COMM=link=static runtime-link=static threading=multi
:compile
bjam toolset=msvc-8.0 %OPS_COMM% %OPS_BOOST_LIBS% stage
bjam toolset=msvc-9.0 %OPS_COMM% %OPS_BOOST_LIBS% stage
bjam toolset=msvc-8.0 address-model=64 --stagedir=x64 %OPS_COMM% %OPS_BOOST_LIBS% stage
bjam toolset=msvc-9.0 address-model=64 --stagedir=x64 %OPS_COMM% %OPS_BOOST_LIBS% stage
SET OPS_BOOST_LIBS=--with-date_time --with-program_options --with-filesystem --with-system --with-thread --with-regex --with-serialization --with-signals --with-python
SET OPS_COMM=link=static runtime-link=static threading=multi

::16:37 2013/7/21
::10:08 2013/11/3
pushd boost_1_54_0
call :run
popd
goto :eof

:run
b2 toolset=msvc-8.0 %OPS_COMM% %OPS_BOOST_LIBS% stage
b2 toolset=msvc-9.0 %OPS_COMM% %OPS_BOOST_LIBS% stage
b2 toolset=msvc-10.0 %OPS_COMM% %OPS_BOOST_LIBS% stage
b2 toolset=msvc-8.0 address-model=64 --stagedir=x64 %OPS_COMM% %OPS_BOOST_LIBS% stage
b2 toolset=msvc-9.0 address-model=64 --stagedir=x64 %OPS_COMM% %OPS_BOOST_LIBS% stage
b2 toolset=msvc-10.0 address-model=64 --stagedir=x64 %OPS_COMM% %OPS_BOOST_LIBS% stage
goto :eof

Linux下编译安装

  • 生成bjam
    • ./bootstrap.sh
  • 编译静态.a -fPIC
    • ./bjam cxxflags=-fPIC link=static --prefix=/usr --without-python --without-graph_parallel --without-graph --without-wave stage
  • 编译动态.so -fPIC
    • ./bjam cxxflags=-fPIC --prefix=/usr --without-python --without-graph_parallel --without-graph --without-wave stage


property_tree使用

  • 多线程安全
#define BOOST_SPIRIT_THREADSAFE
#include "boost/regex.hpp"
#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/json_parser.hpp"