-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.ps1
40 lines (34 loc) · 998 Bytes
/
build.ps1
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
function Start-Iterate($path) {
foreach ($item in Get-ChildItem -Path $path) {
Invoke-Build-Native "$path$item"
}
}
function Invoke-Build-Native($path) {
if (@(Test-Path "$path\lib\") -eq $True) {
Start-Iterate "$path\lib\"
}
if (@(Test-Path ($path = "$path\native")) -eq $False) {
Return
}
Update-CMake $path
Invoke-Build-CMake $path
}
function Update-CMake($path) {
Try {
New-Item "$path/build" -ItemType Directory -Force | Out-Null
cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -S "$path" -B "$path\build" -G "Ninja"
}
Catch {
Write-Output "'$path' - Configure failed"
}
}
function Invoke-Build-CMake($path) {
Try {
cmake --build "$path/build" --config Release --target all -j 4
}
Catch {
Write-Output "'$path' - Build failed"
}
}
Start-Iterate ".\lib\"
Read-Host -Prompt "`n`nPress any key to continue"