You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add Metal support for macOS (arm64) and iOS
This commit is contained in:
committed by
Rémi Verschelde
parent
826de7976a
commit
2d0165574d
@@ -56,6 +56,7 @@ def get_flags():
|
||||
return {
|
||||
"arch": detect_arch(),
|
||||
"use_volk": False,
|
||||
"metal": True,
|
||||
"supported": ["mono"],
|
||||
}
|
||||
|
||||
@@ -239,9 +240,22 @@ def configure(env: "SConsEnvironment"):
|
||||
|
||||
env.Append(LINKFLAGS=["-rpath", "@executable_path/../Frameworks", "-rpath", "@executable_path"])
|
||||
|
||||
if env["metal"] and env["arch"] != "arm64":
|
||||
# Only supported on arm64, so skip it for x86_64 builds.
|
||||
env["metal"] = False
|
||||
|
||||
extra_frameworks = set()
|
||||
|
||||
if env["metal"]:
|
||||
env.AppendUnique(CPPDEFINES=["METAL_ENABLED", "RD_ENABLED"])
|
||||
extra_frameworks.add("Metal")
|
||||
extra_frameworks.add("MetalKit")
|
||||
env.Prepend(CPPPATH=["#thirdparty/spirv-cross"])
|
||||
|
||||
if env["vulkan"]:
|
||||
env.Append(CPPDEFINES=["VULKAN_ENABLED", "RD_ENABLED"])
|
||||
env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "IOSurface"])
|
||||
env.AppendUnique(CPPDEFINES=["VULKAN_ENABLED", "RD_ENABLED"])
|
||||
extra_frameworks.add("Metal")
|
||||
extra_frameworks.add("IOSurface")
|
||||
if not env["use_volk"]:
|
||||
env.Append(LINKFLAGS=["-lMoltenVK"])
|
||||
|
||||
@@ -260,3 +274,7 @@ def configure(env: "SConsEnvironment"):
|
||||
"MoltenVK SDK installation directory not found, use 'vulkan_sdk_path' SCons parameter to specify SDK path."
|
||||
)
|
||||
sys.exit(255)
|
||||
|
||||
if len(extra_frameworks) > 0:
|
||||
frameworks = [item for key in extra_frameworks for item in ["-framework", key]]
|
||||
env.Append(LINKFLAGS=frameworks)
|
||||
|
||||
Reference in New Issue
Block a user