Rewrite setup_build in Powershell
This commit is contained in:
parent
ce9bbb7558
commit
27b08561e1
25
Makefile
25
Makefile
@ -38,8 +38,8 @@ gba-run: gba-pkg
|
|||||||
mgba-qt nostalgia.gba
|
mgba-qt nostalgia.gba
|
||||||
gdb: make
|
gdb: make
|
||||||
gdb ./build/current/src/wombat/wombat
|
gdb ./build/current/src/wombat/wombat
|
||||||
gdb-studio: make
|
gdb-studio: install
|
||||||
gdb "./dist/current/bin/nostalgia-studio -profile dist/current/share/nostalgia-studio.json"
|
gdb --args ./dist/current/bin/nostalgia-studio -profile dist/current/share/nostalgia-studio.json
|
||||||
|
|
||||||
devenv-image:
|
devenv-image:
|
||||||
docker build . -t ${DEVENV_IMAGE}
|
docker build . -t ${DEVENV_IMAGE}
|
||||||
@ -63,35 +63,28 @@ shell:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
${ENV_RUN} rm -rf build/${HOST_ENV}-release
|
${ENV_RUN} rm -rf build/${HOST_ENV}-release
|
||||||
${ENV_RUN} ./scripts/setup_build ${HOST_ENV} release
|
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} release
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
${ENV_RUN} rm -rf build/${HOST_ENV}-debug
|
${ENV_RUN} rm -rf build/${HOST_ENV}-debug
|
||||||
${ENV_RUN} ./scripts/setup_build ${HOST_ENV} debug
|
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} debug
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
asan:
|
asan:
|
||||||
${ENV_RUN} rm -rf build/${HOST_ENV}-asan
|
${ENV_RUN} rm -rf build/${HOST_ENV}-asan
|
||||||
${ENV_RUN} ./scripts/setup_build ${HOST_ENV} asan
|
${ENV_RUN} ./scripts/setup-build.ps1 ${HOST_ENV} asan
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
${ENV_RUN} rm -rf build/windows
|
${ENV_RUN} rm -rf build/windows
|
||||||
${ENV_RUN} ./scripts/setup_build windows
|
${ENV_RUN} ./scripts/setup-build.ps1 windows
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
windows-debug:
|
windows-debug:
|
||||||
${ENV_RUN} rm -rf build/windows
|
${ENV_RUN} rm -rf build/windows
|
||||||
${ENV_RUN} ./scripts/setup_build windows debug
|
${ENV_RUN} ./scripts/setup-build.ps1 windows debug
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
gba:
|
gba:
|
||||||
${ENV_RUN} rm -rf build/gba-release
|
${ENV_RUN} rm -rf build/gba-release
|
||||||
${ENV_RUN} ./scripts/setup_build gba release
|
${ENV_RUN} ./scripts/setup-build.ps1 gba release
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
|
||||||
gba-debug:
|
gba-debug:
|
||||||
${ENV_RUN} rm -rf build/gba-debug
|
${ENV_RUN} rm -rf build/gba-debug
|
||||||
${ENV_RUN} ./scripts/setup_build gba debug
|
${ENV_RUN} ./scripts/setup-build.ps1 gba debug
|
||||||
${ENV_RUN} rm -f build/current
|
|
||||||
|
42
scripts/setup-build.ps1
Executable file
42
scripts/setup-build.ps1
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#! /usr/bin/env pwsh
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(Mandatory=$true,Position=0)][String] ${target},
|
||||||
|
[parameter(Mandatory=$true,Position=1)][String] ${buildType}
|
||||||
|
)
|
||||||
|
|
||||||
|
$project=(Get-Location)
|
||||||
|
|
||||||
|
if (${target} -eq "windows") {
|
||||||
|
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
||||||
|
} elseif (${target} -eq "gba") {
|
||||||
|
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DNOSTALGIA_BUILD_TYPE=GBA -DOX_USE_STDLIB=OFF"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (${buildType} -eq "asan") {
|
||||||
|
$buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug"
|
||||||
|
} elseif (${buildType} -eq "debug") {
|
||||||
|
$buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug"
|
||||||
|
} elseif (${buildType} -eq "release") {
|
||||||
|
$buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
}
|
||||||
|
|
||||||
|
$buildDir="build/${target}-${buildType}"
|
||||||
|
$distDir="../../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 `
|
||||||
|
$buildTypeArgs `
|
||||||
|
$toolchain `
|
||||||
|
$project
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
rm -f build/current dist/current
|
||||||
|
New-Item -ItemType Directory -Path dist | Out-Null
|
||||||
|
ln -s ${target}-${buildType} build/current
|
||||||
|
ln -s ${target}-${buildType} dist/current
|
@ -1,46 +0,0 @@
|
|||||||
#! /usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
project=$(pwd)/
|
|
||||||
|
|
||||||
TARGET=$1
|
|
||||||
BUILD_TYPE=$2
|
|
||||||
|
|
||||||
#if [[ $(which ninja) != "ninja not found" ]]; then
|
|
||||||
# buildTool="-GNinja"
|
|
||||||
#fi
|
|
||||||
|
|
||||||
if [[ $TARGET == windows ]]; then
|
|
||||||
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
|
||||||
elif [[ $TARGET == gba ]]; then
|
|
||||||
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DNOSTALGIA_BUILD_TYPE=GBA -DOX_USE_STDLIB=OFF"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $BUILD_TYPE == asan ]]; then
|
|
||||||
buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug"
|
|
||||||
elif [[ $BUILD_TYPE == debug ]]; then
|
|
||||||
buildTypeArgs="-DCMAKE_BUILD_TYPE=Debug"
|
|
||||||
elif [[ $BUILD_TYPE == release ]]; then
|
|
||||||
buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
fi
|
|
||||||
|
|
||||||
buildDir="build/${TARGET}-${BUILD_TYPE}"
|
|
||||||
distDir="../../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 \
|
|
||||||
$buildTypeArgs \
|
|
||||||
$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
|
|
Loading…
Reference in New Issue
Block a user