Boost编译选项备忘


初始化Boost

进入boost所在的目录,执行下面的命令初始化boost

# Windows
./bootstrap.bat

# Linux
./bootstrap.sh

编译使用C++静态CRT的64位Boost静态库

Windows

./b2.exe --prefix=./install64_staticlib_staticrt --stagedir=./stage64_staticlib_staticrt --build-dir=./build64_staticlib_staticrt --build-type=complete --layout=versioned --buildid=amd64 --without-mpi --without-graph --without-graph_parallel --without-python address-model=64 variant=debug,release threading=multi link=static runtime-link=static -a -q -j16 install

生成的文件列表如下:

libboost_atomic-vc140-mt-s-1_59-amd64.lib
libboost_atomic-vc140-mt-sgd-1_59-amd64.lib
libboost_chrono-vc140-mt-s-1_59-amd64.lib
libboost_chrono-vc140-mt-sgd-1_59-amd64.lib
libboost_container-vc140-mt-s-1_59-amd64.lib
libboost_container-vc140-mt-sgd-1_59-amd64.lib
libboost_context-vc140-mt-s-1_59-amd64.lib
libboost_context-vc140-mt-sgd-1_59-amd64.lib
libboost_coroutine-vc140-mt-s-1_59-amd64.lib
libboost_coroutine-vc140-mt-sgd-1_59-amd64.lib
libboost_date_time-vc140-mt-s-1_59-amd64.lib
libboost_date_time-vc140-mt-sgd-1_59-amd64.lib
libboost_exception-vc140-mt-s-1_59-amd64.lib
libboost_exception-vc140-mt-sgd-1_59-amd64.lib
libboost_filesystem-vc140-mt-s-1_59-amd64.lib
libboost_filesystem-vc140-mt-sgd-1_59-amd64.lib
libboost_iostreams-vc140-mt-s-1_59-amd64.lib
libboost_iostreams-vc140-mt-sgd-1_59-amd64.lib
libboost_locale-vc140-mt-s-1_59-amd64.lib
libboost_locale-vc140-mt-sgd-1_59-amd64.lib
libboost_log-vc140-mt-s-1_59-amd64.lib
libboost_log-vc140-mt-sgd-1_59-amd64.lib
libboost_log_setup-vc140-mt-s-1_59-amd64.lib
libboost_log_setup-vc140-mt-sgd-1_59-amd64.lib
libboost_math_c99-vc140-mt-s-1_59-amd64.lib
libboost_math_c99-vc140-mt-sgd-1_59-amd64.lib
libboost_math_c99f-vc140-mt-s-1_59-amd64.lib
libboost_math_c99f-vc140-mt-sgd-1_59-amd64.lib
libboost_math_c99l-vc140-mt-s-1_59-amd64.lib
libboost_math_c99l-vc140-mt-sgd-1_59-amd64.lib
libboost_math_tr1-vc140-mt-s-1_59-amd64.lib
libboost_math_tr1-vc140-mt-sgd-1_59-amd64.lib
libboost_math_tr1f-vc140-mt-s-1_59-amd64.lib
libboost_math_tr1f-vc140-mt-sgd-1_59-amd64.lib
libboost_math_tr1l-vc140-mt-s-1_59-amd64.lib
libboost_math_tr1l-vc140-mt-sgd-1_59-amd64.lib
libboost_prg_exec_monitor-vc140-mt-s-1_59-amd64.lib
libboost_prg_exec_monitor-vc140-mt-sgd-1_59-amd64.lib
libboost_program_options-vc140-mt-s-1_59-amd64.lib
libboost_program_options-vc140-mt-sgd-1_59-amd64.lib
libboost_random-vc140-mt-s-1_59-amd64.lib
libboost_random-vc140-mt-sgd-1_59-amd64.lib
libboost_regex-vc140-mt-s-1_59-amd64.lib
libboost_regex-vc140-mt-sgd-1_59-amd64.lib
libboost_serialization-vc140-mt-s-1_59-amd64.lib
libboost_serialization-vc140-mt-sgd-1_59-amd64.lib
libboost_signals-vc140-mt-s-1_59-amd64.lib
libboost_signals-vc140-mt-sgd-1_59-amd64.lib
libboost_system-vc140-mt-s-1_59-amd64.lib
libboost_system-vc140-mt-sgd-1_59-amd64.lib
libboost_test_exec_monitor-vc140-mt-s-1_59-amd64.lib
libboost_test_exec_monitor-vc140-mt-sgd-1_59-amd64.lib
libboost_thread-vc140-mt-s-1_59-amd64.lib
libboost_thread-vc140-mt-sgd-1_59-amd64.lib
libboost_timer-vc140-mt-s-1_59-amd64.lib
libboost_timer-vc140-mt-sgd-1_59-amd64.lib
libboost_unit_test_framework-vc140-mt-s-1_59-amd64.lib
libboost_unit_test_framework-vc140-mt-sgd-1_59-amd64.lib
libboost_wave-vc140-mt-s-1_59-amd64.lib
libboost_wave-vc140-mt-sgd-1_59-amd64.lib
libboost_wserialization-vc140-mt-s-1_59-amd64.lib
libboost_wserialization-vc140-mt-sgd-1_59-amd64.lib

Linux

