aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-30 09:18:51 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-30 09:20:53 -0400
commit5def10f81d9bcd831ff7283902827e9b23cb2f36 (patch)
treefa334481c0742b8c80367e70bebaabb77b772103
parent6c704238989ebdadb65a7d309c676c40740e2865 (diff)
Infer used os better when collecting globals in a file
-rw-r--r--src/server/build.odin42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/server/build.odin b/src/server/build.odin
index a0ba276..df66be2 100644
--- a/src/server/build.odin
+++ b/src/server/build.odin
@@ -52,19 +52,33 @@ os_enum_to_string: [runtime.Odin_OS_Type]string = {
os_string_to_enum: map[string]runtime.Odin_OS_Type = {
"Windows" = .Windows,
+ "windows" = .Windows,
"Darwin" = .Darwin,
+ "darwin" = .Darwin,
"Linux" = .Linux,
+ "linux" = .Linux,
"Essence" = .Essence,
+ "essence" = .Essence,
"Freebsd" = .FreeBSD,
+ "freebsd" = .FreeBSD,
"Wasi" = .WASI,
+ "wasi" = .WASI,
"Js" = .JS,
+ "js" = .JS,
"Freestanding" = .Freestanding,
+ "freestanding" = .Freestanding,
"Wasm" = .JS,
+ "wasm" = .JS,
"Haiku" = .Haiku,
+ "haiku" = .Haiku,
"Openbsd" = .OpenBSD,
+ "openbsd" = .OpenBSD,
"Netbsd" = .NetBSD,
+ "netbsd" = .NetBSD,
"Orca" = .Orca,
+ "orca" = .Orca,
"Unknown" = .Unknown,
+ "unknown" = .Unknown,
}
@(private = "file")
@@ -113,27 +127,17 @@ should_collect_file :: proc(file_tags: parser.File_Tags) -> bool {
}
if len(file_tags.build) > 0 {
- when_expr_map := make(map[string]When_Expr, context.temp_allocator)
-
- for key, value in common.config.profile.defines {
- when_expr_map[key] = resolve_when_ident(when_expr_map, value) or_continue
- }
-
- if when_expr, ok := resolve_when_ident(when_expr_map, "ODIN_OS"); ok {
- if s, ok := when_expr.(string); ok {
- if used_os, ok := os_string_to_enum[when_expr.(string)]; ok {
- found := false
- for tag in file_tags.build {
- if used_os in tag.os {
- found = true
- break
- }
- }
- if !found {
- return false
- }
+ if used_os, ok := os_string_to_enum[common.config.profile.os]; ok {
+ found := false
+ for tag in file_tags.build {
+ if used_os in tag.os {
+ found = true
+ break
}
}
+ if !found {
+ return false
+ }
}
}
return true