The toolchain file is invoked in many different CACHE contexts and
shouldn't assume any behavior about the cache. Variables set in the file
will also be inherited by any scope that calls project() and so it is
not necessary to write any variables into the CACHE.
If the toolchain file is not templated, then any template variables
won't be initialized correctly. Add a test for overwriting
CROSS_COMPILER_PREFIX only if the templated value is valid.
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
Setting `-target` flag explicitly is unnecessary. Whenever this needs to
be explicitly passed through, the coompiler id should be checked.
Changes to the musl build system makes the explicit `C_COMPILER`
variable useless.
This change introduces a `gcc` hunting helper function to `gcc.cmake` in
order to help us find an appropriately prefixed `gcc` for the target
being built for. We use this helper to find 32b ARM cross-compiling
`gcc`s for both Debian and Red Hat based distros.
If CMAKE_TOOLCHAIN_FILE is unset in seL4Config.cmake then generate one
that selects the correct toolchain based on configured kernel arch
settings.
This means that initialising a build goes from:
`cmake -DCMAKE_TOOLCHAIN_FILE=gcc.cmake -DAARCH32=ON -G Ninja -C
../configs/ARM_verified.cmake ..`
to:
`cmake -G Ninja -C ../configs/ARM_verified.cmake ..`
gcc.cmake is modified to be used as an input to configure_file.
@KernelArch@ and other @@ arguments will be replaced with the
configuration settings. The file will still work if passed directly to
cmake via -DCMAKE_TOOLCHAIN_FILE=gcc.cmake without being templated.
Even if we are building for x86_64, we still need a cross compiler to be able to
build ELF binaries.
OS X cross compilers can be installed via brew from here:
https://github.com/SergioBenitez/homebrew-osxct
Allows for an ARM cross compiler to be specified with just -DARM=TRUE when initializing
cmake, instead of having to specify a full cross compilation prefix. This provides no
additional functionality, but provides a nicer interface for users