You can select a specific compiler with an mkspec (explained below) or
you can set the CXX variable to your preferred compiler.
For example, if you want to use clang++, just add CXX=clang++ in front of
pythonwafconfigure:

CXX=clang++pythonwafconfigure

Note

clang++ is currently the default compiler on Mac OSX, therefore
this customization step is not needed on that operating system.

We use “mkspecs” (short for “make specifications”) to instruct waf to select
a specific compiler based on its version number (e.g. 4.8) and binary name
(e.g. g++-4.8 or arm-linux-androideabi-g++). Some mkspecs also
include compiler and linker flags to select a CPU architecture or
change some other characteristics of the build process. You can select an
mkspec with the cxx_mkspec tool option, see various examples below.

By using an mkspec, we can easily select a toolchain that can compile binaries
for different platforms. First, you have to install the appropriate toolchain,
then you can configure Kodo with the corresponding mkspec.

Different mkspecs are available on different operating systems. You can
get the list of the currently supported mkspecs with the config.py helper
script located in the Kodo root folder:

pythonconfig.py

This helper script automatically updates itself when you run it. You can use
this script to go through the common configuration options without typing
too much.

The full list of currently tested mkspecs can be seen at the bottom of the
Steinwurf Buildbot page (mkspecs in red are temporarily offline):
http://buildbot.steinwurf.dk

You also need the Android SDK, because we need to find the adb tool
during the configure step. If you do not have it already the Android
guide describes both where to download the Android SDK and how to get the
adb tool. To ensure our build system will pick up the dependencies, the
easiest solution is to add the path to adb and the bin folder of
the standalone toolchain to your PATH. For example, you can add the
following lines to your ~/.profile (please adjust the paths to match
your folder names and locations):

You need to log in again or open a new terminal to get the updated PATH.
You can check that the required binaries are really in your PATH with these
commands:

adbversionarm-linux-androideabi-clang++--version

Once you have everything in your PATH, use the following mkspec when you
configure (you may also select another Android mkspec if available
in the list provided by config.py):

pythonwafconfigure--cxx_mkspec=cxx_android5_clang70_armv7

Note that the android5 designation in the mkspec indicates that a
position independent executable (PIE) will be generated. This is required
on Android 5 and above, but Android 4.1+ can also run a PIE binary.

The configure command should find your toolchain and the necessary binaries,
and you can build the codebase as usual after this:

pythonwafbuild

You can find the generated Android binaries in the
build/cxx_android5_clang70_armv7 folder. You can transfer these binaries to
your Android device with adb (you can use /data/local/tmp/ as a target
folder). Read our Android guide for more information on this.

If you don’t want to add the Android toolchains to your PATH, then we also
provide explicit options to specify these folders during the configure step.
Here is an example for that:

If you want to use the generated static libraries with ndk-build,
then make sure that you process at least one C++ source file (.cpp)
with ndk-build (this can be a dummy cpp file). Otherwise you
will get a lot of linkage issues, because ndk-build does not link
with the C++ standard library by default.

You need to install the latest XCode to compile for iOS. Please make sure
that you also have the Apple command-line tools in your PATH by executing
the following command on OSX Mavericks:

xcode-select--install

Open a Terminal, and use this command to check if you have the Apple LLVM
compiler in your PATH:

clang++--version

XCode installs the iOS SDK to a standard location, so you only need to specify
the iOS mkspec when you configure (please note that the version numbers in
the name of the mkspec may change, so use config.py to list the currently
available versions):

pythonwafconfigure--cxx_mkspec=cxx_ios70_apple_llvm_armv7

Then you can build Kodo as usual:

pythonwafbuild

You can find the generated iOS binaries in the
build/cxx_ios70_apple_llvm_armv7 folder. You can transfer these binaries
to your iOS device with any tool you like. Please note that these are
command-line binaries, so you will need a terminal application to run them.

You also need to add the bin folder of the Raspberry toolchain to your PATH.
For example, you can add the following lines to your ~/.profile
(please adjust the paths to match your folder names and locations):

PATH="$PATH:$HOME/toolchains/arm-rpi-4.9.3-linux-gnueabihf/bin"

You need to log in again or open a new terminal to get the updated PATH.
You can check that the required binaries are in your PATH with this command:

raspberry-gxx49-arm-g++--version

Go to your Kodo folder, configure Kodo with the following mkspec:

pythonwafconfigure--cxx_mkspec=cxx_raspberry_gxx49_armv7

The configure command should find your toolchain binaries,
and you can build the codebase as usual after this:

pythonwafbuild

You can find the generated binaries in the
build/cxx_raspberry_gxx49_armv7 folder. You can transfer these binaries
to your Raspberry Pi with any tool you like (e.g. SCP).

Save the configuration and build the OpenWrt toolchain (-j4 uses 4 cores to
speed up the process):

make-j4

After the toolchain is built, you need to add the bin folder of the
generated toolchain to your PATH (the toolchain is created in the
staging_dir folder). You should also set the STAGING_DIR variable
to point to the staging_dir folder. For example, you can add the following
lines to your ~/.profile (please adjust the paths to match your folder
names and locations if necessary):

You need to log in again or open a new terminal to get the updated PATH.
You can check that the required binaries are in your PATH with this command:

arm-openwrt-linux-g++--version

Go to your Kodo folder, and configure Kodo with the following mkspec:

pythonwafconfigure--cxx_mkspec=cxx_openwrt_gxx53_arm

The configure command should find your toolchain binaries,
and you can build the codebase as usual after this:

pythonwafbuild

You can find the generated binaries in the build/cxx_openwrt_gxx53_arm
folder. You can transfer these binaries to your OpenWrt device with any tool
you like (e.g. SCP). The binaries can be a bit large, because the mkspec embeds
the C++ standard library (with the -static-libstdc++ linker flag).
The libstdcpp package is usually not installed on OpenWrt devices, or it
might be incompatible with the GCC 5.x compiler.

Note that the following packages are required on your OpenWrt device to
run the generated binaries, you can run these commands on your device if it
has Internet connectivity:

opkginstalllibpthreadopkginstalllibrt

Alternatively, you can activate these packages in menuconfig and deploy
the generated *.ipk files manually on the device (with SCP and opkg):