progress on unreal variant generator

This commit is contained in:
2024-10-25 03:00:07 -04:00
parent e5616c5879
commit 0542204b35
5 changed files with 342 additions and 2 deletions

View File

@ -22,6 +22,7 @@ Push-Location $path_root
$verbose = $false
[bool] $bootstrap = $false
[bool] $singleheader = $false
[bool] $unreal = $false
[bool] $test = $false
[array] $vendors = @( "clang", "msvc" )
@ -36,6 +37,7 @@ if ( $args ) { $args | ForEach-Object {
"debug" { $release = $false }
"bootstrap" { $bootstrap = $true }
"singleheader" { $singleheader = $true }
"unreal" { $unreal = $true }
"test" { $test = $true }
}
}}
@ -64,7 +66,7 @@ else {
$optimize = $true
}
if ( $bootstrap -eq $false -and $singleheader -eq $false -and $test -eq $false ) {
if ( $bootstrap -eq $false -and $singleheader -eq $false -and $unreal -eq $false -and $test -eq $false ) {
throw "No build target specified. One must be specified, this script will not assume one"
}
@ -80,6 +82,7 @@ $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_unreal = Join-Path $path_root unreal_engine
$path_test = Join-Path $path_root test
if ( $bootstrap )
@ -162,6 +165,44 @@ if ( $singleheader )
Pop-Location
}
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
}
$includes = @( $path_project )
$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
)
build-simple $path_build $includes $compiler_args $linker_args $unit $executable
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
}
if ( $test )
{
$path_gen = join-path $path_test gen
@ -229,7 +270,6 @@ push-location $path_scripts
if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) )
{
$path_gen = join-path $path_project gen
$path_comp_gen = join-path $path_project components/gen
$include = @(
'gen.hpp', 'gen.cpp',
'gen.dep.hpp', 'gen.dep.cpp',
@ -252,6 +292,19 @@ if ( $singleheader -and (Test-Path (Join-Path $path_singleheader "gen/gen.hpp"))
format-cpp $path_gen $include $exclude
}
if ( $unreal -and (Test-Path( Join-Path $path_unreal "gen/gen.hpp")) )
{
$path_gen = join-path $path_unreal gen
$include = @(
'gen.hpp', 'gen.cpp',
'gen.dep.hpp', 'gen.dep.cpp',
'gen.builder.hpp', 'gen.builder.cpp'
'gen.scanner.hpp', 'gen.scanner.cpp'
)
$exclude = $null
format-cpp $path_gen $include $exclude
}
if ( $test -and $false )
{
$path_gen = join-path $path_test gen

25
scripts/unreal.refactor Normal file
View File

@ -0,0 +1,25 @@
__VERSION 1
// This is a example template to be used with the refactor program
// Use it to refactor the naming convention of this library to your own.
// Can be used as an aid to help use use your project's implementation if it fullfills the dependencies of this project.
// Example: Most likely have a memory and string library already, just rename the functions and make sure the args are the same.
// Program: https://github.com/Ed94/refactor
// NOTE: Due to the current limitations of the program, not every symbol in the library can be renamed.
// This is due to the program not actually parsing C/C++.
// not : Ignore
// include : #includes
// word : Alphanumeric or underscore
// namespace : Prefix search and replace (c-namspaces).
// regex : Unavailable in __VERSION 1.
// Precedence (highest to lowest):
// word, namespace, regex
// Gen Macro namespace
// namespace GEN_, new_namespace_
word forceinline, FORCEINLINE
word spec_forceinline, spec_FORCEINLINE