./b2 --prefix=./install64_staticlib_staticrt --stagedir=./stage64_staticlib_staticrt --build-dir=./build64_staticlib_staticrt --build-type=complete --layout=versioned --buildid=amd64 --without-mpi --without-graph --without-graph_parallel --without-python cxxflags=-fPIC cflags=-fPIC address-model=64 variant=debug,release threading=multi link=static runtime-link=static -a -q -j6 install

生成的文件列表如下:

libboost_atomic-gcc49-mt-s-1_59-amd64.a
libboost_atomic-gcc49-mt-sd-1_59-amd64.a
libboost_chrono-gcc49-mt-s-1_59-amd64.a
libboost_chrono-gcc49-mt-sd-1_59-amd64.a
libboost_container-gcc49-mt-s-1_59-amd64.a
libboost_container-gcc49-mt-sd-1_59-amd64.a
libboost_context-gcc49-mt-s-1_59-amd64.a
libboost_context-gcc49-mt-sd-1_59-amd64.a
libboost_coroutine-gcc49-mt-s-1_59-amd64.a
libboost_coroutine-gcc49-mt-sd-1_59-amd64.a
libboost_date_time-gcc49-mt-s-1_59-amd64.a
libboost_date_time-gcc49-mt-sd-1_59-amd64.a
libboost_exception-gcc49-mt-s-1_59-amd64.a
libboost_exception-gcc49-mt-sd-1_59-amd64.a
libboost_filesystem-gcc49-mt-s-1_59-amd64.a
libboost_filesystem-gcc49-mt-sd-1_59-amd64.a
libboost_iostreams-gcc49-mt-s-1_59-amd64.a
libboost_iostreams-gcc49-mt-sd-1_59-amd64.a
libboost_locale-gcc49-mt-s-1_59-amd64.a
libboost_locale-gcc49-mt-sd-1_59-amd64.a
libboost_log-gcc49-mt-s-1_59-amd64.a
libboost_log-gcc49-mt-sd-1_59-amd64.a
libboost_log_setup-gcc49-mt-s-1_59-amd64.a
libboost_log_setup-gcc49-mt-sd-1_59-amd64.a
libboost_math_c99f-gcc49-mt-s-1_59-amd64.a
libboost_math_c99f-gcc49-mt-sd-1_59-amd64.a
libboost_math_c99-gcc49-mt-s-1_59-amd64.a
libboost_math_c99-gcc49-mt-sd-1_59-amd64.a
libboost_math_c99l-gcc49-mt-s-1_59-amd64.a
libboost_math_c99l-gcc49-mt-sd-1_59-amd64.a
libboost_math_tr1f-gcc49-mt-s-1_59-amd64.a
libboost_math_tr1f-gcc49-mt-sd-1_59-amd64.a
libboost_math_tr1-gcc49-mt-s-1_59-amd64.a
libboost_math_tr1-gcc49-mt-sd-1_59-amd64.a
libboost_math_tr1l-gcc49-mt-s-1_59-amd64.a
libboost_math_tr1l-gcc49-mt-sd-1_59-amd64.a
libboost_prg_exec_monitor-gcc49-mt-s-1_59-amd64.a
libboost_prg_exec_monitor-gcc49-mt-sd-1_59-amd64.a
libboost_program_options-gcc49-mt-s-1_59-amd64.a
libboost_program_options-gcc49-mt-sd-1_59-amd64.a
libboost_random-gcc49-mt-s-1_59-amd64.a
libboost_random-gcc49-mt-sd-1_59-amd64.a
libboost_regex-gcc49-mt-s-1_59-amd64.a
libboost_regex-gcc49-mt-sd-1_59-amd64.a
libboost_serialization-gcc49-mt-s-1_59-amd64.a
libboost_serialization-gcc49-mt-sd-1_59-amd64.a
libboost_signals-gcc49-mt-s-1_59-amd64.a
libboost_signals-gcc49-mt-sd-1_59-amd64.a
libboost_system-gcc49-mt-s-1_59-amd64.a
libboost_system-gcc49-mt-sd-1_59-amd64.a
libboost_test_exec_monitor-gcc49-mt-s-1_59-amd64.a
libboost_test_exec_monitor-gcc49-mt-sd-1_59-amd64.a
libboost_thread-gcc49-mt-s-1_59-amd64.a
libboost_thread-gcc49-mt-sd-1_59-amd64.a
libboost_timer-gcc49-mt-s-1_59-amd64.a
libboost_timer-gcc49-mt-sd-1_59-amd64.a
libboost_unit_test_framework-gcc49-mt-s-1_59-amd64.a
libboost_unit_test_framework-gcc49-mt-sd-1_59-amd64.a
libboost_wave-gcc49-mt-s-1_59-amd64.a
libboost_wave-gcc49-mt-sd-1_59-amd64.a
libboost_wserialization-gcc49-mt-s-1_59-amd64.a
libboost_wserialization-gcc49-mt-sd-1_59-amd64.a

修改boost的头文件

把下面的内容加到文件install64_staticlib_staticrt/include/boost-1_59/boost/config的最后:

#define BOOST_LIB_BUILDID amd64

文章作者: Kiba Amor
版权声明: 本博客所有文章除特別声明外,均采用 CC BY-NC-ND 4.0 许可协议。转载请注明来源 Kiba Amor !
  目录