Update build-repo.ps1

This commit is contained in:
Markus Fleschutz 2024-03-18 12:44:42 +01:00
parent 7ee714e3a9
commit a3d209e55c

View File

@ -4,12 +4,12 @@
.DESCRIPTION
This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
.PARAMETER path
Specifies the path to the Git repository (current working dir by default)
Specifies the path to the Git repository (default is current working directory)
.EXAMPLE
PS> ./build-repo.ps1 C:\Repos\ninja
Building 📂ninja using CMakeLists.txt into 📂ninja/_My_Build...
Building 📂ninja using CMakeLists.txt into 📂ninja/_Build_Results...
...
Built 📂ninja in 47 sec
Built 📂ninja repository in 47 sec.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -21,11 +21,11 @@ param([string]$path = "$PWD")
function BuildInDir([string]$path) {
$dirName = (Get-Item "$path").Name
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_My_Build..."
if (-not(Test-Path "$path/_My_Build/" -pathType container)) {
& mkdir "$path/_My_Build/"
"⏳ (1/4) Building 📂$dirName by using CMake into 📂$dirName/_Build_Results..."
if (-not(Test-Path "$path/_Build_Results/" -pathType container)) {
& mkdir "$path/_Build_Results/"
}
Set-Location "$path/_My_Build/"
Set-Location "$path/_Build_Results/"
"⏳ (2/4) Executing 'cmake' to generate the Makefile..."
& cmake ..
@ -139,7 +139,7 @@ try {
$repoDirName = (Get-Item "$path").Name
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Built repo 📂$repoDirName in $elapsed sec"
"✔️ Built 📂$repoDirName repository in $elapsed sec."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"