mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
wasm: support more vendor libraries
Adds support for: - box2d - cgltf - stb image - stb rect pack
This commit is contained in:
Vendored
+5
@@ -5,6 +5,7 @@ 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 "lib/cgltf_wasm.o" when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32
|
||||
else ""
|
||||
)
|
||||
|
||||
@@ -13,7 +14,11 @@ when 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\"`")
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||
foreign import lib "lib/cgltf_wasm.o"
|
||||
} else when LIB != "" {
|
||||
foreign import lib { LIB }
|
||||
} else {
|
||||
foreign import lib "system:cgltf"
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
//+build wasm32, wasm64p32
|
||||
package cgltf
|
||||
|
||||
@(require) import _ "vendor:libc"
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+4
@@ -6,6 +6,10 @@ else
|
||||
all: unix
|
||||
endif
|
||||
|
||||
wasm:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc cgltf.c -o ../lib/cgltf_wasm.o
|
||||
|
||||
unix:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC cgltf.c
|
||||
|
||||
Reference in New Issue
Block a user