Choosing a maths library for cross-platform C++ game development

I have recently been looking for a C++ maths library for use in game development projects. There are plenty of posts on websites like gamedev.stackexchange.com with suggestions for libraries but few quantitative comparisons between them. I decided to take three of the most popular libraries and run some tests of my own. Below I describe the three libraries I’ve compared with their advantages and disadvantages and then show the results of some performance tests. It’s important for me to have cross-platform compatibility, so each library selected is header only and has been tested on Mac, Linux, and Android using the NDK. The code and results are also available on GitHub for testing.

The libraries tested are:

These choices are largely influenced by reading their websites and posts at the Game Development StackExchange site:

Continue reading

Cross-compiling FreeType for Android with CMake

Freetype provides a Makefile with a configure utility that makes it fairly easy to cross-compile for other platforms, however there are a lot of examples on the web (as well as some solutions) of people having difficulty in it.

My intention is to cross-compile FreeType using the Android NDK into a static library that can ultimately be used by libRocket for font rendering in HTML+CSS based UIs in OpenGL applications. I’m using the CMake build system for cross-platform builds and the android-cmake project to create a CMake toolchain for the NDK. This requires creating a CMakeLists.txt for FreeType as it doesn’t currently provide one.

The CMakeLists.txt file included below is based on the FreeType-2.4.8 release and is a result of converting the Jamfile and Makefile to CMake. Its intention is simply to allow compilation with CMake. For standard build and installs I would recommend following the instructions in the docs/INSTALL file from the FreeType directory. Note: This file will try and build *all* of FreeType2′s modules as defined in include/freetype/config/ftmodule.h. If you don’t want to build some of these modules please edit that file and remove the macro calls. Continue reading

Building Boost 1.47 for Android using CMake and the NDK

The Boost library is incredibly useful in cross-platform C++ software development. Building Boost for Android can be a bit troublesome and several patches need to be applied to the code. Mystic Games provides a project on GitHub called Boost for Android which at the time of writing worked with official NDK r5c and Boost version 1.45. See after the break for more information.

Continue reading