-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-c-json-parser.ps1
More file actions
51 lines (41 loc) · 1.06 KB
/
build-c-json-parser.ps1
File metadata and controls
51 lines (41 loc) · 1.06 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
51
$ErrorActionPreference = 'Stop'
$NINJA_FILE = $null
if ($IsMacOS) {
$NINJA_FILE = "build.osx.ninja"
}
elseif ($IsLinux) {
$NINJA_FILE = "build.linux.ninja"
}
elseif ($IsWindows) {
$NINJA_FILE = "build.windows.ninja"
}
else {
Write-Error "unsupported OS platform"
exit 1
}
# test
if (-not (Test-Path $NINJA_FILE)) {
Write-Error "file not found: $NINJA_FILE"
exit 1
}
# target
$target = $args[0]
if ([string]::IsNullOrWhiteSpace($target)) {
$target = "perf-c-json-parser"
}
Write-Host "build: $target" -ForegroundColor Green
Write-Host "using: $NINJA_FILE" -ForegroundColor Gray
# cleanup
Write-Host "cleanup..." -ForegroundColor Yellow
ninja -f $NINJA_FILE -t clean | Out-Null
# build
Write-Host "building..." -ForegroundColor Yellow
ninja -f $NINJA_FILE $target
if ($LASTEXITCODE -ne 0) {
Write-Error "build error: $LASTEXITCODE"
exit $LASTEXITCODE
}
# Очистка после сборки
Write-Host "cleanup..." -ForegroundColor DarkGray
ninja -f $NINJA_FILE -t clean | Out-Null
Write-Host "build complete." -ForegroundColor Green