mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 13:00:28 +00:00
use #exists to provide good errors for common missing libraries
This commit is contained in:
@@ -8330,6 +8330,7 @@ gb_internal ExprKind check_basic_directive_expr(CheckerContext *c, Operand *o, A
|
||||
name == "assert" ||
|
||||
name == "defined" ||
|
||||
name == "config" ||
|
||||
name == "exists" ||
|
||||
name == "load" ||
|
||||
name == "load_hash" ||
|
||||
name == "load_directory" ||
|
||||
|
||||
22
vendor/cgltf/cgltf.odin
vendored
22
vendor/cgltf/cgltf.odin
vendored
@@ -1,9 +1,23 @@
|
||||
package cgltf
|
||||
|
||||
when ODIN_OS == .Windows { foreign import lib "lib/cgltf.lib" }
|
||||
else when ODIN_OS == .Linux { foreign import lib "lib/cgltf.a" }
|
||||
else when ODIN_OS == .Darwin { foreign import lib "lib/darwin/cgltf.a" }
|
||||
else { foreign import lib "system:cgltf" }
|
||||
@(private)
|
||||
LIB :: (
|
||||
"lib/cgltf.lib" when ODIN_OS == .Windows
|
||||
else "lib/cgltf.a" when ODIN_OS == .Linux
|
||||
else "lib/darwin/cgltf.a" when ODIN_OS == .Darwin
|
||||
else ""
|
||||
)
|
||||
|
||||
when LIB != "" {
|
||||
when !#exists(LIB) {
|
||||
// Windows library is shipped with the compiler, so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled cgltf library, it can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/cgltf/src\"`")
|
||||
}
|
||||
|
||||
foreign import lib { LIB }
|
||||
} else {
|
||||
foreign import lib "system:cgltf"
|
||||
}
|
||||
|
||||
import "core:c"
|
||||
|
||||
|
||||
12
vendor/miniaudio/common.odin
vendored
12
vendor/miniaudio/common.odin
vendored
@@ -8,12 +8,16 @@ when MINIAUDIO_SHARED {
|
||||
#panic("Shared linking for miniaudio is not supported yet")
|
||||
}
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
@(private)
|
||||
LIB :: "lib/miniaudio.lib" when ODIN_OS == .Windows else "lib/miniaudio.a"
|
||||
|
||||
when !#exists(LIB) {
|
||||
// Windows library is shipped with the compiler, so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled miniaudio library, it can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/miniaudio/src\"`")
|
||||
}
|
||||
|
||||
foreign import lib { LIB }
|
||||
|
||||
BINDINGS_VERSION_MAJOR :: 0
|
||||
BINDINGS_VERSION_MINOR :: 11
|
||||
BINDINGS_VERSION_REVISION :: 21
|
||||
|
||||
6
vendor/miniaudio/data_conversion.odin
vendored
6
vendor/miniaudio/data_conversion.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
*************************************************************************************************************************************************************
|
||||
|
||||
6
vendor/miniaudio/decoding.odin
vendored
6
vendor/miniaudio/decoding.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/device_io_procs.odin
vendored
6
vendor/miniaudio/device_io_procs.odin
vendored
@@ -1,10 +1,6 @@
|
||||
package miniaudio
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
import "core:c"
|
||||
|
||||
|
||||
6
vendor/miniaudio/effects.odin
vendored
6
vendor/miniaudio/effects.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/*
|
||||
Delay
|
||||
|
||||
6
vendor/miniaudio/encoding.odin
vendored
6
vendor/miniaudio/encoding.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/engine.odin
vendored
6
vendor/miniaudio/engine.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/filtering.odin
vendored
6
vendor/miniaudio/filtering.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/**************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/generation.odin
vendored
6
vendor/miniaudio/generation.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
waveform_type :: enum c.int {
|
||||
sine,
|
||||
|
||||
6
vendor/miniaudio/job_queue.odin
vendored
6
vendor/miniaudio/job_queue.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/*
|
||||
Slot Allocator
|
||||
|
||||
6
vendor/miniaudio/logging.odin
vendored
6
vendor/miniaudio/logging.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c/libc"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
MAX_LOG_CALLBACKS :: 4
|
||||
|
||||
|
||||
6
vendor/miniaudio/node_graph.odin
vendored
6
vendor/miniaudio/node_graph.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/resource_manager.odin
vendored
6
vendor/miniaudio/resource_manager.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
6
vendor/miniaudio/synchronization.odin
vendored
6
vendor/miniaudio/synchronization.odin
vendored
@@ -1,10 +1,6 @@
|
||||
package miniaudio
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
@(default_calling_convention="c", link_prefix="ma_")
|
||||
foreign lib {
|
||||
|
||||
6
vendor/miniaudio/utilities.odin
vendored
6
vendor/miniaudio/utilities.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
@(default_calling_convention="c", link_prefix="ma_")
|
||||
foreign lib {
|
||||
|
||||
6
vendor/miniaudio/vfs.odin
vendored
6
vendor/miniaudio/vfs.odin
vendored
@@ -2,11 +2,7 @@ package miniaudio
|
||||
|
||||
import "core:c"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib "lib/miniaudio.lib"
|
||||
} else {
|
||||
foreign import lib "lib/miniaudio.a"
|
||||
}
|
||||
foreign import lib { LIB }
|
||||
|
||||
/************************************************************************************************************************************************************
|
||||
|
||||
|
||||
25
vendor/stb/image/stb_image.odin
vendored
25
vendor/stb/image/stb_image.odin
vendored
@@ -2,13 +2,26 @@ package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
@(private)
|
||||
LIB :: (
|
||||
"../lib/stb_image.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image.a" when ODIN_OS == .Darwin
|
||||
else ""
|
||||
)
|
||||
|
||||
when LIB != "" {
|
||||
when !#exists(LIB) {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
|
||||
foreign import stbi { LIB }
|
||||
} else {
|
||||
foreign import stbi "system:stb_image"
|
||||
}
|
||||
|
||||
#assert(size_of(c.int) == size_of(b32))
|
||||
|
||||
when ODIN_OS == .Windows { foreign import stbi "../lib/stb_image.lib" }
|
||||
else when ODIN_OS == .Linux { foreign import stbi "../lib/stb_image.a" }
|
||||
else when ODIN_OS == .Darwin { foreign import stbi "../lib/darwin/stb_image.a" }
|
||||
else { foreign import stbi "system:stb_image" }
|
||||
|
||||
#assert(size_of(b32) == size_of(c.int))
|
||||
|
||||
//
|
||||
|
||||
21
vendor/stb/image/stb_image_resize.odin
vendored
21
vendor/stb/image/stb_image_resize.odin
vendored
@@ -2,11 +2,24 @@ package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
when ODIN_OS == .Windows { foreign import lib "../lib/stb_image_resize.lib" }
|
||||
else when ODIN_OS == .Linux { foreign import lib "../lib/stb_image_resize.a" }
|
||||
else when ODIN_OS == .Darwin { foreign import lib "../lib/darwin/stb_image_resize.a" }
|
||||
else { foreign import lib "system:stb_image_resize" }
|
||||
@(private)
|
||||
RESIZE_LIB :: (
|
||||
"../lib/stb_image_resize.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image_resize.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image_resize.a" when ODIN_OS == .Darwin
|
||||
else ""
|
||||
)
|
||||
|
||||
when RESIZE_LIB != "" {
|
||||
when !#exists(RESIZE_LIB) {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
|
||||
foreign import lib { RESIZE_LIB }
|
||||
} else {
|
||||
foreign import lib "system:stb_image_resize"
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
21
vendor/stb/image/stb_image_write.odin
vendored
21
vendor/stb/image/stb_image_write.odin
vendored
@@ -2,11 +2,24 @@ package stb_image
|
||||
|
||||
import c "core:c/libc"
|
||||
|
||||
when ODIN_OS == .Windows { foreign import stbiw "../lib/stb_image_write.lib" }
|
||||
else when ODIN_OS == .Linux { foreign import stbiw "../lib/stb_image_write.a" }
|
||||
else when ODIN_OS == .Darwin { foreign import stbiw "../lib/darwin/stb_image_write.a" }
|
||||
else { foreign import stbiw "system:stb_image_write" }
|
||||
@(private)
|
||||
WRITE_LIB :: (
|
||||
"../lib/stb_image_write.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_image_write.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_image_write.a" when ODIN_OS == .Darwin
|
||||
else ""
|
||||
)
|
||||
|
||||
when WRITE_LIB != "" {
|
||||
when !#exists(WRITE_LIB) {
|
||||
// The STB libraries are shipped with the compiler on Windows so a Windows specific message should not be needed.
|
||||
#panic("Could not find the compiled STB libraries, they can be compiled by running `make -C \"" + ODIN_ROOT + "vendor/stb/src\"`")
|
||||
}
|
||||
|
||||
foreign import stbiw { WRITE_LIB }
|
||||
} else {
|
||||
foreign import stbiw "system:stb_image_write"
|
||||
}
|
||||
|
||||
write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)
|
||||
|
||||
|
||||
21
vendor/stb/rect_pack/stb_rect_pack.odin
vendored
21
vendor/stb/rect_pack/stb_rect_pack.odin
vendored
@@ -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)
|
||||
|
||||
20
vendor/stb/truetype/stb_truetype.odin
vendored
20
vendor/stb/truetype/stb_truetype.odin
vendored
@@ -3,11 +3,23 @@ package stb_truetype
|
||||
import c "core:c"
|
||||
import stbrp "vendor:stb/rect_pack"
|
||||
|
||||
when ODIN_OS == .Windows { foreign import stbtt "../lib/stb_truetype.lib" }
|
||||
else when ODIN_OS == .Linux { foreign import stbtt "../lib/stb_truetype.a" }
|
||||
else when ODIN_OS == .Darwin { foreign import stbtt "../lib/darwin/stb_truetype.a" }
|
||||
else { foreign import stbtt "system:stb_truetype" }
|
||||
@(private)
|
||||
LIB :: (
|
||||
"../lib/stb_truetype.lib" when ODIN_OS == .Windows
|
||||
else "../lib/stb_truetype.a" when ODIN_OS == .Linux
|
||||
else "../lib/darwin/stb_truetype.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 stbtt { LIB }
|
||||
} else {
|
||||
foreign import stbtt "system:stb_truetype"
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
20
vendor/stb/vorbis/stb_vorbis.odin
vendored
20
vendor/stb/vorbis/stb_vorbis.odin
vendored
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user