Clean up foreign import code for library path determination

This commit is contained in:
gingerBill
2024-08-14 10:28:07 +01:00
parent 1c97739ca3
commit 427c48221d
+9 -20
View File
@@ -7,30 +7,19 @@ import "core:c"
when ODIN_OS == .Windows {
@(private) LIB_PATH :: "lib/box2d_windows_amd64_" + VECTOR_EXT + ".lib"
foreign import lib {
LIB_PATH,
}
} else when ODIN_OS == .Darwin {
@(private) LIB_PATH :: ("lib/box2d_darwin_amd64_" + VECTOR_EXT + ".a") when ODIN_ARCH == .amd64 else "lib/box2d_darwin_arm64.a"
} else {
when ODIN_ARCH == .amd64 {
@(private) OS :: "darwin" when ODIN_OS == .Darwin else "other"
@(private) LIB_PATH :: "lib/box2d_" + OS + "_amd64_" + VECTOR_EXT + ".a"
} else when ODIN_OS == .Darwin && ODIN_ARCH == .arm64 {
@(private) LIB_PATH :: "lib/box2d_darwin_arm64.a"
} else {
@(private) LIB_PATH :: "lib/box2d_other.a"
}
when !#exists(LIB_PATH) {
#panic("Could not find the compiled box2d libraries at \"" + LIB_PATH + "\", they can be compiled by running the `build.sh` script at `" + ODIN_ROOT + "vendor/box2d/build_box2d.sh\"`")
}
foreign import lib {
LIB_PATH,
}
@(private) LIB_PATH :: "lib/box2d_other.a"
}
when !#exists(LIB_PATH) {
#panic("Could not find the compiled box2d libraries at \"" + LIB_PATH + "\", they can be compiled by running the `build.sh` script at `" + ODIN_ROOT + "vendor/box2d/build_box2d.sh\"`")
}
foreign import lib {
LIB_PATH,
}
// Prototype for user allocation function