Fixes to buildscript

This commit is contained in:
Edward R. Gonzalez 2023-08-20 13:18:09 -04:00
parent f574a9ba9a
commit 2f7836b191

View File

@ -2,11 +2,14 @@
# It will most likely need a partial rewrite to segment the build process into separate script invocations based on the OS. # It will most likely need a partial rewrite to segment the build process into separate script invocations based on the OS.
# That or just rewrite it in an sh script and call it a day. # That or just rewrite it in an sh script and call it a day.
Import-Module ./helpers/target_arch.psm1
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
cls cls
Import-Module ./helpers/target_arch.psm1
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
$path_root = git rev-parse --show-toplevel
Push-Location $path_root
#region Arguments #region Arguments
$vendor = $null $vendor = $null
$release = $null $release = $null
@ -37,20 +40,12 @@ if ($IsWindows) {
& $devshell -arch amd64 & $devshell -arch amd64
} }
$path_root = git rev-parse --show-toplevel
$path_build = Join-Path $path_root build
$path_project = Join-Path $path_root project
$path_scripts = Join-Path $path_root scripts
$path_singleheader = Join-Path $path_root singleheader
$path_test = Join-Path $path_root test
if ( $vendor -eq $null ) { if ( $vendor -eq $null ) {
write-host "No vendor specified, assuming clang available" write-host "No vendor specified, assuming clang available"
$compiler = "clang" $compiler = "clang"
} }
if ( $vendor -eq $null ) { if ( $release -eq $null ) {
write-host "No build type specified, assuming debug" write-host "No build type specified, assuming debug"
$release = $false $release = $false
} }
@ -62,8 +57,6 @@ if ( $bootstrap -eq $false -and $singleheader -eq $false -and $test -eq $false )
write-host "Building gencpp with $vendor" write-host "Building gencpp with $vendor"
write-host "Build Type: $(if ($release) {"Release"} else {"Debug"} )" write-host "Build Type: $(if ($release) {"Release"} else {"Debug"} )"
Push-Location $path_root
function run-compiler function run-compiler
{ {
param( $compiler, $unit, $compiler_args ) param( $compiler, $unit, $compiler_args )
@ -305,6 +298,13 @@ if ( $vendor -match "msvc" )
#endregion Configuration #endregion Configuration
#region Building #region Building
$path_build = Join-Path $path_root build
$path_project = Join-Path $path_root project
$path_scripts = Join-Path $path_root scripts
$path_singleheader = Join-Path $path_root singleheader
$path_test = Join-Path $path_root test
if ( $bootstrap ) if ( $bootstrap )
{ {
$path_build = join-path $path_project build $path_build = join-path $path_project build
@ -408,6 +408,7 @@ if ( $test )
#endregion Building #endregion Building
#region Formatting #region Formatting
function format-cpp function format-cpp
{ {
param( $path, $include, $exclude ) param( $path, $include, $exclude )
@ -420,7 +421,10 @@ function format-cpp
'-verbose' '-verbose'
) )
$targetFiles = @(Get-ChildItem -Recurse -Path $path -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName) $targetFiles = @(
Get-ChildItem -Recurse -Path $path -Include $include -Exclude $exclude
| Select-Object -ExpandProperty FullName
)
$time_taken = Measure-Command { $time_taken = Measure-Command {
clang-format $formatParams $targetFiles clang-format $formatParams $targetFiles