31 lines
1.1 KiB
PowerShell
31 lines
1.1 KiB
PowerShell
param(
|
|
[string]$QtRoot = "C:\Qt\Qt5.12.4",
|
|
[ValidateSet("release", "debug")]
|
|
[string]$Configuration = "release"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$ProjectRoot = Split-Path -Parent $PSScriptRoot
|
|
$Qmake = Join-Path $QtRoot "5.12.4\mingw73_64\bin\qmake.exe"
|
|
$Make = Join-Path $QtRoot "Tools\mingw730_64\bin\mingw32-make.exe"
|
|
$CompilerBin = Join-Path $QtRoot "Tools\mingw730_64\bin"
|
|
$QtBin = Join-Path $QtRoot "5.12.4\mingw73_64\bin"
|
|
|
|
if (-not (Test-Path -LiteralPath $Qmake)) {
|
|
throw "qmake not found: $Qmake"
|
|
}
|
|
|
|
$env:PATH = "$QtBin;$CompilerBin;$env:PATH"
|
|
Push-Location $ProjectRoot
|
|
try {
|
|
& $Qmake "CONFIG+=$Configuration" CmvrControlStation.pro
|
|
if ($LASTEXITCODE -ne 0) { throw "qmake failed with exit code $LASTEXITCODE" }
|
|
& $Make $Configuration -j4
|
|
if ($LASTEXITCODE -ne 0) { throw "build failed with exit code $LASTEXITCODE" }
|
|
$ExecutableName = if ($Configuration -eq "debug") { "CmvrControlStation_d.exe" } else { "CmvrControlStation.exe" }
|
|
Write-Host "Built: $ProjectRoot\bin\$Configuration\$ExecutableName"
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|