mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-06-15 03:01:48 -07:00
Day 30 complete
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
if ( $CursorPosition ) {
|
||||
Clear-Host
|
||||
}
|
||||
Clear-Host
|
||||
|
||||
$target_arch = Join-Path $PSScriptRoot 'helpers/target_arch.psm1'
|
||||
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
|
||||
@ -8,13 +6,11 @@ $format_cpp = Join-Path $PSScriptRoot 'helpers/format_cpp.psm1'
|
||||
$config_toolchain = Join-Path $PSScriptRoot 'helpers/configure_toolchain.ps1'
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_build = Join-Path $path_root 'build'
|
||||
$path_build = Join-Path $path_root 'build'
|
||||
|
||||
Import-Module $target_arch
|
||||
Import-Module $format_cpp
|
||||
|
||||
Push-Location $path_root
|
||||
|
||||
#region Arguments
|
||||
$vendor = $null
|
||||
$optimize = $null
|
||||
@ -49,6 +45,8 @@ if ( $args ) { $args | ForEach-Object {
|
||||
. $config_toolchain
|
||||
|
||||
#region Building
|
||||
write-host "Building HandmadeHero with $vendor"
|
||||
|
||||
$path_project = Join-Path $path_root 'project'
|
||||
$path_data = Join-Path $path_root 'data'
|
||||
$path_binaries = Join-Path $path_data 'binaries'
|
||||
@ -140,7 +138,7 @@ function build-engine
|
||||
$unit = Join-Path $path_project 'handmade_engine.cpp'
|
||||
$dynamic_library = Join-Path $path_binaries 'handmade_engine.dll'
|
||||
|
||||
build-simple $includes $compiler_args $linker_args $unit $dynamic_library
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $dynamic_library
|
||||
|
||||
Remove-Item $path_pdb_lock -Force
|
||||
|
||||
@ -233,7 +231,7 @@ function build-engine
|
||||
$unit = Join-Path $path_codegen 'engine_postbuild_gen.cpp'
|
||||
$executable = Join-Path $path_build 'engine_postbuild_gen.exe'
|
||||
|
||||
build-simple $includes $compiler_args $linker_args $unit $executable
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
||||
|
||||
Push-Location $path_build
|
||||
$time_taken = Measure-Command {
|
||||
@ -279,7 +277,7 @@ function build-platform
|
||||
$unit = Join-Path $path_codegen 'platform_gen.cpp'
|
||||
$executable = Join-Path $path_build 'platform_gen.exe'
|
||||
|
||||
build-simple $includes $compiler_args $linker_args $unit $executable
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $executable $path_build
|
||||
|
||||
Push-Location $path_platform
|
||||
$time_taken = Measure-Command {
|
||||
@ -308,14 +306,14 @@ function build-platform
|
||||
|
||||
$lib_jsl,
|
||||
|
||||
$flag_link_win_subsystem_windows
|
||||
$flag_link_win_subsystem_windows,
|
||||
$flag_link_optimize_references
|
||||
)
|
||||
|
||||
$unit = Join-Path $path_project 'handmade_win32.cpp'
|
||||
$executable = Join-Path $path_binaries 'handmade_win32.exe'
|
||||
|
||||
build-simple $includes $compiler_args $linker_args $unit $executable
|
||||
build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
||||
|
||||
# if ( Test-Path $executable )
|
||||
# {
|
||||
|
Binary file not shown.
@ -7,11 +7,9 @@ if ($IsWindows) {
|
||||
|
||||
if ( $vendor -eq $null ) {
|
||||
write-host "No vendor specified, assuming clang available"
|
||||
$compiler = "clang"
|
||||
$vendor = "clang"
|
||||
}
|
||||
|
||||
write-host "Building HandmadeHero with $vendor"
|
||||
|
||||
if ( $dev ) {
|
||||
if ( $debug -eq $null ) {
|
||||
$debug = $true
|
||||
@ -133,6 +131,8 @@ if ( $vendor -match "clang" )
|
||||
$flag_set_stack_size = '-stack='
|
||||
$flag_syntax_only = '-fsyntax-only'
|
||||
$flag_target_arch = '-target'
|
||||
$flag_time_trace = '-ftime-trace'
|
||||
$flag_verbose = '-v'
|
||||
$flag_wall = '-Wall'
|
||||
$flag_warning = '-W'
|
||||
$flag_warnings_as_errors = '-Werror'
|
||||
@ -155,16 +155,15 @@ if ( $vendor -match "clang" )
|
||||
# 'libucrt',
|
||||
'libcmt' # For the C Runtime (Static Linkage)
|
||||
)
|
||||
|
||||
function build-simple
|
||||
{
|
||||
param( [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
param( [string]$path_output, [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
#Write-Host "build-simple: clang"
|
||||
|
||||
$object = $unit -replace '\.cpp', '.obj'
|
||||
$map = $unit -replace '\.cpp', '.map'
|
||||
$object = join-path $path_build (split-path $object -Leaf)
|
||||
$map = join-path $path_build (split-path $map -Leaf)
|
||||
$object = join-path $path_output (split-path $object -Leaf)
|
||||
$map = join-path $path_output (split-path $map -Leaf)
|
||||
|
||||
# The PDB file has to also be time-stamped so that we can reload the DLL at runtime
|
||||
$pdb = $binary -replace '\.(exe|dll)$', "_$(get-random).pdb"
|
||||
@ -174,11 +173,15 @@ if ( $vendor -match "clang" )
|
||||
$flag_exceptions_disabled,
|
||||
$flag_target_arch, $target_arch,
|
||||
$flag_wall,
|
||||
$flag_preprocess_on_intergrated,
|
||||
$flag_preprocess_non_intergrated,
|
||||
# $flag_section_data,
|
||||
# $flag_section_functions,
|
||||
( $flag_path_output + $object )
|
||||
)
|
||||
if ( $verbose ) {
|
||||
# $compiler_args += $flag_verbose
|
||||
# $compiler_args += $flag_time_trace
|
||||
}
|
||||
if ( $optimize ) {
|
||||
$compiler_args += $flag_optimize_fast
|
||||
}
|
||||
@ -278,13 +281,13 @@ if ( $vendor -match "msvc" )
|
||||
# This works because this project uses a single unit to build
|
||||
function build-simple
|
||||
{
|
||||
param( [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
param( [string]$path_output, [array]$includes, [array]$compiler_args, [array]$linker_args, [string]$unit, [string]$binary )
|
||||
#Write-Host "build-simple: msvc"
|
||||
|
||||
$object = $unit -replace '\.(cpp)$', '.obj'
|
||||
$map = $unit -replace '\.(cpp)$', '.map'
|
||||
$object = join-path $path_build (split-path $object -Leaf)
|
||||
$map = join-path $path_build (split-path $map -Leaf)
|
||||
$object = join-path $path_output (split-path $object -Leaf)
|
||||
$map = join-path $path_output (split-path $map -Leaf)
|
||||
|
||||
# The PDB file has to also be time-stamped so that we can reload the DLL at runtime
|
||||
$pdb = $binary -replace '\.(exe|dll)$', "_$(get-random).pdb"
|
||||
@ -297,10 +300,13 @@ if ( $vendor -match "msvc" )
|
||||
$flag_RTTI_disabled,
|
||||
$flag_preprocess_conform,
|
||||
$flag_full_src_path,
|
||||
( $flag_path_interm + $path_build + '\' ),
|
||||
( $flag_path_output + $path_build + '\' )
|
||||
( $flag_path_interm + $path_output + '\' ),
|
||||
( $flag_path_output + $path_output + '\' )
|
||||
)
|
||||
|
||||
if ( $verbose ) {
|
||||
}
|
||||
|
||||
if ( $optimize ) {
|
||||
$compiler_args += $flag_optimize_fast
|
||||
}
|
||||
@ -312,7 +318,7 @@ if ( $vendor -match "msvc" )
|
||||
{
|
||||
$compiler_args += $flag_debug
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=1' )
|
||||
$compiler_args += ( $flag_path_debug + $path_build + '\' )
|
||||
$compiler_args += ( $flag_path_debug + $path_output + '\' )
|
||||
$compiler_args += $flag_link_win_rt_static_debug
|
||||
|
||||
if ( $optimize ) {
|
||||
|
@ -8,7 +8,7 @@ function format-cpp
|
||||
Write-Host "Beginning format"
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:./scripts/.clang-format'
|
||||
'-style=file:.clang-format'
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user