2016-03-26 15:49:05 -05:00
|
|
|
#! /usr/bin/env bash
|
2016-12-23 17:29:19 -06:00
|
|
|
|
|
|
|
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
|
2017-05-06 12:10:40 -05:00
|
|
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DWOMBAT_BUILD_TYPE=GBA -DOX_USE_STDLIB=OFF -DCMAKE_INSTALL_PREFIX=$DEVKITARM"
|
2016-12-23 17:29:19 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $BUILD_TYPE == debug ]]; then
|
|
|
|
buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug"
|
2017-05-16 00:17:22 -05:00
|
|
|
elif [[ $BUILD_TYPE == release ]]; then
|
2016-12-23 17:29:19 -06:00
|
|
|
buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
fi
|
2016-03-26 15:49:05 -05:00
|
|
|
|
2017-05-16 00:17:22 -05:00
|
|
|
buildDir="build/${TARGET}-${BUILD_TYPE}"
|
|
|
|
distDir="../../dist/${TARGET}-${BUILD_TYPE}"
|
|
|
|
|
2016-03-26 15:49:05 -05:00
|
|
|
mkdir -p $buildDir
|
|
|
|
pushd $buildDir
|
2016-12-23 17:29:19 -06:00
|
|
|
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2017-05-16 00:17:22 -05:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$distDir" \
|
2016-12-23 17:29:19 -06:00
|
|
|
$buildTypeArgs \
|
|
|
|
$toolchain \
|
|
|
|
$project
|
2016-03-26 15:49:05 -05:00
|
|
|
popd
|