mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Clean up foreign import code for library path determination
This commit is contained in:
Vendored
+9
-20
@@ -7,30 +7,19 @@ import "core:c"
|
|||||||
|
|
||||||
when ODIN_OS == .Windows {
|
when ODIN_OS == .Windows {
|
||||||
@(private) LIB_PATH :: "lib/box2d_windows_amd64_" + VECTOR_EXT + ".lib"
|
@(private) LIB_PATH :: "lib/box2d_windows_amd64_" + VECTOR_EXT + ".lib"
|
||||||
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import lib {
|
@(private) LIB_PATH :: ("lib/box2d_darwin_amd64_" + VECTOR_EXT + ".a") when ODIN_ARCH == .amd64 else "lib/box2d_darwin_arm64.a"
|
||||||
LIB_PATH,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
when ODIN_ARCH == .amd64 {
|
@(private) LIB_PATH :: "lib/box2d_other.a"
|
||||||
@(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,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// Prototype for user allocation function
|
||||||
|
|||||||
Reference in New Issue
Block a user