2023-03-30 16:43:44 -07:00
|
|
|
[string] $type = $null
|
|
|
|
[string] $test = $false
|
|
|
|
|
|
|
|
foreach ( $arg in $args )
|
|
|
|
{
|
|
|
|
if ( $arg -eq "test" )
|
|
|
|
{
|
|
|
|
$test = $true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$type = $arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Regular Build
|
|
|
|
|
|
|
|
write-host "Building project`n"
|
|
|
|
|
|
|
|
$path_root = git rev-parse --show-toplevel
|
|
|
|
$path_build = Join-Path $path_root build
|
|
|
|
$path_scripts = Join-Path $path_root scripts
|
|
|
|
|
|
|
|
|
|
|
|
if ( -not( Test-Path $path_build ) )
|
|
|
|
{
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "setup"
|
|
|
|
$args_meson += $path_build
|
|
|
|
|
2023-03-30 22:04:56 -07:00
|
|
|
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
|
|
|
Push-Location $path_scripts
|
2023-03-31 13:17:02 -07:00
|
|
|
Invoke-Expression "& meson $args_meson"
|
2023-03-30 22:04:56 -07:00
|
|
|
Pop-Location
|
2023-03-30 16:43:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $type )
|
|
|
|
{
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "configure"
|
|
|
|
$args_meson += $path_build
|
|
|
|
$args_meson += "--buildtype $($type)"
|
|
|
|
|
2023-03-30 22:04:56 -07:00
|
|
|
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
|
|
|
Push-Location $path_scripts
|
2023-03-31 13:17:02 -07:00
|
|
|
Invoke-Expression "& meson $args_meson"
|
2023-03-30 22:04:56 -07:00
|
|
|
Pop-Location
|
2023-03-30 16:43:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
$args_ninja = @()
|
|
|
|
$args_ninja += "-C"
|
|
|
|
$args_ninja += $path_build
|
|
|
|
|
2023-03-30 22:04:56 -07:00
|
|
|
Push-Location $path_root
|
|
|
|
ninja $args_ninja
|
|
|
|
Pop-Location
|
2023-03-30 16:43:44 -07:00
|
|
|
#endregion Regular Build
|
|
|
|
|
|
|
|
|
|
|
|
if ( $test -eq $true )
|
|
|
|
{
|
|
|
|
#region Test Build
|
|
|
|
write-host "`n`nBuilding Test`n"
|
|
|
|
|
|
|
|
# Refactor thirdparty libraries
|
2023-03-30 22:04:56 -07:00
|
|
|
Invoke-Expression "& $(Join-Path $PSScriptRoot 'refactor_and_format.ps1') $args"
|
|
|
|
|
2023-03-30 16:43:44 -07:00
|
|
|
|
|
|
|
$path_test = Join-Path $path_root test
|
|
|
|
$path_test_build = Join-Path $path_test build
|
|
|
|
|
|
|
|
if ( -not( Test-Path $path_test_build ) )
|
|
|
|
{
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "setup"
|
|
|
|
$args_meson += $path_test_build
|
|
|
|
|
2023-03-30 22:04:56 -07:00
|
|
|
Push-Location $path_test
|
|
|
|
& meson $args_meson
|
|
|
|
Pop-Location
|
2023-03-30 16:43:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
$args_ninja = @()
|
|
|
|
$args_ninja += "-C"
|
|
|
|
$args_ninja += $path_test_build
|
|
|
|
|
2023-03-30 22:04:56 -07:00
|
|
|
Push-Location $path_root
|
|
|
|
ninja $args_ninja
|
|
|
|
Pop-Location
|
2023-03-30 16:43:44 -07:00
|
|
|
#endregion Test Build
|
|
|
|
}
|