boostboost-units

Adding only boost::units to a C++ project


I have an open-source thermodynamic property library that is coded all in C++ and I am finally getting frustrated with dealing with units. I would like therefore to add boost::units to my core code in order to use boost::units to do all the unit handling with zero-ish(?) computational overhead.

But I need my code to run cross-platform/cross-compiler (Boost can do that), and ideally not need to download ALL of Boost since it isn't exactly a small package.

I want to know:

Is it possible to include only a small part of Boost? And not even download the other parts of Boost? I know if other Boost modules are not included, they will not be included in the build, but I don't want to even need to download the other modules.

Also, does boost::units require compilation or is it header-only?


Solution

  • I figured out how to do this. The following are instructions for Windows, but basically the same on other platforms.

    1. Download the most recent boost sources

    2. cd into the boost sources folder

    3. bootstrap

    4. .\b2 to build everything, go get a cup of coffee

    5. Copied the example units code from http://www.boost.org/doc/libs/1_53_0/doc/html/boost_units/Quick_Start.html and saved to sample.cpp

    6. "dist\bin\bcp.exe" --scan sample.cpp boost_units