Recently I need specific boost binary for my code, so I compiled boost. That was my first time and this is short useful note about it.
1. Go to boost\tools\build\v2
2. Run bootstrap.bat
3. Run b2 b2 install –prefix=[directory to install boost.build]
4. Add prefix\bin to system environment
5. Go to boost directory and run b2 :
b2 –build-dir=[directory to put intermediate file] toolset=[see below] –build-type=complete stage threading=[sea below] link=[see below]
At step 5 you notice that there are some compile time configurations avalable like build-type, toolset, threading and link. Well there are another option avaible, but I will only introduce you to three important option : toolset, threading and link.
As expected Boost is compatible with most popular C++ compiler out there, you can refer to this page :
To understand what is threading and link mean easier, you should look to boost compiled lib naming convention. Boost lib consist with this name structure :
lib-[library_name]-[toolset used]-[threading tag]-[ABI tag]-[Boost Version].lib
for detailed information you should read this page :
[Build specific library]
To build specific library use –with-[library name] switch, example compiling boost-thread :
b2 –build-dir=intermediate toolset=msvc –build-type=minimal stage –with-thread
– Don’t forget to modify your boost-config.h to further customize boost to your need.
– You could also look at Jamroot file to see available build option
– Find compiled lib in stage directory
– In my case I built boost-thread, and it will not build if you enable BOOST_NO_EXCEPTIONS