use #exists to provide good errors for common missing libraries

This commit is contained in:
Laytan Laats
2024-06-04 20:13:51 +02:00
parent b47a15733d
commit 3e159736cd
24 changed files with 143 additions and 110 deletions
+17 -4
View File
@@ -4,10 +4,23 @@ import "core:c"
#assert(size_of(b32) == size_of(c.int))
when ODIN_OS == .Windows { foreign import lib "../lib/stb_rect_pack.lib" }
else when ODIN_OS == .Linux { foreign import lib "../lib/stb_rect_pack.a" }
else when ODIN_OS == .Darwin { foreign import lib "../lib/darwin/stb_rect_pack.a" }
else { foreign import lib "system:stb_rect_pack" }
@(private)
LIB :: (
"../lib/stb_rect_pack.lib" when ODIN_OS == .Windows
else "../lib/stb_rect_pack.a" when ODIN_OS == .Linux
else "../lib/darwin/stb_rect_pack.a" when ODIN_OS == .Darwin
else ""
)
when LIB != "" {
when !#exists(LIB) {
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
}
foreign import lib { LIB }
} else {
foreign import lib "system:stb_rect_pack"
}
Coord :: distinct c.int
_MAXVAL :: max(Coord)