[nostalgia] Port setup-build back to Bash
This commit is contained in:
parent
af0e24d9bf
commit
8da1b77aa5
14
Makefile
14
Makefile
@ -63,28 +63,28 @@ shell:
|
||||
|
||||
release:
|
||||
${ENV_RUN} rm -rf build/${HOST_ENV}-release
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} release
|
||||
${ENV_RUN} ./scripts/setup-build ${HOST_ENV} release
|
||||
|
||||
debug:
|
||||
${ENV_RUN} rm -rf build/${HOST_ENV}-debug
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} debug
|
||||
${ENV_RUN} ./scripts/setup-build ${HOST_ENV} debug
|
||||
|
||||
asan:
|
||||
${ENV_RUN} rm -rf build/${HOST_ENV}-asan
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} asan
|
||||
${ENV_RUN} ./scripts/setup-build ${HOST_ENV} asan
|
||||
|
||||
windows:
|
||||
${ENV_RUN} rm -rf build/windows
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 windows
|
||||
${ENV_RUN} ./scripts/setup-build windows
|
||||
|
||||
windows-debug:
|
||||
${ENV_RUN} rm -rf build/windows
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 windows debug
|
||||
${ENV_RUN} ./scripts/setup-build windows debug
|
||||
|
||||
gba:
|
||||
${ENV_RUN} rm -rf build/gba-release
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 gba release
|
||||
${ENV_RUN} ./scripts/setup-build gba release
|
||||
|
||||
gba-debug:
|
||||
${ENV_RUN} rm -rf build/gba-debug
|
||||
${ENV_RUN} ./scripts/setup-build.ps1 gba debug
|
||||
${ENV_RUN} ./scripts/setup-build gba debug
|
||||
|
57
scripts/setup-build
Executable file
57
scripts/setup-build
Executable file
@ -0,0 +1,57 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
TARGET=$1
|
||||
BUILD_TYPE=$2
|
||||
|
||||
project=$(pwd)/
|
||||
buildTool=""
|
||||
|
||||
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"
|
||||
nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
|
||||
oxUseStdLib="-DOX_USE_STDLIB=OFF"
|
||||
else
|
||||
buildTool="-GNinja"
|
||||
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 [[ $NOSTALGIA_QT_PATH != "" ]]; then
|
||||
qtPath="-DNOSTALGIA_QT_PATH=${NOSTALGIA_QT_PATH}"
|
||||
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" \
|
||||
-DCMAKE_INSTALL_RPATH="$project/dist/${TARGET}-${BUILD_TYPE}/lib/nostalgia" \
|
||||
-DNOSTALGIA_IDE_BUILD=OFF \
|
||||
$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
|
||||
ln -s ${TARGET}-${BUILD_TYPE} dist/current
|
@ -1,61 +0,0 @@
|
||||
#! /usr/bin/env pwsh
|
||||
|
||||
Param(
|
||||
[parameter(Mandatory=$true,Position=0)][String] ${target},
|
||||
[parameter(Mandatory=$true,Position=1)][String] ${buildType}
|
||||
)
|
||||
|
||||
$project=(Get-Location).Path
|
||||
$buildTool=""
|
||||
|
||||
if (${target} -eq "windows") {
|
||||
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
||||
$buildTool="-GNinja"
|
||||
} elseif (${target} -eq "gba") {
|
||||
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake"
|
||||
$nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
|
||||
$oxUseStdLib="-DOX_USE_STDLIB=OFF"
|
||||
} else {
|
||||
$buildTool="-GNinja"
|
||||
}
|
||||
|
||||
if (${buildType} -eq "asan") {
|
||||
$buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug"
|
||||
$sanitizerArgs="-DUSE_ASAN=ON"
|
||||
} elseif (${buildType} -eq "debug") {
|
||||
$buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug"
|
||||
$sanitizerArgs=""
|
||||
} elseif (${buildType} -eq "release") {
|
||||
$buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
|
||||
$sanitizerArgs=""
|
||||
}
|
||||
|
||||
if (${env:NOSTALGIA_QT_PATH} -ne "") {
|
||||
$qtPath="-DNOSTALGIA_QT_PATH=${env:NOSTALGIA_QT_PATH}"
|
||||
}
|
||||
|
||||
$buildDir="${project}/build/${target}-${buildType}"
|
||||
$distDir="${project}/dist/${target}-${buildType}"
|
||||
|
||||
New-Item -ItemType Directory -Path $buildDir | Out-Null
|
||||
Push-Location $buildDir
|
||||
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
|
||||
-DCMAKE_INSTALL_PREFIX="$distDir" `
|
||||
-DCMAKE_INSTALL_RPATH="$project/dist/${target}-${buildType}/lib/nostalgia" `
|
||||
-DNOSTALGIA_IDE_BUILD=OFF `
|
||||
$buildTool `
|
||||
$nostalgiaBuildType `
|
||||
$oxUseStdLib `
|
||||
$buildTypeArgs `
|
||||
$sanitizerArgs `
|
||||
$qtPath `
|
||||
$toolchain `
|
||||
$project
|
||||
Pop-Location
|
||||
|
||||
rm -f build/current dist/current
|
||||
if (!(Test-Path -Path dist)) {
|
||||
New-Item -ItemType Directory -Path dist | Out-Null
|
||||
}
|
||||
ln -s ${target}-${buildType} build/current
|
||||
ln -s ${target}-${buildType} dist/current
|
Loading…
Reference in New Issue
Block a user