build: options -Target et -TestRegex de build.ps1

This commit is contained in:
Ange-Marie MAURIN - A2M Systèmes committed 2026-11-06 22:29:49 +01:00
1 parent 1720da44a4
commit e703c217f7
1 file changed
+20 -2
+20 -2
View File
@@ -22,6 +22,12 @@
.PARAMETER BuildDir
Dossier de build a utiliser a la place de build\<preset> (builds paralleles).
.PARAMETER Target
Cibles CMake a compiler (toutes par defaut). Exige -BuildDir.
.PARAMETER TestRegex
Ne lance que les tests dont le nom correspond (ctest -R). Exige -BuildDir.
.PARAMETER Help
Affiche cette aide.
@@ -35,6 +41,8 @@ param(
[switch]$Clean,
[switch]$NoTests,
[string]$BuildDir,
[string[]]$Target,
[string]$TestRegex,
[Alias("h", "?")]
[switch]$Help
)
@@ -78,9 +86,19 @@ try {
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 ($Target) {
Invoke-Step "build $dir ($($Target -join ', '))" { cmake --build $dir --target $Target }
}
else {
Invoke-Step "build $dir" { cmake --build $dir }
}
if (-not $NoTests) {
Invoke-Step "test $dir" { ctest --test-dir $dir --output-on-failure --no-tests=error }
if ($TestRegex) {
Invoke-Step "test $dir (-R $TestRegex)" { ctest --test-dir $dir --output-on-failure --no-tests=error -R $TestRegex }
}
else {
Invoke-Step "test $dir" { ctest --test-dir $dir --output-on-failure --no-tests=error }
}
}
}
else {