forked from Qfusion/qfusion
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathbuild-windows.ps1
More file actions
50 lines (41 loc) · 1.54 KB
/
Copy pathbuild-windows.ps1
File metadata and controls
50 lines (41 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Windows build wrapper for Warfork.
# Run from a Developer PowerShell for VS 2022 (or any shell where cmake/msbuild are on PATH).
[CmdletBinding()]
param(
[ValidateSet('release', 'debug')]
[string]$Config = 'release',
[switch]$Clean,
[switch]$NoDeploy,
[Parameter(ValueFromRemainingArguments=$true)]
[string[]]$ExtraArgs
)
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $root
if (-not (Test-Path 'third-party/angelscript/sdk/angelscript/include/angelscript.h')) {
Write-Host "==> Initialising git submodules"
git submodule update --init --recursive
if ($LASTEXITCODE -ne 0) { throw "submodule init failed" }
}
$preset = "workflow-windows-$Config"
$cfgName = if ($Config -eq 'release') { 'RelWithDebInfo' } else { 'Debug' }
$buildDir = Join-Path $root 'source/build'
if ($Clean -and (Test-Path $buildDir)) {
Write-Host "==> Cleaning $buildDir"
Remove-Item -Recurse -Force $buildDir
}
Write-Host "==> Configuring ($preset)"
Push-Location source
try {
& cmake -B .\build --preset $preset -G "Visual Studio 17 2022" -A x64 @ExtraArgs
if ($LASTEXITCODE -ne 0) { throw "cmake configure failed" }
& cmake --build .\build --config $cfgName
if ($LASTEXITCODE -ne 0) { throw "cmake build failed" }
if (-not $NoDeploy) {
& cmake --build .\build --target deploy --config $cfgName
if ($LASTEXITCODE -ne 0) { throw "deploy failed" }
}
} finally {
Pop-Location
}
Write-Host "==> Build complete: source\build\warfork-qfusion\$cfgName"