-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.ps1
More file actions
41 lines (34 loc) · 783 Bytes
/
Copy pathrun.ps1
File metadata and controls
41 lines (34 loc) · 783 Bytes
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
param(
[ValidateSet("msvc", "gcc")]
[string]$compiler = "gcc",
[switch]$PPL
)
$buildDir = "build"
# Build
& "$PSScriptRoot\build.ps1" -compiler $compiler $(if ($PPL) { "-PPL" })
if ($LASTEXITCODE -ne 0) {
exit 1
}
# Run in build directory
Write-Host "Running..."
Push-Location $buildDir
try {
& ".\main.exe"
$runExitCode = $LASTEXITCODE
Pop-Location
if ($runExitCode -ne 0) {
Write-Error "Program execution failed"
exit 1
}
# Open output if it exists
$bmpFiles = Get-ChildItem -Path $buildDir -Filter *.bmp | Sort-Object Name
if ($bmpFiles.Count -gt 0) {
Start-Process $bmpFiles[0].FullName
}
else {
Write-Warning "No BMP file found in $buildDir"
}
}
finally {
Pop-Location
}