...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The bcp utility is a tool for extracting subsets of Boost, it's useful for Boost authors who want to distribute their library separately from Boost, and for Boost users who want to distribute a subset of Boost with their application.
bcp can also report on which parts of Boost your code is dependent on, and what licences are used by those dependencies.
bcp scoped_ptr /foo
Copies boost/scoped_ptr.hpp and dependencies to /foo.
bcp boost/regex.hpp /foo
Copies boost/regex.hpp and all dependencies including the regex source code (in libs/regex/src) and build files (in libs/regex/build) to /foo. Does not copy the regex documentation, test, or example code.
bcp regex /foo
Copies the full regex lib (in libs/regex) including dependencies (such as the boost.test source required by the regex test programs) to /foo.
bcp regex config build /foo
Copies the full regex lib (in libs/regex) plus the config lib (libs/config) and the build system (tools/build) to /foo including all the dependencies.
bcp --scan --boost=/boost foo.cpp bar.cpp boost
Scans the [non-boost] files foo.cpp and bar.cpp for boost dependencies and copies those dependencies to the sub-directory boost.
bcp --report regex.hpp boost-regex-report.html
Creates a HTML report called boost-regex-report.html for the boost module regex.hpp. The report contains license information, author details, and file dependencies.
bcp --list [options] module-list
Outputs a list of all the files in module-list including dependencies.
bcp [options] module-list output-path
Copies all the files found in module-list to output-path
bcp --report [options] module-list html-file
Outputs a html report file containing:
--boost=path
Sets the location of the boost tree to path. If this option is not provided then the current path is assumed to be the root directory of the Boost tree.
--scan
Treats the module list as a list of (probably non-boost) files to scan for boost dependencies, the files listed in the module list are not copied (or listed), only the boost files upon which they depend.
--svn
Only copy files under svn version control.
--unix-lines
Make sure that all copied files use Unix style line endings.
When the --scan option is not used then a list of boost files or library names to copy, this can be:
When the --scan option is used, then a list of (probably non-boost) files to scan for boost dependencies, the files in the module list are not therefore copied/listed.
The path to which files will be copied (this path must exist).
File dependencies are found as follows:
It should be noted that in practice bcp can produce a rather "fat" list of dependencies, reasons for this include:
The last point above can result in a substantial increase in the number of headers found compared to most peoples expectations. For example bcp finds 274 header dependencies for boost/shared_ptr.hpp: by running bcp in report mode we can see why all these headers have been found as dependencies:
As you can see the number of dependencies found are much larger than those used by any single compiler, however if you want to distribute a subset of Boost that's usable in any configuration, by any compiler, on any platform then that's exactly what you need. If you want to figure out which Boost headers are being used by your specific compiler then the best way to find out is to prepocess the code and scan the output for boost header includes. You should be aware that the result will be very platform and compiler specific, and may not contain all the headers needed if you so much as change a compiler switch (for example turn on threading support).
Last revised $Date: 2007-11-15 11:31:06 -0500 (Thu, 15 Nov 2007) $
© Copyright John Maddock 2003-7
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)