Forráskód Böngészése

Clean up `foreign import` code for library path determination

gingerBill 1 éve
szülő
commit
427c48221d
1 módosított fájl, 9 hozzáadás és 20 törlés
  1. 9 20
      vendor/box2d/box2d.odin

+ 9 - 20
vendor/box2d/box2d.odin

@@ -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