使用vs2015编译32位
REM 使用vs2015,如果vs2019将下面的vc14替换为vc142(特殊:--toolset=msvc-14.2 CALL bootstrap vc14 CALL b2 stage --build-dir=build/vc14_32 --toolset=msvc-14.0 address-model=32 --without-python --stagedir=vc14/32 link=static runtime-link=shared runtime-link=static threading=multi debug release -j 12使用vs2015编译64位
REM vs2015编译64位 如果vs2019下面的vc14替换为vc142(特殊:--toolset=msvc-14.2) CALL bootstrap vc14 CALL b2 stage --build-dir=build/vc14_64 --toolset=msvc-14.0 address-model=64 --without-python --stagedir=vc14/64 link=static runtime-link=shared runtime-link=static threading=multi debug release -j 12编译出的头文件:
$(BOOST_SOURCE_DIR)/boost
在设置工程头文件路径设置为$(BOOST_SOURCE_DIR)
这样在C++代码中可以使用
#include <boost/...>
编译出来的库简要说明(库在$(BOOST_SOURCE_DIR)/vc14下的32位和64位文件夹中)
b2.exe 参数解释:
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 a minimal set of variants. On Windows, these are static multithreaded libraries in debug and release modes, using shared runtime. On Linux, these are static and shared multithreaded libraries in release mode.
-- complete -- Build all possible variations.
--build-dir=DIR Build in this location instead of building within the distribution tree. Recommended!
--show-libraries Display the list of Boost libraries that require build and installation steps, and then exit.
--layout=<layout> Determine 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 -- Names of boost binaries include the Boost version number, name and version of the compiler and encoded build properties. Boost headers are installed in a subdirectory of <HDRDIR> whose name contains the Boost version number.
-- tagged -- Names of boost binaries include the encoded build properties such as variant and threading, but do not including compiler name and version, or Boost version. This option is useful if you build several variants of Boost, using the same compiler.
-- 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 building distribution packages.
The default value is 'versioned' on Windows, and 'system' on Unix.
--buildid=ID Add the specified ID to the name of built libraries. The default is to not add anything.
--python-buildid=ID Add the specified ID to the name of built libraries that depend on Python. The default is to not add anything. This ID is added in addition to --buildid.
--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 Indicate 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.
编译得到 库名字的明(来自官网https://www.boost.org/doc/libs/1_73_0/more/getting_started/unix-variants.html#library-naming):
In order to choose the right binary for your build configuration you need to know how Boost binaries are named. Each library filename is composed of a common sequence of elements that describe how it was built. For example,libboost_regex-vc71-mt-d-x86-1_34.lib can be broken down into the following elements:
lib
Prefix: except on Microsoft Windows, every Boost library name begins with this string. On Windows, only ordinary static libraries use the lib prefix; import libraries and DLLs do not.4
boost_regex
Library name: all boost library filenames begin with boost_.
-vc71
Toolset tag: identifies the toolset and version used to build the binary.
-mt
Threading tag: indicates that the library was built with multithreading support enabled. Libraries built without multithreading support can be identified by the absence of -mt.
-d
ABI tag: encodes details that affect the library's interoperability with other compiled code. For each such feature, a single letter is added to the tag:
KeyUse this library when:Boost.Build optionslinking statically to the C++ standard library and compiler runtime support libraries.runtime-link=staticgusing debug versions of the standard and runtime support libraries.runtime-debugging=onyusing a special debug build of Python.python-debugging=ondbuilding a debug version of your code.5variant=debugpusing the STLPort standard library rather than the default one supplied with your compiler.stdlib=stlportFor example, if you build a debug version of your code for use with debug versions of the static runtime library and the STLPort standard library, the tag would be: -sgdp. If none of the above apply, the ABI tag is ommitted.
-x86
Architecture and address model tag: in the first letter, encodes the architecture as follows:
KeyArchitectureBoost.Build optionxx86-32, x86-64architecture=x86aARMarchitecture=armiIA-64architecture=ia64sSparcarchitecture=sparcmMIPS/SGIarchitecture=mips*pRS/6000 & PowerPCarchitecture=powerThe two digits following the letter encode the address model as follows:
KeyAddress modelBoost.Build option3232 bitaddress-model=326464 bitaddress-model=64-1_34
Version tag: the full Boost release number, with periods replaced by underscores. For example, version 1.31.1 would be tagged as "-1_31_1".
.lib
Extension: determined according to the operating system's usual convention. On most unix-style platforms the extensions are .a and .so for static libraries (archives) and shared libraries, respectively. On Windows, .dll indicates a shared library and .lib indicates a static or import library. Where supported by toolsets on unix variants, a full version extension is added (e.g. ".so.1.34") and a symbolic link to the library file, named without the trailing version number, will also be created.