I’ve moved permanently to Linux as my development platform. I’m in love! Linux is giving me even more freedom from clutter and OS annoyances than what OSX was giving me. How did I ever get by without a tiling window manager!
Fanboyism aside, this week I finally finished the cross compiling setup that I started working on a while back.
The build “server” is Mac Mini running a bare bones installation of Arch Linux.
Cross compilation process
The cross compilation process is handled by a simple bash script. The setup step, that is run only once after a clean
git clone, initializes Cmake for the 5 “platforms” like so:
Each build, a part from the 64 bit Linux, has a toolchain file associated with it that specifies the compiler to use and the path to libraries and headers.
The 64 bit Linux build doesn’t need a toolchain file since the system is 64 bit and is configured to build by default using Clang 3.8.
The 64 bit Linux also runs first as it is the only build that will run the reflection preprocessor and other build time custom tools that generate code.
This is the toolchain file I use to compile Windows 64bit binaries:
Other toolchain files are similar, the only change is
i686 and the
TOOLCHAIN_PREFIX. You can read more about cross-compiling with Cmake on the docs.
CMAKE_CROSS_COMPILING is used throughout the
CMakeLists.txt files to disable running of preprocessing tools I mentioned earlier.
The actual build process is rather simple: the same bash script I mentioned above serially runs Ninja on each folder like so:
If the build fails the
stderr is redirected to a
BUILD_ERRORS.txt file that I can later review. Whenever a build breaks for a platform I run the same toolchain on my main development workstation and fix the bugs.
I’m currently building only in debug mode, but when I’ll integrate automated testing for I’ll enable Release mode to. Cross-platform automated testing will be tricky as I’ll probably have to use some form of OS virtualization.
Obviously a successful build doesn’t mean the actual game will run on the target platform, but that will be (hopefully) handled when I implement automated testing.