2023-08-20 09:31:24 -07:00
|
|
|
# This build script was written to build on windows, however I did setup some generalization to allow for cross platform building.
|
|
|
|
# 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.
|
|
|
|
|
2023-10-23 22:40:21 -07:00
|
|
|
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
|
2024-12-10 13:38:01 -08:00
|
|
|
$misc = Join-Path $PSScriptRoot 'helpers/misc.psm1'
|
2024-10-25 02:01:37 -07:00
|
|
|
$refactor_unreal = Join-Path $PSScriptRoot 'refactor_unreal.ps1'
|
2023-10-23 22:40:21 -07:00
|
|
|
$incremental_checks = Join-Path $PSScriptRoot 'helpers/incremental_checks.ps1'
|
|
|
|
$vendor_toolchain = Join-Path $PSScriptRoot 'helpers/vendor_toolchain.ps1'
|
|
|
|
|
2024-12-10 13:38:01 -08:00
|
|
|
Import-Module $misc
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-10 13:38:01 -08:00
|
|
|
$path_root = Get-ScriptRepoRoot
|
2023-10-23 22:40:21 -07:00
|
|
|
|
2023-08-20 10:18:09 -07:00
|
|
|
Push-Location $path_root
|
2023-08-20 09:31:24 -07:00
|
|
|
|
|
|
|
#region Arguments
|
2023-08-20 10:02:50 -07:00
|
|
|
$vendor = $null
|
2023-08-20 09:31:24 -07:00
|
|
|
$release = $null
|
2024-12-13 19:09:43 -08:00
|
|
|
[bool] $verbose = $false
|
|
|
|
[bool] $base = $false
|
2024-12-10 18:59:13 -08:00
|
|
|
[bool] $segmented = $false
|
2023-08-20 09:31:24 -07:00
|
|
|
[bool] $singleheader = $false
|
2024-12-13 21:10:07 -08:00
|
|
|
[bool] $c_lib = $false
|
|
|
|
[bool] $c_lib_static = $false
|
|
|
|
[bool] $c_lib_dyn = $false
|
2024-10-25 00:00:07 -07:00
|
|
|
[bool] $unreal = $false
|
2023-08-20 09:31:24 -07:00
|
|
|
[bool] $test = $false
|
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
[array] $vendors = @( "clang", "msvc" )
|
2023-08-20 09:31:24 -07:00
|
|
|
|
|
|
|
# This is a really lazy way of parsing the args, could use actual params down the line...
|
|
|
|
|
|
|
|
if ( $args ) { $args | ForEach-Object {
|
|
|
|
switch ($_){
|
2023-10-24 00:14:20 -07:00
|
|
|
{ $_ -in $vendors } { $vendor = $_; break }
|
|
|
|
"verbose" { $verbose = $true }
|
2023-08-20 09:31:24 -07:00
|
|
|
"release" { $release = $true }
|
|
|
|
"debug" { $release = $false }
|
2024-12-10 17:45:00 -08:00
|
|
|
"base" { $base = $true }
|
2024-12-13 19:09:43 -08:00
|
|
|
"segmented" { $segmented = $true }
|
2023-08-20 09:31:24 -07:00
|
|
|
"singleheader" { $singleheader = $true }
|
2024-12-13 21:10:07 -08:00
|
|
|
"c_lib" { $c_lib = $true }
|
|
|
|
"c_lib_static" { $c_lib_static = $true }
|
|
|
|
"c_lib_dyn" { $c_lib_dyn = $true }
|
2024-10-25 00:00:07 -07:00
|
|
|
"unreal" { $unreal = $true }
|
2023-08-20 09:31:24 -07:00
|
|
|
"test" { $test = $true }
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
#endregion Arguments
|
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
#region Configuration
|
2023-08-20 09:31:24 -07:00
|
|
|
if ($IsWindows) {
|
|
|
|
# This library was really designed to only run on 64-bit systems.
|
|
|
|
# (Its a development tool after all)
|
|
|
|
& $devshell -arch amd64
|
|
|
|
}
|
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( $vendor -eq $null ) {
|
|
|
|
write-host "No vendor specified, assuming clang available"
|
2023-08-20 09:31:24 -07:00
|
|
|
$compiler = "clang"
|
|
|
|
}
|
|
|
|
|
2023-08-20 10:18:09 -07:00
|
|
|
if ( $release -eq $null ) {
|
2023-08-20 09:31:24 -07:00
|
|
|
write-host "No build type specified, assuming debug"
|
|
|
|
$release = $false
|
|
|
|
}
|
2023-10-24 21:25:35 -07:00
|
|
|
elseif ( $release -eq $false ) {
|
|
|
|
$debug = $true
|
|
|
|
}
|
|
|
|
else {
|
2023-10-25 20:55:29 -07:00
|
|
|
$optimize = $true
|
2023-10-24 21:25:35 -07:00
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-10 17:45:00 -08:00
|
|
|
$cannot_build = $base -eq $false
|
|
|
|
$cannot_build = $cannot_build -and $segmented -eq $false
|
|
|
|
$cannot_build = $cannot_build -and $singleheader -eq $false
|
2024-12-13 21:10:07 -08:00
|
|
|
$cannot_build = $cannot_build -and $c_lib -eq $false
|
|
|
|
$cannot_build = $cannot_build -and $c_lib_static -eq $false
|
|
|
|
$cannot_build = $cannot_build -and $c_lib_dyn -eq $false
|
2024-12-10 17:45:00 -08:00
|
|
|
$cannot_build = $cannot_build -and $unreal -eq $false
|
|
|
|
$cannot_build = $cannot_build -and $test -eq $false
|
|
|
|
if ( $cannot_build ) {
|
2023-08-20 09:31:24 -07:00
|
|
|
throw "No build target specified. One must be specified, this script will not assume one"
|
|
|
|
}
|
|
|
|
|
2023-10-23 22:40:21 -07:00
|
|
|
. $vendor_toolchain
|
|
|
|
. $incremental_checks
|
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
write-host "Building gencpp with $vendor"
|
2023-08-20 09:31:24 -07:00
|
|
|
write-host "Build Type: $(if ($release) {"Release"} else {"Debug"} )"
|
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
#region Building
|
2023-08-20 10:18:09 -07:00
|
|
|
$path_build = Join-Path $path_root build
|
2024-12-10 13:13:14 -08:00
|
|
|
$path_base = Join-Path $path_root base
|
2024-11-30 13:54:03 -08:00
|
|
|
$path_c_library = join-Path $path_root gen_c_library
|
2024-12-10 13:13:14 -08:00
|
|
|
$path_segmented = Join-Path $path_root gen_segmented
|
2024-11-30 13:54:03 -08:00
|
|
|
$path_singleheader = Join-Path $path_root gen_singleheader
|
|
|
|
$path_unreal = Join-Path $path_root gen_unreal_engine
|
2023-08-20 10:18:09 -07:00
|
|
|
$path_test = Join-Path $path_root test
|
2024-12-10 17:45:00 -08:00
|
|
|
$path_scripts = Join-Path $path_root scripts
|
2023-08-20 10:18:09 -07:00
|
|
|
|
2024-12-10 13:13:14 -08:00
|
|
|
if ( $base )
|
2023-08-20 10:02:50 -07:00
|
|
|
{
|
2024-12-10 13:13:14 -08:00
|
|
|
$path_build = join-path $path_base build
|
|
|
|
$path_comp = join-path $path_segmented 'components'
|
|
|
|
$path_comp_gen = join-path $path_comp 'gen'
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
2023-08-21 20:28:39 -07:00
|
|
|
if ( -not(Test-Path($path_comp_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_comp_gen
|
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-10-23 22:40:21 -07:00
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-10 18:35:46 -08:00
|
|
|
$includes = @( $path_base)
|
2024-12-10 13:13:14 -08:00
|
|
|
$unit = join-path $path_base "base.cpp"
|
|
|
|
$executable = join-path $path_build "base.exe"
|
|
|
|
|
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
|
|
|
|
2024-12-10 18:35:46 -08:00
|
|
|
Push-Location $path_base
|
2024-12-10 13:13:14 -08:00
|
|
|
if ( Test-Path( $executable ) ) {
|
2024-12-10 17:45:00 -08:00
|
|
|
write-host "`nRunning base"
|
2024-12-10 13:13:14 -08:00
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
|
|
|
}
|
|
|
|
}
|
2024-12-10 18:35:46 -08:00
|
|
|
write-host "`nbase completed in $($time_taken.TotalMilliseconds) ms"
|
2024-12-10 13:13:14 -08:00
|
|
|
}
|
|
|
|
Pop-Location
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $segmented )
|
|
|
|
{
|
|
|
|
$path_build = join-path $path_segmented build
|
|
|
|
$path_gen = join-path $path_segmented gen
|
|
|
|
|
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
|
|
|
|
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-10 18:59:13 -08:00
|
|
|
$includes = @( $path_base)
|
2024-12-10 13:13:14 -08:00
|
|
|
$unit = join-path $path_segmented "segmented.cpp"
|
|
|
|
$executable = join-path $path_build "segmented.exe"
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-05 18:01:04 -08:00
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-10 18:59:13 -08:00
|
|
|
Push-Location $path_segmented
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( Test-Path( $executable ) ) {
|
2024-12-10 17:45:00 -08:00
|
|
|
write-host "`nRunning segmented"
|
2023-08-20 10:02:50 -07:00
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
2023-08-20 09:31:24 -07:00
|
|
|
}
|
2023-08-20 10:02:50 -07:00
|
|
|
}
|
|
|
|
write-host "`nBootstrap completed in $($time_taken.TotalMilliseconds) ms"
|
|
|
|
}
|
|
|
|
Pop-Location
|
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( $singleheader )
|
|
|
|
{
|
|
|
|
$path_build = join-path $path_singleheader build
|
|
|
|
$path_gen = join-path $path_singleheader gen
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-10 19:20:40 -08:00
|
|
|
$includes = @( $path_base )
|
2023-08-20 10:02:50 -07:00
|
|
|
$unit = join-path $path_singleheader "singleheader.cpp"
|
|
|
|
$executable = join-path $path_build "singleheader.exe"
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-10-23 22:40:21 -07:00
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-05 18:01:04 -08:00
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-08-20 10:02:50 -07:00
|
|
|
Push-Location $path_singleheader
|
2023-08-20 12:45:06 -07:00
|
|
|
if ( Test-Path( $executable ) ) {
|
2023-08-20 10:02:50 -07:00
|
|
|
write-host "`nRunning singleheader generator"
|
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
2023-08-20 09:31:24 -07:00
|
|
|
}
|
2023-08-20 10:02:50 -07:00
|
|
|
}
|
|
|
|
write-host "`nSingleheader generator completed in $($time_taken.TotalMilliseconds) ms"
|
|
|
|
}
|
|
|
|
Pop-Location
|
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-13 21:10:07 -08:00
|
|
|
if ( $c_lib -or $c_lib_static -or $c_lib_dyn )
|
2024-11-30 13:54:03 -08:00
|
|
|
{
|
2024-11-30 15:54:19 -08:00
|
|
|
$path_build = join-path $path_c_library build
|
|
|
|
$path_gen = join-path $path_c_library gen
|
2024-11-30 13:54:03 -08:00
|
|
|
|
2024-11-30 15:54:19 -08:00
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
|
|
|
|
2024-12-10 20:35:47 -08:00
|
|
|
$includes = @( $path_base )
|
2024-11-30 15:54:19 -08:00
|
|
|
$unit = join-path $path_c_library "c_library.cpp"
|
|
|
|
$executable = join-path $path_build "c_library.exe"
|
|
|
|
|
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-05 18:01:04 -08:00
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
2024-11-30 15:54:19 -08:00
|
|
|
|
2024-11-30 20:38:27 -08:00
|
|
|
Push-Location $path_c_library
|
2024-11-30 15:54:19 -08:00
|
|
|
if ( Test-Path( $executable ) ) {
|
|
|
|
write-host "`nRunning c_library generator"
|
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
|
|
|
}
|
|
|
|
}
|
|
|
|
write-host "`nc_library generator completed in $($time_taken.TotalMilliseconds) ms"
|
|
|
|
}
|
|
|
|
Pop-Location
|
2024-12-13 21:10:07 -08:00
|
|
|
}
|
2024-12-01 15:50:37 -08:00
|
|
|
|
2024-12-13 21:10:07 -08:00
|
|
|
if ( $c_lib_static )
|
|
|
|
{
|
|
|
|
$includes = @( $path_c_library )
|
|
|
|
$unit = join-path $path_c_library "gen_c_lib.c"
|
|
|
|
$path_lib = join-path $path_build "gencpp_c11.lib"
|
2024-12-01 15:50:37 -08:00
|
|
|
|
2024-12-13 21:10:07 -08:00
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += $flag_all_c
|
|
|
|
$compiler_args += $flag_updated_cpp_macro
|
|
|
|
$compiler_args += $flag_c11
|
2024-12-01 15:50:37 -08:00
|
|
|
|
2024-12-13 21:10:07 -08:00
|
|
|
$linker_args = @()
|
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $path_lib
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $c_lib_dyn )
|
|
|
|
{
|
|
|
|
$includes = @( $path_c_library )
|
|
|
|
$unit = join-path $path_c_library "gen_c_lib.c"
|
|
|
|
$path_dll = join-path $path_build "gencpp_c11.dll"
|
|
|
|
|
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += $flag_all_c
|
|
|
|
$compiler_args += $flag_updated_cpp_macro
|
|
|
|
$compiler_args += $flag_c11
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_DYN_LINK' )
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_DYN_EXPORT' )
|
|
|
|
|
|
|
|
$linker_args = @()
|
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $path_dll
|
2024-11-30 13:54:03 -08:00
|
|
|
}
|
|
|
|
|
2024-10-25 00:00:07 -07:00
|
|
|
if ( $unreal )
|
|
|
|
{
|
|
|
|
$path_build = join-path $path_unreal build
|
|
|
|
$path_gen = join-path $path_unreal gen
|
|
|
|
|
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
|
|
|
|
2024-12-10 20:35:47 -08:00
|
|
|
$includes = @( $path_base )
|
2024-10-25 00:00:07 -07:00
|
|
|
$unit = join-path $path_unreal "unreal.cpp"
|
|
|
|
$executable = join-path $path_build "unreal.exe"
|
|
|
|
|
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-05 18:01:04 -08:00
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
2024-10-25 00:00:07 -07:00
|
|
|
|
|
|
|
Push-Location $path_unreal
|
|
|
|
if ( Test-Path( $executable ) ) {
|
|
|
|
write-host "`nRunning unreal variant generator"
|
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
|
|
|
}
|
|
|
|
}
|
|
|
|
write-host "`n Unreal variant generator completed in $($time_taken.TotalMilliseconds) ms"
|
|
|
|
}
|
|
|
|
Pop-Location
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
. $refactor_unreal
|
2024-10-25 00:00:07 -07:00
|
|
|
}
|
|
|
|
|
2024-12-15 19:53:32 -08:00
|
|
|
# C Library testing
|
2024-12-15 20:02:32 -08:00
|
|
|
if ( $test -and $false )
|
2023-08-20 10:02:50 -07:00
|
|
|
{
|
2024-12-15 19:53:32 -08:00
|
|
|
$path_test_c = join-path $path_test c_library
|
|
|
|
$path_build = join-path $path_test_c build
|
|
|
|
$path_gen = join-path $path_test_c gen
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
2024-12-15 19:53:32 -08:00
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-15 19:53:32 -08:00
|
|
|
$path_singleheader_include = join-path $path_c_library gen
|
|
|
|
$includes = @( $path_singleheader_include )
|
|
|
|
$unit = join-path $path_test_c "test.c"
|
|
|
|
$executable = join-path $path_build "test.exe"
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2023-10-23 22:40:21 -07:00
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
2024-12-13 21:10:07 -08:00
|
|
|
$compiler_args += $flag_all_c
|
|
|
|
$compiler_args += $flag_updated_cpp_macro
|
|
|
|
$compiler_args += $flag_c11
|
2023-10-23 22:40:21 -07:00
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
2024-12-05 18:01:04 -08:00
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
2023-08-20 09:31:24 -07:00
|
|
|
|
2024-12-15 19:53:32 -08:00
|
|
|
Push-Location $path_test_c
|
|
|
|
if ( Test-Path( $executable ) ) {
|
|
|
|
write-host "`nRunning c_library test"
|
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
|
|
|
}
|
|
|
|
}
|
|
|
|
write-host "`nc_library generator completed in $($time_taken.TotalMilliseconds) ms"
|
|
|
|
}
|
|
|
|
Pop-Location
|
|
|
|
}
|
|
|
|
|
2024-12-15 20:02:32 -08:00
|
|
|
if ($test -and $true)
|
2024-12-15 19:53:32 -08:00
|
|
|
{
|
|
|
|
$path_test_cpp = join-path $path_test cpp_library
|
|
|
|
$path_build = join-path $path_test_cpp build
|
|
|
|
$path_gen = join-path $path_test_cpp gen
|
|
|
|
if ( -not(Test-Path($path_build) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_build
|
|
|
|
}
|
|
|
|
if ( -not(Test-Path($path_gen) )) {
|
|
|
|
New-Item -ItemType Directory -Path $path_gen
|
|
|
|
}
|
|
|
|
|
|
|
|
$path_singleheader_include = join-path $path_singleheader gen
|
|
|
|
$includes = @( $path_singleheader_include )
|
|
|
|
$unit = join-path $path_test_cpp "test.cpp"
|
|
|
|
$executable = join-path $path_build "test.exe"
|
|
|
|
|
|
|
|
$compiler_args = @()
|
|
|
|
$compiler_args += ( $flag_define + 'GEN_TIME' )
|
|
|
|
|
|
|
|
$linker_args = @(
|
|
|
|
$flag_link_win_subsystem_console
|
|
|
|
)
|
|
|
|
|
|
|
|
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
|
|
|
|
|
|
|
Push-Location $path_test_cpp
|
2023-08-20 10:02:50 -07:00
|
|
|
if ( Test-Path( $executable ) ) {
|
2024-12-13 21:10:07 -08:00
|
|
|
write-host "`nRunning c_library test"
|
2023-08-20 10:02:50 -07:00
|
|
|
$time_taken = Measure-Command { & $executable
|
|
|
|
| ForEach-Object {
|
|
|
|
write-host `t $_ -ForegroundColor Green
|
2023-08-20 09:31:24 -07:00
|
|
|
}
|
2023-08-20 10:02:50 -07:00
|
|
|
}
|
2024-12-13 21:10:07 -08:00
|
|
|
write-host "`nc_library generator completed in $($time_taken.TotalMilliseconds) ms"
|
2023-08-20 10:02:50 -07:00
|
|
|
}
|
|
|
|
Pop-Location
|
2023-08-20 09:31:24 -07:00
|
|
|
}
|
|
|
|
#endregion Building
|
|
|
|
|
|
|
|
Pop-Location # $path_root
|