Merge pull request #3143 from Pariatech/cgltf-linux-build

Adding linux & darwin makefile for cgltf
This commit is contained in:
gingerBill
2024-03-13 17:47:18 +00:00
committed by GitHub
2 changed files with 24 additions and 4 deletions

View File

@@ -1,9 +1,9 @@
//+build windows
package cgltf
when ODIN_OS == .Windows {
foreign import lib "lib/cgltf.lib"
}
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" }
import "core:c"

20
vendor/cgltf/src/Makefile vendored Normal file
View File

@@ -0,0 +1,20 @@
OS=$(shell uname)
ifeq ($(OS), Darwin)
all: darwin
else
all: unix
endif
unix:
mkdir -p ../lib
$(CC) -c -O2 -Os -fPIC cgltf.c
$(AR) rcs ../lib/cgltf.a cgltf.o
rm *.o
darwin:
mkdir -p ../lib/darwin
$(CC) -arch x86_64 -c -O2 -Os -fPIC cgltf.c -o cgltf-x86_64.o -mmacosx-version-min=10.12
$(CC) -arch arm64 -c -O2 -Os -fPIC cgltf.c -o cgltf-arm64.o -mmacosx-version-min=10.12
lipo -create cgltf-x86_64.o cgltf-arm64.o -output ../lib/darwin/cgltf.a
rm *.o