0

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ibell
  • 1,070
  • 8
  • 29
  • This may be a duplicate of [this question](http://stackoverflow.com/questions/2150836/how-to-extract-boost-interprocess-library) – Bill Lynch Mar 15 '13 at 21:14

2 Answers2

2

It is a header-only library, and it does depend on other Boost libraries.

A quick examination indicates that you'll need at least:

  • boost::math
  • boost::mpl
  • boost::type_traits
  • boost::serialization
  • boost::config
  • boost::utility
  • boost::lambda
  • boost::version

Plus others that those libraries may include. All of those libraries were header-only as of version 1.49.

If you just install Boost without compiling it, you should be able to use the header libraries directly. Once installed, you could transfer the relevant headers into SVN if the process of installing the headers across multiple platforms is onerous.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Andrew Prock
  • 6,900
  • 6
  • 40
  • 60
  • Thanks, I guess the easiest way to check dependencies is to just start out by including boost::units and adding things back until it compiles. And then checking those headers back into svn, but that means that any updates won't get pulled into my repo. Decisions, decisions... – ibell Mar 15 '13 at 21:29
  • 1
    For others that arrive here, see also http://stackoverflow.com/questions/2150836/how-to-extract-boost-interprocess-library – ibell Mar 15 '13 at 21:32
  • So I got this working, bcp is the key as in the link to the duplicate question in my OP. I have an answer (mostly for my reference) with instructions for how to do it. – ibell Mar 23 '13 at 15:56
0

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ibell
  • 1,070
  • 8
  • 29