2023-07-24 15:51:49 -07:00
|
|
|
[string] $type = $null
|
|
|
|
[string] $test = $false
|
|
|
|
|
|
|
|
foreach ( $arg in $args )
|
|
|
|
{
|
|
|
|
if ( $arg -eq "test" )
|
|
|
|
{
|
|
|
|
$test = $true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$type = $arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$path_root = git rev-parse --show-toplevel
|
|
|
|
$path_singleheader = Join-Path $path_root singleheader
|
|
|
|
$path_singleheader_build = Join-Path $path_singleheader build
|
2023-07-24 20:10:10 -07:00
|
|
|
$path_singleheader_gen = Join-Path $path_singleheader gen
|
2023-07-24 15:51:49 -07:00
|
|
|
|
|
|
|
write-host "`n`nBuilding gencpp bootstrap`n"
|
|
|
|
|
|
|
|
if ( -not( Test-Path $path_singleheader_build) )
|
|
|
|
{
|
|
|
|
# Generate build files for meta-program
|
|
|
|
Push-Location $path_singleheader
|
|
|
|
$args_meson = @()
|
|
|
|
$args_meson += "setup"
|
|
|
|
$args_meson += $path_singleheader_build
|
|
|
|
|
|
|
|
& meson $args_meson
|
|
|
|
Pop-Location
|
|
|
|
}
|
|
|
|
|
|
|
|
# Compile meta-program
|
|
|
|
Push-Location $path_root
|
|
|
|
$args_ninja = @()
|
|
|
|
$args_ninja += "-C"
|
|
|
|
$args_ninja += $path_singleheader_build
|
|
|
|
|
|
|
|
& ninja $args_ninja
|
|
|
|
Pop-Location
|
2023-07-24 19:19:21 -07:00
|
|
|
|
|
|
|
Push-location $path_singleheader
|
2023-07-24 20:10:10 -07:00
|
|
|
if ( -not(Test-Path($path_singleheader_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_singleheader_gen
|
|
|
|
}
|
|
|
|
|
2023-07-24 19:19:21 -07:00
|
|
|
# Run meta-program
|
|
|
|
$gencpp_singleheader = Join-Path $path_singleheader_build gencpp_singleheader.exe
|
|
|
|
|
|
|
|
Write-Host `nRunning gencpp bootstrap...
|
|
|
|
& $gencpp_singleheader
|
|
|
|
|
|
|
|
# Format generated files
|
|
|
|
Write-Host `nBeginning format...
|
|
|
|
$formatParams = @(
|
|
|
|
'-i' # In-place
|
|
|
|
'-style=file:../scripts/.clang-format'
|
|
|
|
'-verbose'
|
|
|
|
)
|
|
|
|
|
|
|
|
$include = @('gencpp.hpp')
|
|
|
|
$exclude = $null
|
|
|
|
|
|
|
|
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
|
|
|
|
|
|
|
clang-format $formatParams $targetFiles
|
|
|
|
Write-Host "`nFormatting complete"
|
|
|
|
Pop-Location
|