Simplify stb foreign imports

This commit is contained in:
gingerBill
2025-01-10 10:12:36 +00:00
parent 1511162b0a
commit 3d4a20918f
3 changed files with 6 additions and 18 deletions

View File

@@ -18,12 +18,8 @@ when LIB != "" {
}
}
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
foreign import stbi "../lib/stb_image_wasm.o"
} else when LIB != "" {
foreign import stbi { LIB }
} else {
foreign import stbi "system:stb_image"
foreign import stbi {
LIB when LIB != "" else "system:stb_image"
}
NO_STDIO :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32

View File

@@ -18,12 +18,8 @@ when RESIZE_LIB != "" {
}
}
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
foreign import lib "../lib/stb_image_resize_wasm.o"
} else when RESIZE_LIB != "" {
foreign import lib { RESIZE_LIB }
} else {
foreign import lib "system:stb_image_resize"
foreign import stbi {
RESIZE_LIB when RESIZE_LIB != "" else "system:stb_image_resize"
}
//////////////////////////////////////////////////////////////////////////////

View File

@@ -18,12 +18,8 @@ when WRITE_LIB != "" {
}
}
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
foreign import stbiw "../lib/stb_image_write_wasm.o"
} else when WRITE_LIB != "" {
foreign import stbiw { WRITE_LIB }
} else {
foreign import stbiw "system:stb_image_write"
foreign import stbi {
WRITE_LIB when WRITE_LIB != "" else "system:stb_image_write"
}
write_func :: proc "c" (ctx: rawptr, data: rawptr, size: c.int)