The general overview of the build process was given in the user documentation. This section provides additional details, and some specific rules.
To recap, building a target with specific properties includes the following steps:
applying default build,
selecting the main target alternative to use,
determining "common" properties,
building targets referred by the sources list and dependency properties,
adding the usage requirements produces when building dependencies to the "common" properties,
building the target using generators,
computing the usage requirements to be returned.
When there are several alternatives, one of them must be selected. The process is as follows:
- For each alternative condition is defined as the set of base properties in requirements. [Note: it might be better to specify the condition explicitly, as in conditional requirements].
- An alternative is viable only if all properties in condition are present in build request.
- If there's one viable alternative, it's choosen. Otherwise, an attempt is made to find one best alternative. An alternative a is better than another alternative b, iff the set of properties in b's condition is a strict subset of the set of properities of 'a's condition. If there's one viable alternative, which is better than all others, it's selected. Otherwise, an error is reported.
The "common" properties is a somewhat artificial term. Those are the intermediate property set from which both the build request for dependencies and properties for building the target are derived.
Since default build and alternatives are already handled, we have only two inputs: build requests and requirements. Here are the rules about common properties.
Non-free feature can have only one value
A non-conditional property in requirement in always present in common properties.
A property in build request is present in common properties, unless (2) tells otherwise.
If either build request, or requirements (non-conditional or conditional) include an expandable property (either composite, or property with specified subfeature value), the behaviour is equivalent to explicitly adding all expanded properties to build request or requirements.
If requirements include a conditional property, and condiiton of this property is true in context of common properties, then the conditional property should be in common properties as well.
If no value for a feature is given by other rules here, it has default value in common properties.
Those rules are declarative, they don't specify how to compute the common properties. However, they provide enough information for the user. The important point is the handling of conditional requirements. The condition can be satisfied either by property in build request, by non-conditional requirements, or even by another conditional property. For example, the following example works as expected:
exe a : a.cpp : <toolset>gcc:<variant>release <variant>release:<define>FOO ;
Several factors determine the location of a concrete
file target. All files in a project are built under
the directory bin unless this is overriden by the build-dir project
attribute. Under bin is a path that depends on the properties
used to build each target. This path is uniquely determined by
all non-free, non-incidental properties. For example,
given a property set containing:
<toolset>gcc <toolset-gcc:version>4.6.1 <variant>debug
<warnings>all <define>_DEBUG <include>/usr/local/include
the path will be gcc-4.6.1/debug/link-static. <warnings> is an
incidental feature and <define> and <include> are
free features, so they do not affect the path.
Sometimes the paths produced by Boost.Build can become excessively long. There are a couple of command line options that can help with this. --abbreviate-paths reduces each element to no more than five characters. For example, link-static becomes lnk-sttc. The --hash option reduces the path to a single directory using an MD5 hash.
There are two features that affect the build directory. The <location> feature completely overrides the default build directory. For example,
exe a : a.cpp : <location>. ;
builds all the files produced by
in the directory of the Jamfile. This is generally
discouraged, as it precludes variant builds.
The <location-prefix> feature adds a prefix to the path, under the project's build directory. For example,
exe a : a.cpp : <location-prefix>subdir ;
will create the files for
a in bin/subdir/gcc-4.6.1/debug