2024-01-21 08:16:12 -08:00
|
|
|
cls
|
|
|
|
|
2024-01-22 18:38:09 -08:00
|
|
|
$incremental_checks = Join-Path $PSScriptRoot 'helpers/incremental_checks.ps1'
|
|
|
|
. $incremental_checks
|
|
|
|
|
2024-01-21 21:22:06 -08:00
|
|
|
$path_root = git rev-parse --show-toplevel
|
2024-01-22 18:38:09 -08:00
|
|
|
$path_code = join-path $path_root 'code'
|
|
|
|
$path_build = join-path $path_root 'build'
|
|
|
|
$path_scripts = join-path $path_root 'scripts'
|
|
|
|
$path_thirdparty = join-path $path_root 'thirdparty'
|
|
|
|
$path_odin = join-path $path_thirdparty 'odin'
|
2024-01-21 08:16:12 -08:00
|
|
|
|
|
|
|
# Odin Compiler Flags
|
|
|
|
|
|
|
|
$flag_build = 'build'
|
|
|
|
$flag_run = 'run'
|
|
|
|
$flag_check = 'check'
|
|
|
|
$flag_query = 'query'
|
|
|
|
$flag_report = 'report'
|
|
|
|
$flag_debug = '-debug'
|
|
|
|
$flag_output_path = '-out='
|
|
|
|
$flag_optimization_level = '-opt:'
|
|
|
|
$flag_optimize_none = '-o:none'
|
|
|
|
$flag_optimize_minimal = '-o:minimal'
|
|
|
|
$flag_optimize_size = '-o:size'
|
|
|
|
$flag_optimize_speed = '-o:speed'
|
|
|
|
$falg_optimize_aggressive = '-o:aggressive'
|
|
|
|
$flag_show_timings = '-show-timings'
|
|
|
|
$flag_show_more_timings = '-show-more-timings'
|
|
|
|
$flag_thread_count = '-thread-count:'
|
|
|
|
$flag_collection = '-collection:'
|
|
|
|
$flag_build_mode = '-build-mode:'
|
2024-01-21 20:38:02 -08:00
|
|
|
$flag_build_mode_dll = '-build-mode:dll'
|
2024-01-21 08:16:12 -08:00
|
|
|
$flag_no_bounds_check = '-no-bounds-check'
|
|
|
|
$flag_disable_assert = '-disable-assert'
|
|
|
|
$flag_no_thread_local = '-no-thread-local'
|
|
|
|
$flag_no_thread_checker = '-no-thread-checker'
|
|
|
|
$flag_vet_all = '-vet'
|
|
|
|
$flag_vet_unused_entities = '-vet-unused'
|
|
|
|
$flag_vet_semicolon = '-vet-semicolon'
|
|
|
|
$flag_vet_shadow_vars = '-vet-shadowing'
|
|
|
|
$flag_vet_using_stmt = '-vet-using-stmt'
|
|
|
|
$flag_use_separate_modules = '-use-separate-modules'
|
|
|
|
$flag_define = '-define:'
|
|
|
|
|
|
|
|
$flag_extra_assembler_flags = '-extra_assembler-flags:'
|
|
|
|
$flag_extra_linker_flags = '-extra-linker-flags:'
|
|
|
|
$flag_ignore_unknown_attributes = '-ignore-unknown-attributes'
|
|
|
|
$flag_keep_temp_files = '-keep-temp-files'
|
|
|
|
$flag_no_crt = '-no-crt'
|
|
|
|
$flag_no_entrypoint = '-no-entry-point'
|
|
|
|
$flag_pdb_name = '-pdb-name:'
|
|
|
|
$flag_sanitize = '-sanitize:'
|
|
|
|
$flag_subsystem = '-subsystem:'
|
|
|
|
$flag_target = '-target:'
|
|
|
|
$flag_use_lld = '-lld'
|
|
|
|
|
|
|
|
push-location $path_root
|
|
|
|
|
2024-01-22 18:38:09 -08:00
|
|
|
$update_deps = join-path $path_scripts 'update_deps.ps1'
|
|
|
|
$odin = join-path $path_odin 'odin.exe'
|
2024-01-21 08:16:12 -08:00
|
|
|
if ( -not( test-path 'build') ) {
|
|
|
|
new-item -ItemType Directory -Path 'build'
|
|
|
|
}
|
2024-01-22 18:38:09 -08:00
|
|
|
|
2024-01-21 08:16:12 -08:00
|
|
|
function build-prototype
|
|
|
|
{
|
|
|
|
push-location $path_code
|
|
|
|
$project_name = 'sectr'
|
|
|
|
|
2024-01-25 07:49:57 -08:00
|
|
|
write-host "`nBuilding Sectr Prototype"
|
|
|
|
|
2024-02-12 17:52:56 -08:00
|
|
|
$module_host = join-path $path_code 'host'
|
|
|
|
$module_sectr = $path_code
|
|
|
|
|
2024-02-13 23:27:21 -08:00
|
|
|
& $update_deps
|
|
|
|
|
|
|
|
function build-sectr
|
|
|
|
{
|
|
|
|
$should_build = check-ModuleForChanges $module_sectr
|
|
|
|
if ( -not( $should_build)) {
|
|
|
|
write-host 'Skipping sectr build, module up to date'
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
$module_dll = join-path $path_build ( $project_name + '.dll' )
|
|
|
|
$pdb = join-path $path_build ( $project_name + '.pdb' )
|
|
|
|
|
|
|
|
$build_args = @()
|
|
|
|
$build_args += $flag_build
|
|
|
|
$build_args += '.'
|
|
|
|
$build_args += $flag_build_mode_dll
|
|
|
|
$build_args += $flag_output_path + $module_dll
|
|
|
|
$build_args += $flag_optimize_none
|
|
|
|
$build_args += $flag_debug
|
|
|
|
$build_args += $flag_pdb_name + $pdb
|
|
|
|
|
|
|
|
write-host 'Building Sectr Module'
|
|
|
|
& $odin $build_args
|
|
|
|
}
|
|
|
|
build-sectr
|
|
|
|
|
2024-01-25 07:49:57 -08:00
|
|
|
function build-host
|
|
|
|
{
|
|
|
|
$executable = join-path $path_build ($project_name + '_host.exe')
|
|
|
|
$pdb = join-path $path_build ($project_name + '_host.pdb')
|
|
|
|
|
|
|
|
$host_process_active = Get-Process | Where-Object {$_.Name -like 'sectr_host*'}
|
|
|
|
if ( $host_process_active ) {
|
|
|
|
write-host 'Skipping sectr_host build, process is active'
|
|
|
|
return
|
|
|
|
}
|
2024-01-25 08:24:52 -08:00
|
|
|
|
2024-02-12 17:52:56 -08:00
|
|
|
$should_build = (check-ModuleForChanges $module_host)
|
2024-01-25 07:49:57 -08:00
|
|
|
if ( -not( $should_build)) {
|
|
|
|
write-host 'Skipping sectr_host build, module up to date'
|
|
|
|
return
|
|
|
|
}
|
2024-01-22 18:38:09 -08:00
|
|
|
|
2024-01-22 00:47:53 -08:00
|
|
|
$build_args = @()
|
|
|
|
$build_args += $flag_build
|
|
|
|
$build_args += './host'
|
|
|
|
$build_args += $flag_output_path + $executable
|
|
|
|
$build_args += $flag_optimize_none
|
|
|
|
$build_args += $flag_debug
|
|
|
|
$build_args += $flag_pdb_name + $pdb
|
|
|
|
$build_args += $flag_subsystem + 'windows'
|
2024-01-21 08:16:12 -08:00
|
|
|
|
2024-01-22 18:38:09 -08:00
|
|
|
write-host 'Building Host Module'
|
|
|
|
& $odin $build_args
|
2024-01-22 00:47:53 -08:00
|
|
|
}
|
2024-01-25 07:49:57 -08:00
|
|
|
build-host
|
|
|
|
|
2024-01-21 08:16:12 -08:00
|
|
|
Pop-Location
|
|
|
|
}
|
|
|
|
build-prototype
|
|
|
|
pop-location
|