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

[macOS] Restore demo library output names.

bruvzg 3 éve
szülő
commit
b6b64bcd70

+ 22 - 21
SConstruct

@@ -125,7 +125,7 @@ opts.Add(EnumVariable("android_arch", "Target Android architecture", "armv7", ["
 opts.Add("macos_deployment_target", "macOS deployment target", "default")
 opts.Add("macos_sdk_path", "macOS SDK path", "")
 opts.Add(EnumVariable("macos_arch", "Target macOS architecture", "universal", ["universal", "x86_64", "arm64"]))
-opts.Add(EnumVariable("ios_arch", "Target iOS architecture", "arm64", ["armv7", "arm64", "x86_64"]))
+opts.Add(EnumVariable("ios_arch", "Target iOS architecture", "arm64", ["universal", "arm64", "x86_64"]))
 opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))
 opts.Add(
     "IPHONEPATH",
@@ -253,17 +253,19 @@ elif env["platform"] == "ios":
     env["RANLIB"] = compiler_path + "ranlib"
     env["SHLIBSUFFIX"] = ".dylib"
 
-    env.Append(CCFLAGS=["-arch", env["ios_arch"], "-isysroot", sdk_path])
-    env.Append(
-        LINKFLAGS=[
-            "-arch",
-            env["ios_arch"],
-            "-Wl,-undefined,dynamic_lookup",
-            "-isysroot",
-            sdk_path,
-            "-F" + sdk_path,
-        ]
-    )
+    if env["ios_arch"] == "universal":
+        if env["ios_simulator"]:
+            env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
+            env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
+        else:
+            env.Append(LINKFLAGS=["-arch", "arm64"])
+            env.Append(CCFLAGS=["-arch", "arm64"])
+    else:
+        env.Append(LINKFLAGS=["-arch", env["ios_arch"]])
+        env.Append(CCFLAGS=["-arch", env["ios_arch"]])
+
+    env.Append(CCFLAGS=["-isysroot", sdk_path])
+    env.Append(LINKFLAGS=["-isysroot", sdk_path, "-F" + sdk_path,])
 
     if env["target"] == "debug":
         env.Append(CCFLAGS=["-Og", "-g"])
@@ -479,27 +481,26 @@ add_sources(sources, "src/variant", "cpp")
 add_sources(sources, "gen/src/variant", "cpp")
 add_sources(sources, "gen/src/classes", "cpp")
 
-arch_suffix = env["bits"]
+env["arch_suffix"] = env["bits"]
 if env["platform"] == "android":
-    arch_suffix = env["android_arch"]
+    env["arch_suffix"] = env["android_arch"]
 elif env["platform"] == "ios":
-    arch_suffix = env["ios_arch"]
+    env["arch_suffix"] = env["ios_arch"]
     if env["ios_simulator"]:
-        arch_suffix += ".simulator"
+        env["arch_suffix"] += ".simulator"
 elif env["platform"] == "javascript":
-    arch_suffix = "wasm"
+    env["arch_suffix"] = "wasm"
 elif env["platform"] == "osx":
-    arch_suffix = env["macos_arch"]
+    env["arch_suffix"] = env["macos_arch"]
 
 library = None
-env["OBJSUFFIX"] = ".{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["OBJSUFFIX"])
-library_name = "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["LIBSUFFIX"])
+env["OBJSUFFIX"] = ".{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["OBJSUFFIX"])
+library_name = "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["LIBSUFFIX"])
 
 if env["build_library"]:
     library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
     Default(library)
 
-env["SHLIBSUFFIX"] = ".{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["SHLIBSUFFIX"])
 env.Append(CPPPATH=[env.Dir(f) for f in ["gen/include", "include", "godot-headers"]])
 env.Append(LIBPATH=[env.Dir("bin")])
 env.Append(LIBS=library_name)

+ 4 - 1
test/SConstruct

@@ -16,6 +16,9 @@ env = SConscript("../SConstruct")
 env.Append(CPPPATH=["src/"])
 sources = Glob("src/*.cpp")
 
-library = env.SharedLibrary("demo/bin/libgdexample" + env["SHLIBSUFFIX"], source=sources)
+if env["platform"] == "osx":
+    library = env.SharedLibrary("demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(env["platform"], env["target"], env["platform"], env["target"]), source=sources)
+else:
+    library = env.SharedLibrary("demo/bin/libgdexample.{}.{}.{}{}".format(env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"]), source=sources)
 
 Default(library)

+ 1 - 1
test/demo/bin/libgdexample.debug.framework/Resources/Info.plist → test/demo/bin/libgdexample.osx.debug.framework/Resources/Info.plist

@@ -9,7 +9,7 @@
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>libgdexample.debug</string>
+	<string>libgdexample.osx.debug</string>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>

+ 1 - 1
test/demo/bin/libgdexample.release.framework/Resources/Info.plist → test/demo/bin/libgdexample.osx.release.framework/Resources/Info.plist

@@ -9,7 +9,7 @@
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>libgdexample.release</string>
+	<string>libgdexample.osx.release</string>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>

+ 2 - 2
test/demo/example.gdextension

@@ -8,5 +8,5 @@ linux.64.debug = "bin/libgdexample.linux.debug.64.so"
 linux.64.release = "bin/libgdexample.linux.release.64.so"
 windows.64.debug = "bin/libgdexample.windows.debug.64.dll"
 windows.64.release = "bin/libgdexample.windows.release.64.dll"
-macos.debug = "bin/libgdexample.debug.framework"
-macos.release = "bin/libgdexample.release.framework"
+macos.debug = "bin/libgdexample.osx.debug.framework"
+macos.release = "bin/libgdexample.osx.release.framework"