Easily build the boost library on last VS release, no pain
Windows batch script to build the boost library. Builds boost with all runtime link types for both 32 and 64 bit architectures.
- Tested with boost 1.63.0 (build_boost_1_63_0_vs2017_win32_x64.bat)
- Tested with 1.64.0 beta 2 (build_boost_1_64_0_b2_vs2017_win32_x64.bat)
-
Copy the .bat file inside boost's directory (eg C:\boost_1_63_0).
-
Using Visual Studio 2017's Developer Command Prompt (found in "Windows' Start"\All Programs\Visual Studio 2017\Visual Studio Tools), go to the boost root directory (eg. C:\boost_1_63_0) and call-execute to bat provided in this repo build_boost_1_63_0_vs2017_win32_x64.bat.
Note: Go for 2 Coffees... the process takes a long time. It will output the .DLLs and .LIBs up one level from the current path (eg. d:\sdk\bin...) at "bin\x86" (for 32 bit) and "bin\x64" (for 64 bit).
cd A:\sources\libs\boost_1_64_0
build_boost_1_64_0_b2_vs2017_win32_x64.bat
-
Add headers
-
Go to Solution Explorer -> Properties -> C/C++ -> General
-
Pick & Set on "Additional Include Directories" = BOOST_ROOT (eg. C:\boost_1_64_0)
-
Properties -> C/C++ -> General -> Precompiled Header
-
Pick & Set on "Precompiled Header" to option Not Using Precompiled Headers
-
-
Add compiled libraries
- Go to Solution Explorer -> Properties -> Linker -> General
- Pick & Set on "Additional Library Directories" = BOOST_ROOT\lib (eg. C:\boost_1_64_0\stage_x86\lib)
- bootstrap
- b2 toolset=msvc-14.1 threading=multi link=static runtime-link=shared runtime-link=static variant=release variant=debug
vs2019
- bootstrap
- build: 32 and 64: b2 release debug threading=multi --build-type=complete --toolset=msvc stage 32 only : b2 release debug threading=multi --build-type=complete --toolset=msvc address-model=32 stage 64 only : b2 release debug threading=multi --build-type=complete --toolset=msvc address-model=64 stage
-- for ref only
- START > Visual Studio 2019 > x64 Native Tools Command Prompt
- cd D:\boost.win
- .\bootstrap.bat
- Edit generated project-config.jam and replace
using msvc ; with using msvc : 14.1 : "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.20.27323\bin\HostX64\x64\cl.exe" ;
- Before you fire b2, you can remove -nologo from this line in D:\boost.win\tools\build\src\tools\msvc.jam
- Finally, run b2
.\b2 variant=debug address-model=64 --with-filesystem --with-test --layout=system
... compile-c-c++ bin.v2\libs\filesystem\build\msvc-14.1\debug\address-model-64\link-static\threading-multi\codecvt_error_category.obj Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27323 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
cl "libs\filesystem\src\codecvt_error_category.cpp" -Fo"bin.v2\libs\filesystem\build\msvc-14.1\debug\address-model-64\link-static\threading-multi\codecvt_error_category.obj" -TP /Z7 /Od /Ob0 /W3 /GR /MDd /Zc:forScope /Zc:wchar_t /favor:blend /wd4675 /EHs -c -DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 "-I."
and you should see the CL 19.20.27323 from VS2019 is actually used, that is:
D:\boost.win>cl /? | findstr optimized Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27323 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
bootstrap b2 -a --prefix=boostbuild --build-type=complete toolset=msvc-14.2 address-model=32 --with-filesystem --with-test --with-thread link=static link=shared install 142: b2 -a --prefix=boostbuild --build-type=complete toolset=msvc-14.2 address-model=32 install 143: b2 -a --prefix=boostbuild --build-type=complete address-model=32 install