Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost libraries - build only what I need

Tags:

c++

boost

I downloaded the Boost libraries and now I want to build only a few of the libraries. What would be the right command for this? Apparently the built-type=complete option gives me too much. I am using Windows XP and want to use Bjam to compile Boost and MinGW to finally use it. At the moment I think I need the libraries Boost.filesystem, Boost.ProgramOptions and Boost.System. Another question: Where do I put the header-only libraries?

like image 703
Till B Avatar asked Jan 17 '11 14:01

Till B


People also ask

How do I build a Boost library?

Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu. In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_62_0\lib\. From the Build menu, select Build Solution.

Is Boost library still useful?

You have no guarantee that any Boost library will be continued to be maintained in the future. Standard C++ code written for some compiler today will very likely continue to work fine with a newer compiler by the same vendor 10 years from now, for simple commercial reasons.

How long does it take to build Boost?

Building the library and tests adds between 80 and 140 MB of object files and executables to this. On a Pentium III laptop, building the Boost library takes 15 minutes and building and running the regression tests takes an additional 5 minutes.

What does the Boost library do?

Boost is a set of libraries for the C++ programming language that provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. It contains 164 individual libraries (as of version 1.76).


1 Answers

In step 5.2.4 of Getting Started you can instruct b2 which libraries to build:

./b2 --with-program_options --with-filesystem --with-system 

Alternatively, use ./b2 --show-libraries to see a list of all libraries that are not header-only.

Following is an excerpt from the page:

In particular, to limit the amount of time spent building, you may be interested in:

  • reviewing the list of library names with --show-libraries
  • limiting which libraries get built with the --with-<library-name> or --without-<library-name> options
  • choosing a specific build variant by adding release or debug to the command line.

Note: b2 command depends upon boost version so use following commands as per your boost version(Also, in this case use --with-libraries=<comma-seperated-library-names> version instead of --with-<library-name>):

  • ./configure for 1.38.0 and earlier
  • ./bootstrap.sh for 1.39.0 onwards till 1.46.0
like image 122
Sam Miller Avatar answered Sep 23 '22 07:09

Sam Miller