2018-01-28 00:26:50 -06:00
|
|
|
#! /usr/bin/env pwsh
|
|
|
|
|
|
|
|
Param(
|
|
|
|
[parameter(Mandatory=$true,Position=0)][String] ${target},
|
|
|
|
[parameter(Mandatory=$true,Position=1)][String] ${buildType}
|
|
|
|
)
|
|
|
|
|
2018-02-02 01:15:53 -06:00
|
|
|
$project=(Get-Location).Path
|
2018-01-28 00:26:50 -06:00
|
|
|
|
|
|
|
if (${target} -eq "windows") {
|
|
|
|
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
|
|
|
|
} elseif (${target} -eq "gba") {
|
2018-02-07 21:29:57 -06:00
|
|
|
$toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake"
|
|
|
|
$nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
|
|
|
|
$oxUseStdLib="-DOX_USE_STDLIB=OFF"
|
2018-01-28 00:26:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2018-02-06 19:20:07 -06:00
|
|
|
if (${env:NOSTALGIA_QT_PATH} -ne "") {
|
|
|
|
$qtPath="-DNOSTALGIA_QT_PATH=${env:NOSTALGIA_QT_PATH}"
|
|
|
|
}
|
|
|
|
|
2018-02-02 01:15:53 -06:00
|
|
|
$buildDir="${project}/build/${target}-${buildType}"
|
|
|
|
$distDir="${project}/dist/${target}-${buildType}"
|
2018-01-28 00:26:50 -06:00
|
|
|
|
|
|
|
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 `
|
2018-02-07 21:29:57 -06:00
|
|
|
$nostalgiaBuildType `
|
|
|
|
$oxUseStdLib `
|
2018-01-28 00:26:50 -06:00
|
|
|
$buildTypeArgs `
|
2018-02-06 19:20:07 -06:00
|
|
|
$qtPath `
|
2018-01-28 00:26:50 -06:00
|
|
|
$toolchain `
|
|
|
|
$project
|
|
|
|
Pop-Location
|
|
|
|
|
|
|
|
rm -f build/current dist/current
|
2018-02-02 01:15:53 -06:00
|
|
|
if (!(Test-Path -Path dist)) {
|
|
|
|
New-Item -ItemType Directory -Path dist | Out-Null
|
|
|
|
}
|
2018-01-28 00:26:50 -06:00
|
|
|
ln -s ${target}-${buildType} build/current
|
|
|
|
ln -s ${target}-${buildType} dist/current
|