How to build the Boost C++ library for different targets.
This is an example of building Boost 1.55 for Visual Studio 2017 (toolset v141)
- Run bootstrap.bat
- Edit project-config.jam
- Call b2.exe with the correct parameters
- Run bootstrap.bat
This should create the b2.exe executable that is the build manager for the Boost library.
2. Edit project-config.jam
Visual studio 2017 is MSVC 15 (https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd)
import option ;
using msvc : 14 : "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe";
option.set keep-going : false ;
3. Call b2.exe with the correct parameters
Documentation for the B2 tool can be found here: https://boostorg.github.io/build/manual/master/index.html
The toolset is 14.1 (v141). And we want the libraries for x64.
> b2 toolset=msvc-14.1 address-model=64
We want static libraries (not dll):
> b2 toolset=msvc-14.1 address-model=64 link=static
We can specify to build Release or Debug versions:
> b2 toolset=msvc-14.1 address-model=64 link=static variant=release
With different build, it can be usefull to direct all output (created libraries) to a specific folder:
> b2 toolset=msvc-14.1 address-model=64 link=static variant=release --build-dir=.Output-x64-static-release
Leave a comment