This example shows how user can create his own build variants. Two variants are defined: "crazy", which is just a random combination of properties, and "super-release", which is inherited from "release", and differs by a single define.
Files:
In this project the jamroot.jam
specifies
the custom build variants and the targets are specified in the two jamfile.jam
files.
variant crazy : <optimization>speed <inlining>off <debug-symbols>on <profiling>on ; variant super_release : release : <define>USE_ASM ;
Define a build variant which is just combination of four properties. |
|
Define a built variant inherited from 'release'. It defines one new property
and gets all properties from the parent |
The top-level jamfile.jam
:
project : default-build crazy super_release ; exe a : a.cpp libs//l ;
By default, build the project with the two variants we have defined in jamroot.jam. |
|
We build an |
And the library jamfile.jam
that the top-level jamfile.jam
refers
to:
lib l : l.cpp ;
Building the example yields:
> cd /example/variant > b2 ...found 20 targets... ...updating 16 targets... common.mkdir bin common.mkdir bin/clang-darwin-4.2.1 common.mkdir bin/clang-darwin-4.2.1/crazy clang-darwin.compile.c++ bin/clang-darwin-4.2.1/crazy/a.o common.mkdir libs/bin common.mkdir libs/bin/clang-darwin-4.2.1 common.mkdir libs/bin/clang-darwin-4.2.1/crazy clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/crazy/l.o clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/crazy/libl.dylib clang-darwin.link bin/clang-darwin-4.2.1/crazy/a common.mkdir bin/clang-darwin-4.2.1/super_release clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o common.mkdir libs/bin/clang-darwin-4.2.1/super_release clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib clang-darwin.link bin/clang-darwin-4.2.1/super_release/a ...updated 16 targets...
As specified in the top-level jamfile.jam
both custom variants
where built by default. Once can override that by specifying the variant one
wants to build directly on the command line with a variant=super_release
.
Or just with a super_release
as variants can be referred to by
their name only. For example using that argument yields:
> cd /example/variant > b2 super_release ...found 14 targets... ...updating 10 targets... common.mkdir bin common.mkdir bin/clang-darwin-4.2.1 common.mkdir bin/clang-darwin-4.2.1/super_release clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o common.mkdir libs/bin common.mkdir libs/bin/clang-darwin-4.2.1 common.mkdir libs/bin/clang-darwin-4.2.1/super_release clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib clang-darwin.link bin/clang-darwin-4.2.1/super_release/a ...updated 10 targets...
The actual paths in the bin
sub-directory will depend on your
toolset.