aboutsummaryrefslogtreecommitdiff
path: root/src/server/build.odin
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-30 09:40:48 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-30 09:40:48 -0400
commit20087ade0a4c93b3fa236af1ad179ce8f959e3d1 (patch)
treeb3c50c8a1fa2ef9c12d9580ff605ba9aee43ce51 /src/server/build.odin
parent059ea9abcf1b7cd972da8e5fa395285d50e398cb (diff)
Add more names for comparison when checking whether to collect a file
Diffstat (limited to 'src/server/build.odin')
-rw-r--r--src/server/build.odin33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/server/build.odin b/src/server/build.odin
index df66be2..59dc63d 100644
--- a/src/server/build.odin
+++ b/src/server/build.odin
@@ -61,10 +61,13 @@ os_string_to_enum: map[string]runtime.Odin_OS_Type = {
"essence" = .Essence,
"Freebsd" = .FreeBSD,
"freebsd" = .FreeBSD,
+ "FreeBSD" = .FreeBSD,
"Wasi" = .WASI,
"wasi" = .WASI,
+ "WASI" = .WASI,
"Js" = .JS,
"js" = .JS,
+ "JS" = .JS,
"Freestanding" = .Freestanding,
"freestanding" = .Freestanding,
"Wasm" = .JS,
@@ -73,8 +76,10 @@ os_string_to_enum: map[string]runtime.Odin_OS_Type = {
"haiku" = .Haiku,
"Openbsd" = .OpenBSD,
"openbsd" = .OpenBSD,
+ "OpenBSD" = .OpenBSD,
"Netbsd" = .NetBSD,
"netbsd" = .NetBSD,
+ "NetBSD" = .NetBSD,
"Orca" = .Orca,
"orca" = .Orca,
"Unknown" = .Unknown,
@@ -127,17 +132,27 @@ should_collect_file :: proc(file_tags: parser.File_Tags) -> bool {
}
if len(file_tags.build) > 0 {
- 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
+ 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 !found {
- return false
- }
}
}
return true