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
+15 -5
View File
@@ -2,13 +2,23 @@ package stb_vorbis
import c "core:c/libc"
@(private)
LIB :: (
"../lib/stb_vorbis.lib" when ODIN_OS == .Windows
else "../lib/stb_vorbis.a" when ODIN_OS == .Linux
else "../lib/darwin/stb_vorbis.a" when ODIN_OS == .Darwin
else ""
)
when ODIN_OS == .Windows { foreign import lib "../lib/stb_vorbis.lib" }
else when ODIN_OS == .Linux { foreign import lib "../lib/stb_vorbis.a" }
else when ODIN_OS == .Darwin { foreign import lib "../lib/darwin/stb_vorbis.a" }
else { foreign import lib "system:stb_vorbis" }
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_vorbis"
}
/////////// THREAD SAFETY