#!/bin/sh -e

if [ -f CMakeLists.txt ]; then
	mkdir -p build
	cd build
fi

if ! [ -f CMakeCache.txt ]; then
	# Unity builds do speed things up as less small files requiring a full compiler startup and cleanup for each.
	cmake -DCMAKE_BUILD_TYPE=Release -DUNITY_BUILDS=ON -DWHOLE_PROGRAM_OPTIMISATION=OFF ..
fi

make -j$(nproc)
