Add missing setup-build script
This commit is contained in:
parent
9d1312e22a
commit
af553a2ca3
54
scripts/setup-build
Executable file
54
scripts/setup-build
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#! /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
|
Loading…
Reference in New Issue
Block a user