mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-06-15 03:01:48 -07:00
Day 33 complete.
Man...
This commit is contained in:
@ -157,11 +157,11 @@ function build-engine
|
||||
$should_build = check-ModuleForChanges $path_engine
|
||||
if ( $should_build -eq $false ) {
|
||||
write-host "No changes detected in engine module, skipping build" -ForegroundColor Yellow
|
||||
return
|
||||
return $true
|
||||
}
|
||||
|
||||
$path_pdb_lock = Join-Path $path_binaries 'handmade_engine.pdb.lock'
|
||||
New-Item $path_pdb_lock -ItemType File -Force
|
||||
New-Item $path_pdb_lock -ItemType File -Force > $null
|
||||
|
||||
# Delete old PDBs
|
||||
[Array]$pdb_files = Get-ChildItem -Path $path_binaries -Filter "handmade_engine_*.pdb"
|
||||
@ -191,12 +191,17 @@ function build-engine
|
||||
$unit = Join-Path $path_project 'handmade_engine.cpp'
|
||||
$dynamic_library = Join-Path $path_binaries 'handmade_engine.dll'
|
||||
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $dynamic_library
|
||||
$build_result = build-simple $path_build $includes $compiler_args $linker_args $unit $dynamic_library
|
||||
|
||||
Remove-Item $path_pdb_lock -Force
|
||||
|
||||
if ( $build_result -eq $false ) {
|
||||
return $false
|
||||
}
|
||||
|
||||
#region CodeGen Post-Build
|
||||
if ( -not $handmade_process_active ) {
|
||||
if ( -not $handmade_process_active -and $build_result )
|
||||
{
|
||||
$path_engine_symbols = Join-Path $path_build 'handmade_engine.symbols'
|
||||
|
||||
# Create the symbol table
|
||||
@ -285,36 +290,45 @@ function build-engine
|
||||
$unit = Join-Path $path_codegen 'engine_postbuild_gen.cpp'
|
||||
$executable = Join-Path $path_build 'engine_postbuild_gen.exe'
|
||||
|
||||
build-simple $path_build $local:includes $compiler_args $linker_args $unit $executable
|
||||
|
||||
Push-Location $path_build
|
||||
$time_taken = Measure-Command {
|
||||
& $executable 2>&1 | ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
if ( build-simple $path_build $local:includes $compiler_args $linker_args $unit $executable )
|
||||
{
|
||||
Push-Location $path_build
|
||||
$time_taken = Measure-Command {
|
||||
& $executable 2>&1 | ForEach-Object {
|
||||
write-host `t $_ -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
}
|
||||
Pop-Location
|
||||
Pop-Location
|
||||
|
||||
$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
|
||||
$should_format_gen = $true
|
||||
$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
|
||||
$should_format_gen = $true
|
||||
|
||||
return $true
|
||||
}
|
||||
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if ( $engine ) {
|
||||
build-engine
|
||||
$build_result = build-engine
|
||||
if ( $build_result -eq $false ) {
|
||||
$path_csv = Join-Path $path_build 'engine_module_hashes.csv'
|
||||
Remove-Item $path_csv -Force
|
||||
}
|
||||
}
|
||||
|
||||
function build-platform
|
||||
{
|
||||
if ( $handmade_process_active ) {
|
||||
write-host "Handmade process is active, skipping platform build" -ForegroundColor Yellow
|
||||
return
|
||||
return $true
|
||||
}
|
||||
|
||||
$should_build = check-ModuleForChanges $path_platform
|
||||
if ( $should_build -eq $false ) {
|
||||
write-host "No changes detected in platform module, skipping build" -ForegroundColor Yellow
|
||||
return
|
||||
return $true
|
||||
}
|
||||
|
||||
# CodeGen Pre-Build
|
||||
@ -330,7 +344,7 @@ function build-platform
|
||||
$path_platform_gen = Join-Path $path_platform 'gen'
|
||||
|
||||
if ( -not (Test-Path $path_platform_gen) ) {
|
||||
New-Item $path_platform_gen -ItemType Directory
|
||||
New-Item $path_platform_gen -ItemType Directory > $null
|
||||
}
|
||||
|
||||
$local:includes = $script:includes
|
||||
@ -346,7 +360,10 @@ function build-platform
|
||||
$unit = Join-Path $path_codegen 'platform_gen.cpp'
|
||||
$executable = Join-Path $path_build 'platform_gen.exe'
|
||||
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $executable $path_build
|
||||
$build_result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable $path_build
|
||||
if ( $build_result -eq $false ) {
|
||||
return $false
|
||||
}
|
||||
|
||||
Push-Location $path_platform
|
||||
$time_taken = Measure-Command {
|
||||
@ -384,10 +401,15 @@ function build-platform
|
||||
$unit = Join-Path $path_project 'handmade_win32.cpp'
|
||||
$executable = Join-Path $path_binaries 'handmade_win32.exe'
|
||||
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
||||
return build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
||||
|
||||
}
|
||||
if ( $platform ) {
|
||||
build-platform
|
||||
$build_result = build-platform
|
||||
if ( -not $build_result ) {
|
||||
$path_csv = Join-Path $path_build 'platform_module_hashes.csv'
|
||||
Remove-Item $path_csv -Force
|
||||
}
|
||||
}
|
||||
|
||||
$path_jsl_dll = Join-Path $path_binaries 'JoyShockLibrary.dll'
|
||||
|
Binary file not shown.
@ -46,11 +46,13 @@ function run-compiler
|
||||
}
|
||||
}
|
||||
|
||||
if ( Test-Path($unit) ) {
|
||||
if ( $LASTEXITCODE -eq 0 ) {
|
||||
write-host "$unit compile finished in $($time_taken.TotalMilliseconds) ms`n"
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
write-host "Compile failed for $unit`n" -ForegroundColor Red
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +79,13 @@ function run-linker
|
||||
}
|
||||
}
|
||||
|
||||
if ( Test-Path($binary) ) {
|
||||
if ( $LASTEXITCODE -eq 0 ) {
|
||||
write-host "$binary linking finished in $($time_taken.TotalMilliseconds) ms`n"
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
write-host "Linking failed for $binary`n" -ForegroundColor Red
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,6 +164,7 @@ if ( $vendor -match "clang" )
|
||||
function build-simple
|
||||
{
|
||||
param( [string]$path_output, [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
$result = $false
|
||||
#Write-Host "build-simple: clang"
|
||||
|
||||
$object = $unit -replace '\.cpp', '.obj'
|
||||
@ -205,7 +210,9 @@ if ( $vendor -match "clang" )
|
||||
$compiler_args += $includes | ForEach-Object { $flag_include + $_ }
|
||||
|
||||
$compiler_args += $flag_compile, $unit
|
||||
run-compiler $compiler $unit $compiler_args
|
||||
if ( (run-compiler $compiler $unit $compiler_args) -eq $false ) {
|
||||
return $false
|
||||
}
|
||||
|
||||
$linker_args += @(
|
||||
$flag_link_win_machine_64,
|
||||
@ -222,7 +229,7 @@ if ( $vendor -match "clang" )
|
||||
}
|
||||
|
||||
$linker_args += $object
|
||||
run-linker $linker $binary $linker_args
|
||||
return run-linker $linker $binary $linker_args
|
||||
|
||||
# $compiler_args += $unit
|
||||
# $linker_args | ForEach-Object {
|
||||
@ -285,6 +292,7 @@ if ( $vendor -match "msvc" )
|
||||
function build-simple
|
||||
{
|
||||
param( [string]$path_output, [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
$result = $false
|
||||
#Write-Host "build-simple: msvc"
|
||||
|
||||
$object = $unit -replace '\.(cpp)$', '.obj'
|
||||
@ -336,7 +344,9 @@ if ( $vendor -match "msvc" )
|
||||
$compiler_args += $includes | ForEach-Object { $flag_include + $_ }
|
||||
|
||||
$compiler_args += $flag_compile, $unit
|
||||
run-compiler $compiler $unit $compiler_args
|
||||
if ( (run-compiler $compiler $unit $compiler_args) -eq $false ) {
|
||||
return $false;
|
||||
}
|
||||
|
||||
$linker_args += @(
|
||||
$flag_nologo,
|
||||
@ -353,7 +363,7 @@ if ( $vendor -match "msvc" )
|
||||
}
|
||||
|
||||
$linker_args += $object
|
||||
run-linker $linker $binary $linker_args
|
||||
return run-linker $linker $binary $linker_args
|
||||
|
||||
# $compiler_args += $unit
|
||||
# $compiler_args += $flag_linker
|
||||
|
Reference in New Issue
Block a user