54 lines
1.3 KiB
Bash
Executable File
54 lines
1.3 KiB
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
target=$1
|
|
buildType=$2
|
|
vcpkg_dir=$3
|
|
|
|
project=$(pwd)/
|
|
|
|
if [[ $target == gba ]]; then
|
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake"
|
|
nostalgiaBuildType="GBA"
|
|
else
|
|
toolchain="-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake"
|
|
nostalgiaBuildType="Native"
|
|
fi
|
|
|
|
if [[ $buildType == asan ]]; then
|
|
buildTypeArg="Debug"
|
|
sanitizerStatus="ON"
|
|
elif [[ $buildType == debug ]]; then
|
|
buildTypeArg="Debug"
|
|
sanitizerStatus="OFF"
|
|
elif [[ $buildType == release ]]; then
|
|
buildTypeArg="Release"
|
|
sanitizerStatus="OFF"
|
|
fi
|
|
|
|
buildConfig=${target}-${buildType}
|
|
|
|
if [[ $NOSTALGIA_QT_PATH != "" ]]; then
|
|
qtPath="-DNOSTALGIA_QT_PATH=${NOSTALGIA_QT_PATH}"
|
|
fi
|
|
|
|
buildDir="${project}/build/${buildConfig}"
|
|
mkdir -p $buildDir
|
|
cmake -S $project -B $buildDir -GNinja \
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
|
-DCMAKE_BUILD_TYPE=${buildTypeArg} \
|
|
-DUSE_ASAN=${sanitizerStatus} \
|
|
-DNOSTALGIA_IDE_BUILD=OFF \
|
|
-DNOSTALGIA_BUILD_CONFIG=${buildConfig} \
|
|
-DNOSTALGIA_BUILD_TYPE=${nostalgiaBuildType} \
|
|
$qtPath \
|
|
$toolchain
|
|
|
|
mkdir -p dist
|
|
if [[ $target != gba ]] && [[ $target != gba-debug ]]; then
|
|
echo ${buildConfig} > .current_build
|
|
fi
|
|
rm -f compile_commands.json
|
|
ln -s build/${buildConfig}/compile_commands.json
|