diff options
author | Clay John <claynjohn@gmail.com> | 2024-08-20 21:21:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 21:21:32 -0700 |
commit | 62de80d6138c09cb2c4c66d0b963820f95ad1f21 (patch) | |
tree | f1710c694c12f9360e853111a1ca396f285844bb /platform/macos/detect.py | |
parent | 826de7976a6add282c7b14d4be2a7e6d775821d8 (diff) | |
parent | 2d0165574de6ac21aa2730215dcab60e4ce88d08 (diff) | |
download | redot-engine-62de80d6138c09cb2c4c66d0b963820f95ad1f21.tar.gz |
Merge pull request #88199 from stuartcarnie/metal-rdd
Add Metal support for macOS (arm64) and iOS
Diffstat (limited to 'platform/macos/detect.py')
-rw-r--r-- | platform/macos/detect.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 1ce7c86c7b..bfd18bea99 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -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) |