setup proper incremental build of build.odin.odin script

This commit is contained in:
2025-06-22 11:55:52 -04:00
parent 4235ac8b33
commit ecc00b000b
3 changed files with 45 additions and 16 deletions

View File

@@ -27,6 +27,10 @@ indent_size = 2
indent_style = tab indent_style = tab
indent_size = 2 indent_size = 2
[*.odin]
indent_style = tab
indent_size = 2
[*.ps1] [*.ps1]
indent_style = tab indent_style = tab
indent_size = 4 indent_size = 4

View File

@@ -6,6 +6,11 @@ Toolchain: odin-lang/Odin dev-2025-06
*/ */
package odin package odin
main :: proc()
{
}
import "base:builtin" import "base:builtin"
import "base:intrinsics" import "base:intrinsics"
@@ -103,29 +108,42 @@ sll_stack_push_n :: proc(first: ^$SLL_NodeType, n: ^SLL_NodeType) {
first^ = n first^ = n
} }
sll_queue_push_nz :: proc(nil_val: ^$SLL_NodeType, first: ^SLL_NodeType, last: ^SLL_NodeType, n: ^SLL_NodeType) { sll_queue_push_nz :: proc(nil_val: ^$SLL_NodeType, first: ^SLL_NodeType, last: ^SLL_NodeType, n: ^SLL_NodeType) {
if first^ == nil_val { if first^ == nil_val {
first^ = n first^ = n
last^ = n last^ = n
n.next = nil_val n.next = nil_val
} else { } else {
last^.next = n last^.next = n
last^ = n last^ = n
n.next = nil_val n.next = nil_val
} }
} }
sll_queue_push_n :: proc(first: ^$SLL_NodeType, last: ^SLL_NodeType, n: ^SLL_NodeType) { sll_queue_push_n :: proc(first: ^$SLL_NodeType, last: ^SLL_NodeType, n: ^SLL_NodeType) {
sll_queue_push_nz(nil, first, last, n) sll_queue_push_nz(nil, first, last, n)
} }
//#endregion("Memory") //#endregion("Memory")
//#region Allocator Interface
AllocatorOp :: enum u32 {
Alloc_NoZero = 0, // If Alloc exist, so must No_Zero
Alloc,
Free,
Reset,
Grow_NoZero,
Grow,
Shrink,
Rewind,
SavePoint,
Query, // Must always be implemented
}
AllocatorQueryFlag :: enum u64 {
}
//#endregion Allocator Interface
//#region("Strings") //#region("Strings")
Raw_String :: struct { Raw_String :: struct {
data: [^]byte, data: [^]byte,
len: int, len: int,
} }
//#endregion("Strings") //#endregion("Strings")
main :: proc()
{
}

View File

@@ -23,6 +23,13 @@ $flag_optimize_none = '-o:none'
$flag_output_path = '-out=' $flag_output_path = '-out='
$flag_default_allocator_nil = '-default-to-nil-allocator' $flag_default_allocator_nil = '-default-to-nil-allocator'
$need_rebuild = $false
if (-not (test-path $exe)) { $need_rebuild = $true }
else {
$source_hash = (get-filehash $path_source -algorithm MD5).Hash
$exe_hash = (get-filehash $exe -algorithm MD5).Hash
if ($exe_hash -ne $source_hash) { $need_rebuild = $true }
}
push-location $path_root push-location $path_root
$build_args = @() $build_args = @()
$build_args += $command_build $build_args += $command_build
@@ -36,6 +43,6 @@ $build_args += $flag_no_type_assert
$build_args += $flag_dyn_map_calls $build_args += $flag_dyn_map_calls
$build_args += $flag_default_allocator_nil $build_args += $flag_default_allocator_nil
$build_args += $flag_output_path + $exe $build_args += $flag_output_path + $exe
# & $odin $build_args if ($need_rebuild) { & $odin $build_args }
& $exe
pop-location pop-location
& $exe