[nostalgia] Cleanup setup-build
This commit is contained in:
parent
d1d979d2f1
commit
e8760cd714
@ -1,51 +1,47 @@
|
|||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
TARGET=$1
|
target=$1
|
||||||
BUILD_TYPE=$2
|
buildType=$2
|
||||||
|
|
||||||
project=$(pwd)/
|
project=$(pwd)/
|
||||||
buildTool=""
|
|
||||||
|
|
||||||
if [[ $TARGET == gba ]]; then
|
if [[ $target == gba ]]; then
|
||||||
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake"
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake"
|
||||||
nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
|
nostalgiaBuildType="GBA"
|
||||||
oxUseStdLib="-DOX_USE_STDLIB=OFF"
|
else
|
||||||
|
nostalgiaBuildType="Native"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $BUILD_TYPE == asan ]]; then
|
if [[ $buildType == asan ]]; then
|
||||||
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
|
buildTypeArg="Debug"
|
||||||
sanitizerArgs="-DUSE_ASAN=ON"
|
sanitizerStatus="ON"
|
||||||
elif [[ $BUILD_TYPE == debug ]]; then
|
elif [[ $buildType == debug ]]; then
|
||||||
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Debug"
|
buildTypeArg="Debug"
|
||||||
sanitizerArgs=""
|
sanitizerStatus="OFF"
|
||||||
elif [[ $BUILD_TYPE == release ]]; then
|
elif [[ $buildType == release ]]; then
|
||||||
BUILD_TYPEArgs="-DCMAKE_BUILD_TYPE=Release"
|
buildTypeArg="Release"
|
||||||
sanitizerArgs=""
|
sanitizerStatus="OFF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
buildConfig=${target}-${buildType}
|
||||||
|
|
||||||
if [[ $NOSTALGIA_QT_PATH != "" ]]; then
|
if [[ $NOSTALGIA_QT_PATH != "" ]]; then
|
||||||
qtPath="-DNOSTALGIA_QT_PATH=${NOSTALGIA_QT_PATH}"
|
qtPath="-DNOSTALGIA_QT_PATH=${NOSTALGIA_QT_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildDir="${project}/build/${TARGET}-${BUILD_TYPE}"
|
buildDir="${project}/build/${buildConfig}"
|
||||||
distDir="${project}/dist/${TARGET}-${BUILD_TYPE}"
|
|
||||||
|
|
||||||
mkdir -p $buildDir
|
mkdir -p $buildDir
|
||||||
cmake -S $project -B $buildDir \
|
cmake -S $project -B $buildDir -GNinja \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||||
-DCMAKE_INSTALL_PREFIX="$distDir" \
|
-DCMAKE_BUILD_TYPE=${buildTypeArg} \
|
||||||
-DCMAKE_INSTALL_RPATH="$project/dist/${TARGET}-${BUILD_TYPE}/lib/nostalgia" \
|
-DUSE_ASAN=${sanitizerStatus} \
|
||||||
-DNOSTALGIA_IDE_BUILD=OFF \
|
-DNOSTALGIA_IDE_BUILD=OFF \
|
||||||
-GNinja \
|
-DNOSTALGIA_BUILD_CONFIG=${buildConfig} \
|
||||||
$nostalgiaBuildType \
|
-DNOSTALGIA_BUILD_TYPE=${nostalgiaBuildType} \
|
||||||
$oxUseStdLib \
|
|
||||||
$BUILD_TYPEArgs \
|
|
||||||
$sanitizerArgs \
|
|
||||||
$qtPath \
|
$qtPath \
|
||||||
$toolchain
|
$toolchain
|
||||||
|
|
||||||
rm -f build/current dist/current
|
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
echo ${TARGET}-${BUILD_TYPE} > .current_build
|
echo ${buildConfig} > .current_build
|
||||||
rm -f compile_commands.json
|
rm -f compile_commands.json
|
||||||
ln -s build/${TARGET}-${BUILD_TYPE}/compile_commands.json
|
ln -s build/${buildConfig}/compile_commands.json
|
||||||
|
Loading…
Reference in New Issue
Block a user