mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2024-12-22 06:14:45 -08:00
Some minor cleanup to the build scripts
This commit is contained in:
parent
2a660da1d8
commit
dddf8a1653
@ -3,7 +3,9 @@ Clear-Host
|
|||||||
$target_arch = Join-Path $PSScriptRoot 'helpers/target_arch.psm1'
|
$target_arch = Join-Path $PSScriptRoot 'helpers/target_arch.psm1'
|
||||||
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
|
$devshell = Join-Path $PSScriptRoot 'helpers/devshell.ps1'
|
||||||
$format_cpp = Join-Path $PSScriptRoot 'helpers/format_cpp.psm1'
|
$format_cpp = Join-Path $PSScriptRoot 'helpers/format_cpp.psm1'
|
||||||
$config_toolchain = Join-Path $PSScriptRoot 'helpers/configure_toolchain.ps1'
|
$incremental_checks = Join-Path $PSScriptRoot 'helpers/incremental_checks.ps1'
|
||||||
|
$vendor_toolchain = Join-Path $PSScriptRoot 'helpers/vendor_toolchain.ps1'
|
||||||
|
$update_deps = Join-Path $PSScriptRoot 'update_deps.ps1'
|
||||||
|
|
||||||
$path_root = git rev-parse --show-toplevel
|
$path_root = git rev-parse --show-toplevel
|
||||||
$path_build = Join-Path $path_root 'build'
|
$path_build = Join-Path $path_root 'build'
|
||||||
@ -35,7 +37,7 @@ if ( $args ) { $args | ForEach-Object {
|
|||||||
"analysis" { $analysis = $true }
|
"analysis" { $analysis = $true }
|
||||||
"dev" { $dev = $true }
|
"dev" { $dev = $true }
|
||||||
"verbose" { $verbose = $true }
|
"verbose" { $verbose = $true }
|
||||||
"platform" { $platform = $true }
|
"platform" { $platform = $true; $module_specified = $true }
|
||||||
"engine" { $engine = $true; $module_specified = $true }
|
"engine" { $engine = $true; $module_specified = $true }
|
||||||
"game" { $game = $true; $module_specified = $true }
|
"game" { $game = $true; $module_specified = $true }
|
||||||
}
|
}
|
||||||
@ -50,79 +52,8 @@ if ( -not $module_specified )
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Load up toolchain configuraion
|
# Load up toolchain configuraion
|
||||||
. $config_toolchain
|
. $vendor_toolchain
|
||||||
|
. $incremental_checks
|
||||||
function check-FileForChanges
|
|
||||||
{
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory=$true)]
|
|
||||||
[string]$path_file
|
|
||||||
)
|
|
||||||
|
|
||||||
if (-not (Test-Path $path_file -PathType Leaf)) {
|
|
||||||
Write-Error "The provided path is not a valid file: $path_file"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
$file_name = Split-Path $path_file -Leaf
|
|
||||||
$path_csv = Join-Path $path_build ($file_name + "_file_hash.csv")
|
|
||||||
|
|
||||||
$csv_file_hash = $null
|
|
||||||
if (Test-Path $path_csv) {
|
|
||||||
$csv_file_hash = Import-Csv $path_csv | Select-Object -ExpandProperty value
|
|
||||||
}
|
|
||||||
|
|
||||||
$current_hash_info = Get-FileHash -Path $path_file -Algorithm MD5
|
|
||||||
$current_file_hash = $current_hash_info.Hash
|
|
||||||
|
|
||||||
# Save the current hash to the CSV
|
|
||||||
[PSCustomObject]@{
|
|
||||||
name = $path_file
|
|
||||||
value = $current_file_hash
|
|
||||||
} | Export-Csv $path_csv -NoTypeInformation
|
|
||||||
|
|
||||||
if ($csv_file_hash -and $csv_file_hash -eq $current_file_hash) {
|
|
||||||
return $false
|
|
||||||
} else {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check to see if the module has changed files since the last build
|
|
||||||
function check-ModuleForChanges
|
|
||||||
{
|
|
||||||
param( [string]$path_module, [array]$excludes )
|
|
||||||
|
|
||||||
$module_name = split-path $path_module -leaf
|
|
||||||
$path_csv = Join-Path $path_build ($module_name + "_module_hashes.csv")
|
|
||||||
|
|
||||||
$csv_file_hashes = $null
|
|
||||||
if ( test-path $path_csv ) {
|
|
||||||
$csv_file_hashes = @{}
|
|
||||||
import-csv $path_csv | foreach-object {
|
|
||||||
$csv_file_hashes[ $_.name ] = $_.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$file_hashes = @{}
|
|
||||||
get-childitem -path $path_module -recurse -file -Exclude $excludes | foreach-object {
|
|
||||||
$id = $_.fullname
|
|
||||||
$hash_info = get-filehash -path $id -Algorithm MD5
|
|
||||||
$file_hashes[ $id ] = $hash_info.Hash
|
|
||||||
}
|
|
||||||
|
|
||||||
$file_hashes.GetEnumerator() | foreach-object { [PSCustomObject]$_ } |
|
|
||||||
export-csv $path_csv -NoTypeInformation
|
|
||||||
|
|
||||||
if ( -not $csv_file_hashes ) { return $true }
|
|
||||||
if ( $csv_file_hashes.Count -ne $file_hashes.Count ) { return $true }
|
|
||||||
|
|
||||||
foreach ( $key in $csv_file_hashes.Keys ) {
|
|
||||||
if ( $csv_file_hashes[ $key ] -ne $file_hashes[ $key ] ) {
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Building
|
#region Building
|
||||||
write-host "Building HandmadeHero with $vendor"
|
write-host "Building HandmadeHero with $vendor"
|
||||||
@ -137,9 +68,6 @@ $path_platform = Join-Path $path_project 'platform'
|
|||||||
$path_engine = Join-Path $path_project 'engine'
|
$path_engine = Join-Path $path_project 'engine'
|
||||||
$path_engine_gen = Join-Path $path_engine 'gen'
|
$path_engine_gen = Join-Path $path_engine 'gen'
|
||||||
|
|
||||||
|
|
||||||
$update_deps = Join-Path $PSScriptRoot 'update_deps.ps1'
|
|
||||||
|
|
||||||
$handmade_process_active = Get-Process | Where-Object {$_.Name -like 'handmade_win32*'}
|
$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 ) {
|
||||||
@ -173,6 +101,7 @@ $stack_size = 1024 * 1024 * 4
|
|||||||
$compiler_args = @(
|
$compiler_args = @(
|
||||||
($flag_define + 'UNICODE'),
|
($flag_define + 'UNICODE'),
|
||||||
($flag_define + '_UNICODE')
|
($flag_define + '_UNICODE')
|
||||||
|
( $flag_define + 'INTELLISENSE_DIRECTIVES=0'),
|
||||||
# ($flag_set_stack_size + $stack_size)
|
# ($flag_set_stack_size + $stack_size)
|
||||||
$flag_wall
|
$flag_wall
|
||||||
$flag_warnings_as_errors
|
$flag_warnings_as_errors
|
||||||
|
73
scripts/helpers/incremental_checks.ps1
Normal file
73
scripts/helpers/incremental_checks.ps1
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# This is meant to be used with build.ps1, and is not a standalone script.
|
||||||
|
|
||||||
|
function check-FileForChanges
|
||||||
|
{
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$path_file
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (Test-Path $path_file -PathType Leaf)) {
|
||||||
|
Write-Error "The provided path is not a valid file: $path_file"
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
$file_name = Split-Path $path_file -Leaf
|
||||||
|
$path_csv = Join-Path $path_build ($file_name + "_file_hash.csv")
|
||||||
|
|
||||||
|
$csv_file_hash = $null
|
||||||
|
if (Test-Path $path_csv) {
|
||||||
|
$csv_file_hash = Import-Csv $path_csv | Select-Object -ExpandProperty value
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_hash_info = Get-FileHash -Path $path_file -Algorithm MD5
|
||||||
|
$current_file_hash = $current_hash_info.Hash
|
||||||
|
|
||||||
|
# Save the current hash to the CSV
|
||||||
|
[PSCustomObject]@{
|
||||||
|
name = $path_file
|
||||||
|
value = $current_file_hash
|
||||||
|
} | Export-Csv $path_csv -NoTypeInformation
|
||||||
|
|
||||||
|
if ($csv_file_hash -and $csv_file_hash -eq $current_file_hash) {
|
||||||
|
return $false
|
||||||
|
} else {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check to see if the module has changed files since the last build
|
||||||
|
function check-ModuleForChanges
|
||||||
|
{
|
||||||
|
param( [string]$path_module, [array]$excludes )
|
||||||
|
|
||||||
|
$module_name = split-path $path_module -leaf
|
||||||
|
$path_csv = Join-Path $path_build ($module_name + "_module_hashes.csv")
|
||||||
|
|
||||||
|
$csv_file_hashes = $null
|
||||||
|
if ( test-path $path_csv ) {
|
||||||
|
$csv_file_hashes = @{}
|
||||||
|
import-csv $path_csv | foreach-object {
|
||||||
|
$csv_file_hashes[ $_.name ] = $_.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_hashes = @{}
|
||||||
|
get-childitem -path $path_module -recurse -file -Exclude $excludes | foreach-object {
|
||||||
|
$id = $_.fullname
|
||||||
|
$hash_info = get-filehash -path $id -Algorithm MD5
|
||||||
|
$file_hashes[ $id ] = $hash_info.Hash
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_hashes.GetEnumerator() | foreach-object { [PSCustomObject]$_ } |
|
||||||
|
export-csv $path_csv -NoTypeInformation
|
||||||
|
|
||||||
|
if ( -not $csv_file_hashes ) { return $true }
|
||||||
|
if ( $csv_file_hashes.Count -ne $file_hashes.Count ) { return $true }
|
||||||
|
|
||||||
|
foreach ( $key in $csv_file_hashes.Keys ) {
|
||||||
|
if ( $csv_file_hashes[ $key ] -ne $file_hashes[ $key ] ) {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $false
|
||||||
|
}
|
@ -176,7 +176,6 @@ if ( $vendor -match "clang" )
|
|||||||
$pdb = $binary -replace '\.(exe|dll)$', "_$(get-random).pdb"
|
$pdb = $binary -replace '\.(exe|dll)$', "_$(get-random).pdb"
|
||||||
|
|
||||||
$compiler_args += @(
|
$compiler_args += @(
|
||||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0' ),
|
|
||||||
$flag_no_color_diagnostics,
|
$flag_no_color_diagnostics,
|
||||||
$flag_exceptions_disabled,
|
$flag_exceptions_disabled,
|
||||||
$flag_target_arch, $target_arch,
|
$flag_target_arch, $target_arch,
|
||||||
@ -230,12 +229,6 @@ if ( $vendor -match "clang" )
|
|||||||
|
|
||||||
$linker_args += $object
|
$linker_args += $object
|
||||||
return run-linker $linker $binary $linker_args
|
return run-linker $linker $binary $linker_args
|
||||||
|
|
||||||
# $compiler_args += $unit
|
|
||||||
# $linker_args | ForEach-Object {
|
|
||||||
# $compiler_args += $flag_linker + $_
|
|
||||||
# }
|
|
||||||
# run-compiler $compiler $unit $compiler_args
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiler = 'clang++'
|
$compiler = 'clang++'
|
||||||
@ -305,7 +298,6 @@ if ( $vendor -match "msvc" )
|
|||||||
|
|
||||||
$compiler_args += @(
|
$compiler_args += @(
|
||||||
$flag_nologo,
|
$flag_nologo,
|
||||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0'),
|
|
||||||
# $flag_all_cpp,
|
# $flag_all_cpp,
|
||||||
$flag_exceptions_disabled,
|
$flag_exceptions_disabled,
|
||||||
( $flag_define + '_HAS_EXCEPTIONS=0' ),
|
( $flag_define + '_HAS_EXCEPTIONS=0' ),
|
||||||
@ -364,11 +356,6 @@ if ( $vendor -match "msvc" )
|
|||||||
|
|
||||||
$linker_args += $object
|
$linker_args += $object
|
||||||
return run-linker $linker $binary $linker_args
|
return run-linker $linker $binary $linker_args
|
||||||
|
|
||||||
# $compiler_args += $unit
|
|
||||||
# $compiler_args += $flag_linker
|
|
||||||
# $compiler_args += $linker_args
|
|
||||||
# run-compiler $compiler $unit $compiler_args
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiler = 'cl'
|
$compiler = 'cl'
|
Loading…
Reference in New Issue
Block a user