2023-03-30 15:43:22 -07:00
|
|
|
if ($PSVersionTable.PSEdition -ne "Core")
|
|
|
|
{
|
|
|
|
$Host.UI.RawUI.CursorPosition = @{X=0; Y=0}
|
|
|
|
}
|
|
|
|
|
2023-03-13 17:17:12 -07:00
|
|
|
|
|
|
|
[string] $type = $null
|
|
|
|
[string] $test = $false
|
|
|
|
|
|
|
|
foreach ( $arg in $args )
|
|
|
|
{
|
|
|
|
if ( $arg -eq "test" )
|
|
|
|
{
|
|
|
|
$test = $true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$type = $arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Regular Build
|
2023-03-30 15:34:55 -07:00
|
|
|
|
2023-03-13 17:17:12 -07:00
|
|
|
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
|
|
|
|
|
|
|
|
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $type )
|
|
|
|
{
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "configure"
|
|
|
|
$args_meson += $path_build
|
|
|
|
$args_meson += "--buildtype $($type)"
|
|
|
|
|
|
|
|
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
|
|
|
}
|
|
|
|
|
|
|
|
$args_ninja = @()
|
|
|
|
$args_ninja += "-C"
|
|
|
|
$args_ninja += $path_build
|
|
|
|
|
|
|
|
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
2023-03-17 15:12:20 -07:00
|
|
|
#endregion Regular Build
|
2023-03-13 17:17:12 -07:00
|
|
|
|
|
|
|
|
2023-03-30 14:36:36 -07:00
|
|
|
if ( $test -eq $true )
|
2023-03-13 17:17:12 -07:00
|
|
|
{
|
2023-03-17 15:12:20 -07:00
|
|
|
#region Test Build
|
|
|
|
write-host "`n`nBuilding Test`n"
|
2023-03-13 17:17:12 -07:00
|
|
|
|
2023-03-17 15:12:20 -07:00
|
|
|
# Refactor thirdparty libraries
|
2023-03-30 15:50:45 -07:00
|
|
|
& (Join-Path $PSScriptRoot 'refactor_and_format.ps1')
|
2023-03-13 17:17:12 -07:00
|
|
|
|
2023-03-17 15:12:20 -07:00
|
|
|
$path_test = Join-Path $path_root test
|
|
|
|
$path_test_build = Join-Path $path_test build
|
2023-03-13 17:17:12 -07:00
|
|
|
|
2023-03-17 15:12:20 -07:00
|
|
|
if ( -not( Test-Path $path_test_build ) )
|
|
|
|
{
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "setup"
|
|
|
|
$args_meson += $path_test_build
|
2023-03-13 17:17:12 -07:00
|
|
|
|
2023-03-30 14:36:36 -07:00
|
|
|
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_test
|
2023-03-17 15:12:20 -07:00
|
|
|
}
|
2023-03-13 17:17:12 -07:00
|
|
|
|
2023-03-17 15:12:20 -07:00
|
|
|
$args_ninja = @()
|
|
|
|
$args_ninja += "-C"
|
2023-03-30 14:36:36 -07:00
|
|
|
$args_ninja += $path_test_build
|
2023-03-17 15:12:20 -07:00
|
|
|
|
|
|
|
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_test
|
|
|
|
#endregion Test Build
|
|
|
|
}
|