2017-10-11 19:20:46 -05:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
project=$(pwd)/
|
|
|
|
|
|
|
|
TARGET=$1
|
|
|
|
BUILD_TYPE=$2
|
|
|
|
|
|
|
|
if [[ $TARGET == windows ]]; then
|
|
|
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
|
|
|
elif [[ $TARGET == gba ]]; then
|
|
|
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DOX_USE_STDLIB=OFF -DCMAKE_INSTALL_PREFIX=$DEVKITARM"
|
|
|
|
fi
|
|
|
|
|
2018-03-17 23:44:02 -05:00
|
|
|
if [[ $BUILD_TYPE == asan ]]; then
|
2017-10-11 19:20:46 -05:00
|
|
|
buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug"
|
2018-03-17 23:44:02 -05:00
|
|
|
buildDir="build/${TARGET}-asan"
|
|
|
|
elif [[ $BUILD_TYPE == debug ]]; then
|
|
|
|
buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug"
|
2017-10-11 19:20:46 -05:00
|
|
|
buildDir="build/${TARGET}-debug"
|
|
|
|
else
|
|
|
|
buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
buildDir="build/${TARGET}-release"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $buildDir
|
|
|
|
pushd $buildDir
|
|
|
|
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2018-03-09 21:45:46 -06:00
|
|
|
-GNinja \
|
2017-10-11 19:20:46 -05:00
|
|
|
$buildTypeArgs \
|
|
|
|
$toolchain \
|
|
|
|
$project
|
|
|
|
popd
|