Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-07-04 01:24:33


   Hi Jordi.

> I just started using boost-build today. I'm very used to writing my
> own Makefiles, but now that my project is starting to grow, I decided
> that I needed a more flexible build system, and autotools looks too
> daunting. Hence, boost-build. Feel free to answer my questions with an
> RTFM, but just tell me which FM to R, or better, which section. :-)
> I'm having a bit of a hard time navigating the documentation. In case
> it matters, I'm using Debian testing and the boost-build package found
> therein.

   If you want to really actively use Boost Build for your projects then
I suggest taking the trunk version directly from the Boost library
Subversion repository. Boost Build releases are much to rare... :-(

> 1) bjam by default puts my object files and binaries under
> bin/$compiler/$build-type. While I'm happy with object code going
> in there, but I'd rather have the binary in the same directory as
> the bin/ directory (i.e. one level above bin/), with different
> kinds of release postfixed (e.g. binary-release binary-debug
> ...). I'd also like to remove the $compiler intermediate directory,
> since I'll never use more than one compiler per copy of the source
> tree.

   These are the output folders used by Boost Build to make sure
different configuration builds do not conflict with each other. You can
always add additional rules for copying built targets into some specific
target folder using the 'install' rule and/or adding suffixes using
'tag' properties. Both should be described in the documentation, easy to
decypher from the source & examples and if you run into any problems -
just holler on the list.

   Boost library for example does that to collect all build .lib & .dll
files, move them to a libs folder and add a version/configuration suffix
to them...

   Be careful though that if you simply 'copy built files to a fixed
folder' you break the ability to build multiple configurations at the
same time. This might or might not present a problem depending on your
use case.

> Naturally, I also want "bjam clean" to clean both the object code
> from the bin/ tree and the binaries in the top directory.

   Boost Build tracks & cleans 'installed targets' just like regular ones.

> 2) I want to be very picky and have fine-tuned controls about the
> compile options that bjam passes to gcc. I don't understand how to
> specify exactly which options to pass and which not to.

   That should be explained in the docs under built-in features. There
are features like cflags, cxxflagx, linkflags etc. that can be used to
pass raw compiler options directly to the tools you need.

   Note though that such direct option passing will not be recognized by
Boost Build as something that can cause incompatible builds and
therefore will not affect the folder Boost Build builds those targets
in. If you want that you need to wrap your options using a custom
non-incidental feature or for a less fine-tuned approach - a custom
'variant'.

   If you have specific options you need and prepare clean features for
them, post them to this list and we'll include them in the Boost Build
sources.

> 3) I want to add a profiling target, which requires different compile
> and linking options than the debug target. I think I sorta
> understand how to add a new kind of build as detailed in chapter 6
> of the manual, but I don't understand how to set its compile and
> linking options.

   That sounds like a new build variant. For compiler and linking
options - look at the text above.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk