JamPlus manual
|
Accessing the C module for the first time will auto-launch a reasonable default toolchain. On Windows, for example, the default toolchain is win64/release
. You can override the default toolchain by passing the C.TOOLCHAIN=platform/config
command-line option to Jam. For instance, to build win64 debug for the C toolchain, you would specify C.TOOLCHAIN=win64/debug
on the Jam command-line.
Replacing one of the C.TOOLCHAIN
entries with a -
(dash) will insert a reasonable default.
Additionally, as a backward compatibility feature, passing PLATFORM=abc
and CONFIG=defg
will result in a toolchain called abc/defg
.
rule C.Toolchain TOOLCHAIN_SPEC allows the current toolchain to be changed. The format of TOOLCHAIN_SPEC
(win32/release
) is slash-separated and the format is determined by the underlying Jamfiles that are executed. Additionally, at the end of the TOOLCHAIN_SPEC
, you can add key=value
options by preceding the option with an @
sign. See samples/toolchains-helloworld/Jamfile.jam
for usages.
Saving and restoring the current toolchain is performed by storing off $(C.ACTIVE_TOOLCHAIN_SPEC)
.
For the following Jamfile.jam
, a single invocation of Jam will build helloworld for:
The order of toolchain file loads is as follows when C.Toolchain win32/release
is called:
C.Toolchain
rule is requested. The rule is found missing, so Jam loads bin/modules/c.jam
to find it.C.Toolchain.win32.release
. The FindMissingRule
support kicks in and ends up executing rule C.Toolchain.win32.*
from bin/modules/c/toolchain/win32.jam
.C.PLATFORM/PLATFORM
and C.CONFIG/CONFIG
. For the toolchain win32/release
, the following assignments are made: C.PLATFORM=win32
, PLATFORM=win32
, C.CONFIG=release
, CONFIG=release
C.Toolchain.win32.*
, auto detection of the compiler is performed. First, the latest Visual Studio version is detected. Failing that, TDM/GCC is detected then MinGW. Assuming Visual Studio detection, C.Toolchain.vc.win32.Detect
from bin/modules/c/toolchain/vc/win32.jam
is called.C.Toolchain.vc.win32-release
from bin/modules/c/toolchain/vc/win32-release.jam
is called to set up some optimization flags and #defines.samples/fakeps3/jam/c/toolchain/fakeps3.jam
shows an example of handling multiple configurations and architectures within a single file.
C.ToolchainSpecKeys
is used to break down the basic form of C.TOOLCHAIN=whatever/whatever
. It parses the /
separators to assign the same value to multiple keys. For instance, C.ToolchainSpecKeys C.PLATFORM/PLATFORM
assigns the value to both C.PLATFORM
and PLATFORM
.
Settings are now added to $(C.COMPILER_SUITE_SYMBOL)
with the rule names that should be called. More than one rule name can be attached per setting; the listed rules will executed in order. The names of the settings are as follows:
C.ApplicationFromObjects_CleanIntermediates
C.ApplicationFromObjects_LinkFlags
C.ApplicationFromObjects_PostBuild
C.ApplicationFromObjects_Setup
C.C++Exceptions
C.LibraryFromObjects_LibFlags
C.LinkPrebuiltLibraries
C.MultiCppCompile_PreCompile
C.MultiCppCompile_PchDeps
C.MultiCppCompile_PostCompile
C.MultiCppCompile_SetupFlags
C.RuntimeTypeHelper
C.SharedLibraryFromObjects_CleanIntermediates
C.SharedLibraryFromObjects_ExportLib
C.SharedLibraryFromObjects_LinkFlags
C.SharedLibraryFromObjects_PostBuild
C.SharedLibraryFromObjects_RegServer
C.SharedLibraryFromObjects_UnRegServer
.