Merge pull request #696 from bruvzg/macos_demo_fw

pull/695/head
Rémi Verschelde 2022-02-14 11:40:37 +01:00 committed by GitHub
commit be34bcfff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 26 deletions

View File

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

View File

@ -16,6 +16,9 @@ env = SConscript("../SConstruct")
env.Append(CPPPATH=["src/"]) env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp") 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) Default(library)

View File

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

View File

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

View File

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