build: option -BuildDir de build.ps1 pour des builds en parallèle
This commit is contained in:
1 parent
7a1da8ef26
commit
1720da44a4
1 file changed
+18
-7
+18
-7
@@ -19,6 +19,9 @@
|
||||
.PARAMETER NoTests
|
||||
Compile sans lancer les tests.
|
||||
|
||||
.PARAMETER BuildDir
|
||||
Dossier de build a utiliser a la place de build\<preset> (builds paralleles).
|
||||
|
||||
.PARAMETER Help
|
||||
Affiche cette aide.
|
||||
|
||||
@@ -31,6 +34,7 @@ param(
|
||||
[string]$Preset = "windows-msvc-debug",
|
||||
[switch]$Clean,
|
||||
[switch]$NoTests,
|
||||
[string]$BuildDir,
|
||||
[Alias("h", "?")]
|
||||
[switch]$Help
|
||||
)
|
||||
@@ -70,14 +74,21 @@ function Invoke-Step([string]$label, [scriptblock]$cmd) {
|
||||
Initialize-VsEnvironment
|
||||
Push-Location $root
|
||||
try {
|
||||
if ($Clean) {
|
||||
$dir = Join-Path $root "build\$Preset"
|
||||
if (Test-Path $dir) { Remove-Item -Recurse -Force $dir }
|
||||
$dir = if ($BuildDir) { $BuildDir } else { Join-Path $root "build\$Preset" }
|
||||
if ($Clean -and (Test-Path $dir)) { Remove-Item -Recurse -Force $dir }
|
||||
if ($BuildDir) {
|
||||
Invoke-Step "configure $Preset -> $dir" { cmake --preset $Preset -B $dir }
|
||||
Invoke-Step "build $dir" { cmake --build $dir }
|
||||
if (-not $NoTests) {
|
||||
Invoke-Step "test $dir" { ctest --test-dir $dir --output-on-failure --no-tests=error }
|
||||
}
|
||||
}
|
||||
Invoke-Step "configure $Preset" { cmake --preset $Preset }
|
||||
Invoke-Step "build $Preset" { cmake --build --preset $Preset }
|
||||
if (-not $NoTests) {
|
||||
Invoke-Step "test $Preset" { ctest --preset $Preset }
|
||||
else {
|
||||
Invoke-Step "configure $Preset" { cmake --preset $Preset }
|
||||
Invoke-Step "build $Preset" { cmake --build --preset $Preset }
|
||||
if (-not $NoTests) {
|
||||
Invoke-Step "test $Preset" { ctest --preset $Preset }
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in new issue
Block a user