55 lines
1.3 KiB
Plaintext
55 lines
1.3 KiB
Plaintext
|
#! /usr/bin/env bash
|
||
|
|
||
|
TARGET=$1
|
||
|
BUILD_TYPE=$2
|
||
|
|
||
|
project=$(pwd)/
|
||
|
buildTool="-GNinja"
|
||
|
|
||
|
if [[ $TARGET == windows ]]; then
|
||
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
||
|
buildTool="-GNinja"
|
||
|
elif [[ $TARGET == gba ]]; then
|
||
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake"
|
||
|
oxUseStdLib="-DOX_USE_STDLIB=OFF"
|
||
|
fi
|
||
|
|
||
|
if [[ $BUILD_TYPE == asan ]]; then
|
||
|
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
|
||
|
sanitizerArgs="-DUSE_ASAN=ON"
|
||
|
elif [[ $BUILD_TYPE == debug ]]; then
|
||
|
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
|
||
|
sanitizerArgs=""
|
||
|
elif [[ $BUILD_TYPE == release ]]; then
|
||
|
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Release"
|
||
|
sanitizerArgs=""
|
||
|
fi
|
||
|
|
||
|
if [[ $QTDIR != "" ]]; then
|
||
|
qtPath="-DQTDIR=${QTDIR}"
|
||
|
fi
|
||
|
|
||
|
buildDir="${project}/build/${TARGET}-${BUILD_TYPE}"
|
||
|
distDir="${project}/dist/${TARGET}-${BUILD_TYPE}"
|
||
|
|
||
|
mkdir -p $buildDir
|
||
|
pushd $buildDir
|
||
|
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||
|
-DCMAKE_INSTALL_PREFIX="$distDir" \
|
||
|
$buildTool \
|
||
|
$nostalgiaBuildType \
|
||
|
$oxUseStdLib \
|
||
|
$BUILD_TYPEArgs \
|
||
|
$sanitizerArgs \
|
||
|
$qtPath \
|
||
|
$toolchain \
|
||
|
$project
|
||
|
popd
|
||
|
|
||
|
rm -f build/current dist/current
|
||
|
mkdir -p dist
|
||
|
ln -s ${TARGET}-${BUILD_TYPE} build/current
|
||
|
rm -f compile_commands.json
|
||
|
ln -s build/current/compile_commands.json
|
||
|
ln -s ${TARGET}-${BUILD_TYPE} dist/current
|