8.1.8. cafeCC wrapper for complex setups¶
8.1.8.1. Background¶
Your project has at least one of the following properties:
multiple compilers are used in the same build (e.g. a certified compiler for functional safety and a non-certified compiler for more modern language features)
build system cleans the whole environment when calling compiler subprocesses (e.g. SCons)
8.1.8.2. What needs to be done?¶
create wrapper for cafeCC which sets required environment variables for compiler toolchain profile (e.g. especially
BAUHAUS_CONFIGandCAFECC_BASEPATH)
GNU/Linux or macOS¶
Instead of using cafeCC as compiler replacement, you need to use a wrapper
shell script which you can place either in PATH or at any location when
specifying the compiler via absolute path.
The wrapper shell script (e.g. named custom-cc.sh and made executable) should
contain the following exemplary content:
#!/bin/sh
export CAFECC_BASEPATH="/path/to/project"
export BAUHAUS_CONFIG="$CAFECC_BASEPATH/axivion/custom-cc"
cafeCC "$@"
Windows¶
Instead of using cafeCC as compiler replacement, you need to use a wrapper
executable which you can place either in PATH or at any location when
specifying the compiler via absolute path.
We supply files cafeCCwrapper.exe and cafeCCwrapper.exe.config for such
cases. Copy both files to the desired location and rename them according to your needs
(e.g. to custom-cc.exe and custom-cc.exe.config).
Modify the *.exe.config file inside the <appSettings> section to
include the following variables:
<add key="env:CAFECC_BASEPATH" value="D:\path\to\project" />
<add key="env:BAUHAUS_CONFIG" value="D:\path\to\project\axivion\custom-cc" />
You can use %~dp0 to specify the directory location of the wrapper (which
already includes the trailing backslash) and also syntax %ENVVAR% to expand
existing environment variables in the value attribute.