Adjusted build staging so that engine post-build codgen wont occur when process is running

+ some refactoring as what I was doing didn't correlate to platform so I associate it with the engine module proper now.
This commit is contained in:
Edward R. Gonzalez 2023-09-28 21:21:05 -04:00
parent 2f6e60d472
commit a52f6efbff
7 changed files with 19 additions and 24 deletions

View File

@ -6,7 +6,7 @@
#include "dependencies/gen.hpp" #include "dependencies/gen.hpp"
using namespace gen; using namespace gen;
#include "platform/platform_engine_api.hpp" #include "engine/engine_to_platform_api.hpp"
constexpr StrC fname_handmade_engine_symbols = txt("handmade_engine.symbols"); constexpr StrC fname_handmade_engine_symbols = txt("handmade_engine.symbols");
String get_symbol_from_module_table( FileContents symbol_table, u32 symbol_ID ) String get_symbol_from_module_table( FileContents symbol_table, u32 symbol_ID )
@ -53,7 +53,7 @@ String get_symbol_from_module_table( FileContents symbol_table, u32 symbol_ID )
int gen_main() int gen_main()
{ {
gen::init(); gen::init();
log_fmt("Generating code for Handmade Hero: Platfom Module\n"); log_fmt("Generating code for Handmade Hero: Engine Module\n");
FileContents symbol_table = file_read_contents( GlobalAllocator, true, fname_handmade_engine_symbols ); FileContents symbol_table = file_read_contents( GlobalAllocator, true, fname_handmade_engine_symbols );
@ -61,7 +61,7 @@ int gen_main()
#undef str_ascii #undef str_ascii
Builder builder = Builder::open( "engine_symbol_table.hpp" ); Builder builder = Builder::open( "engine_symbol_table.hpp" );
builder.print( pragma_once ); builder.print( pragma_once );
builder.print( def_include( txt("platform/platform.hpp") ) ); builder.print( def_include( txt("engine/engine.hpp") ) );
builder.print( fmt_newline ); builder.print( fmt_newline );
builder.print_fmt( "NS_ENGINE_BEGIN\n\n" ); builder.print_fmt( "NS_ENGINE_BEGIN\n\n" );
@ -93,9 +93,8 @@ int gen_main()
builder.write(); builder.write();
#pragma pop_macro("str_ascii") #pragma pop_macro("str_ascii")
log_fmt("Generaton finished for Handmade Hero: Platform Module\n"); log_fmt("Generaton finished for Handmade Hero: Engine Module\n");
// gen::deinit(); // gen::deinit();
return 0; return 0;
} }
#endif #endif

View File

@ -3,19 +3,15 @@
#define GEN_IMPLEMENTATION #define GEN_IMPLEMENTATION
#define GEN_BENCHMARK #define GEN_BENCHMARK
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#include "gen.hpp" #include "dependencies/gen.hpp"
using namespace gen; using namespace gen;
int gen_main() int gen_main()
{ {
gen::init(); gen::init();
log_fmt("Generating code for Handmade Hero: Engine Module\n"); log_fmt("Generating code for Handmade Hero: Platform Module\n");
log_fmt("Generaton finished for Handmade Hero: Platform Module\n");
log_fmt("Generaton finished for Handmade Hero: Engine Module\n");
// gen::deinit(); // gen::deinit();
return 0; return 0;
} }
#endif #endif

View File

@ -1,6 +1,6 @@
//#include "win32.h" //#include "win32.h"
#include "engine.hpp" #include "engine.hpp"
#include "platform/platform_engine_api.hpp" #include "engine_to_platform_api.hpp"
#include "handmade.hpp" #include "handmade.hpp"
NS_ENGINE_BEGIN NS_ENGINE_BEGIN

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "platform/platform.hpp" #include "engine/engine.hpp"
NS_ENGINE_BEGIN NS_ENGINE_BEGIN

View File

@ -24,7 +24,7 @@
// Engine layer headers // Engine layer headers
#include "engine/engine.hpp" #include "engine/engine.hpp"
#include "platform_engine_api.hpp" #include "engine/engine_to_platform_api.hpp"
#include "gen/engine_symbol_table.hpp" #include "gen/engine_symbol_table.hpp"

View File

@ -404,6 +404,8 @@ $path_engine = Join-Path $path_project 'engine'
$update_deps = Join-Path $PSScriptRoot 'update_deps.ps1' $update_deps = Join-Path $PSScriptRoot 'update_deps.ps1'
$handmade_process_active = Get-Process | Where-Object {$_.Name -like 'handmade_win32*'}
if ( (Test-Path $path_build) -eq $false ) { if ( (Test-Path $path_build) -eq $false ) {
New-Item $path_build -ItemType Directory New-Item $path_build -ItemType Directory
} }
@ -554,13 +556,9 @@ if ( $engine )
} }
Remove-Item $path_pdb_lock -Force -Verbose Remove-Item $path_pdb_lock -Force -Verbose
}
if ( $platform )
{
#region CodeGen #region CodeGen
if ( $true ) { if ( $handmade_process_active -eq $null ) {
$engine_codegen_compiler_args = @() $engine_codegen_compiler_args = @()
$engine_codegen_compiler_args += ( $flag_define + 'GEN_TIME' ) $engine_codegen_compiler_args += ( $flag_define + 'GEN_TIME' )
@ -568,8 +566,8 @@ if ( $platform )
$flag_link_win_subsystem_console $flag_link_win_subsystem_console
) )
$unit = Join-Path $path_codegen 'handmade_platform_gen.cpp' $unit = Join-Path $path_codegen 'engine_postbuild_gen.cpp'
$executable = Join-Path $path_build 'handmade_platform_gen.exe' $executable = Join-Path $path_build 'engine_postbuild_gen.exe'
build-simple $includes $engine_codegen_compiler_args $engine_codegen_linker_args $unit $executable build-simple $includes $engine_codegen_compiler_args $engine_codegen_linker_args $unit $executable
write-host write-host
@ -577,13 +575,15 @@ if ( $platform )
Push-Location $path_build Push-Location $path_build
& $executable & $executable
Pop-Location Pop-Location
write-host
$path_generated_file = Join-Path $path_build 'engine_symbol_table.hpp' $path_generated_file = Join-Path $path_build 'engine_symbol_table.hpp'
move-item $path_generated_file (join-path $path_gen (split-path $path_generated_file -leaf)) -Force move-item $path_generated_file (join-path $path_gen (split-path $path_generated_file -leaf)) -Force
} }
#endregion CodeGen #endregion CodeGen
}
if ( $platform )
{
# Delete old PDBs # Delete old PDBs
$pdb_files = Get-ChildItem -Path $path_binaries -Filter "handmade_win32_*.pdb" $pdb_files = Get-ChildItem -Path $path_binaries -Filter "handmade_win32_*.pdb"
foreach ($file in $pdb_files) { foreach ($file in $pdb_files) {