19 lines
1.4 KiB
PowerShell
19 lines
1.4 KiB
PowerShell
# Local Windows build (MSVC, below-normal priority) and install into a game folder.
|
|
# Usage: powershell -File tools/build-win.ps1 [-GameDir C:\Games\GTAVC] [-Jobs 4]
|
|
param([string]$GameDir = "C:\Games\GTAVC", [int]$Jobs = 4)
|
|
$ErrorActionPreference = "Stop"
|
|
$root = Split-Path $PSScriptRoot -Parent
|
|
Set-Location $root
|
|
& .\premake5.exe vs2019 --with-librw --no-full-paths | Out-Null
|
|
$vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
|
|
$toolset = if (Test-Path "$vs\VC\Tools\MSVC\14.5*") { "v145" } else { "v143" }
|
|
$args = @("build\reVC.sln", "/m:$Jobs", "/nologo", "/v:minimal", "/p:Configuration=Release",
|
|
"/p:Platform=win-amd64-librw_d3d9-oal", "/p:PlatformToolset=$toolset", "/p:WindowsTargetPlatformVersion=10.0")
|
|
$p = Start-Process -FilePath "$vs\MSBuild\Current\Bin\MSBuild.exe" -ArgumentList $args -NoNewWindow -PassThru `
|
|
-RedirectStandardOutput build.log -RedirectStandardError build.err
|
|
$p.PriorityClass = "BelowNormal"; $p.WaitForExit()
|
|
$errors = Select-String -Path build.log -Pattern ": (fatal )?error " | ForEach-Object { $_.Line -replace '^.*\\src\\', 'src\' -replace ' \[.*$', '' } | Sort-Object -Unique
|
|
if ($errors) { $errors; exit 1 }
|
|
$bin = "bin\win-amd64-librw_d3d9-oal\Release"
|
|
Copy-Item "$bin\reVC.exe" $GameDir -Force
|
|
"built and installed to $GameDir"
|