Add support for Meson builds

This commit is contained in:
Markus Fleschutz 2023-10-16 10:31:43 +02:00
parent 8b6e9f6b98
commit 3a88fa3923

View File

@ -2,7 +2,7 @@
.SYNOPSIS .SYNOPSIS
Builds a repository Builds a repository
.DESCRIPTION .DESCRIPTION
This PowerShell script builds a Git repository by supporting: cmake, configure, autogen, Imakefile, and Makefile. This PowerShell script builds a Git repository by supporting build systems such as: autogen, cmake, configure, Gradle, Imakefile, Makefile, and Meson.
.PARAMETER path .PARAMETER path
Specifies the path to the Git repository (current working dir by default) Specifies the path to the Git repository (current working dir by default)
.EXAMPLE .EXAMPLE
@ -21,7 +21,7 @@ param([string]$path = "$PWD")
function BuildInDir([string]$path) { function BuildInDir([string]$path) {
$dirName = (Get-Item "$path").Name $dirName = (Get-Item "$path").Name
if (Test-Path "$path/CMakeLists.txt" -pathType leaf) { if (Test-Path "$path/CMakeLists.txt" -pathType leaf) {
"⏳ Building 📂$dirName using CMakeLists.txt into 📂$dirName/_My_Build..." "⏳ Building 📂$dirName by using CMake into 📂$dirName/_My_Build..."
if (-not(Test-Path "$path/_My_Build/" -pathType container)) { if (-not(Test-Path "$path/_My_Build/" -pathType container)) {
& mkdir "$path/_My_Build/" & mkdir "$path/_My_Build/"
} }
@ -37,7 +37,7 @@ function BuildInDir([string]$path) {
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
} elseif (Test-Path "$path/configure" -pathType leaf) { } elseif (Test-Path "$path/configure" -pathType leaf) {
"⏳ Building 📂$dirName using 'configure'..." "⏳ Building 📂$dirName by using 'configure'..."
Set-Location "$path/" Set-Location "$path/"
& ./configure & ./configure
@ -50,7 +50,7 @@ function BuildInDir([string]$path) {
if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make test' has failed" }
} elseif (Test-Path "$path/autogen.sh" -pathType leaf) { } elseif (Test-Path "$path/autogen.sh" -pathType leaf) {
"⏳ Building 📂$dirName using 'autogen.sh'..." "⏳ Building 📂$dirName by using 'autogen.sh'..."
Set-Location "$path/" Set-Location "$path/"
& ./autogen.sh & ./autogen.sh
@ -60,7 +60,7 @@ function BuildInDir([string]$path) {
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/build.gradle" -pathType leaf) { } elseif (Test-Path "$path/build.gradle" -pathType leaf) {
"⏳ Building 📂$dirName using build.gradle..." "⏳ Building 📂$dirName by using Gradle..."
Set-Location "$path" Set-Location "$path"
& gradle build & gradle build
@ -69,8 +69,14 @@ function BuildInDir([string]$path) {
& gradle test & gradle test
if ($lastExitCode -ne "0") { throw "'gradle test' has failed" } if ($lastExitCode -ne "0") { throw "'gradle test' has failed" }
} elseif (Test-Path "$path/meson.build" -pathType leaf) {
"⏳ Building 📂$dirName by using Meson..."
Set-Location "$path"
& meson . build --prefix=/usr/local
if ($lastExitCode -ne "0") { throw "'meson . build' has failed" }
} elseif (Test-Path "$path/Imakefile" -pathType leaf) { } elseif (Test-Path "$path/Imakefile" -pathType leaf) {
"⏳ Building 📂$dirName using Imakefile..." "⏳ Building 📂$dirName by using Imakefile..."
Set-Location "$path/" Set-Location "$path/"
& xmkmf & xmkmf
@ -80,21 +86,21 @@ function BuildInDir([string]$path) {
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/Makefile" -pathType leaf) { } elseif (Test-Path "$path/Makefile" -pathType leaf) {
"⏳ Building 📂$dirName using Makefile..." "⏳ Building 📂$dirName by using Makefile..."
Set-Location "$path" Set-Location "$path"
& make -j4 & make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/makefile" -pathType leaf) { } elseif (Test-Path "$path/makefile" -pathType leaf) {
"⏳ Building 📂$dirName using makefile..." "⏳ Building 📂$dirName by using makefile..."
Set-Location "$path" Set-Location "$path"
& make -j4 & make -j4
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/compile.sh" -pathType leaf) { } elseif (Test-Path "$path/compile.sh" -pathType leaf) {
"⏳ Building 📂$dirName using 'compile.sh'..." "⏳ Building 📂$dirName by using 'compile.sh'..."
Set-Location "$path/" Set-Location "$path/"
& ./compile.sh & ./compile.sh
@ -104,7 +110,7 @@ function BuildInDir([string]$path) {
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" } if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
} elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) { } elseif (Test-Path "$path/attower/src/build/DevBuild/build.bat" -pathType leaf) {
"⏳ Building 📂$dirName using build.bat ..." "⏳ Building 📂$dirName by using build.bat ..."
Set-Location "$path/attower/src/build/DevBuild/" Set-Location "$path/attower/src/build/DevBuild/"
& ./build.bat build-all-release & ./build.bat build-all-release