diff options
Diffstat (limited to 'platform/macos/detect.py')
-rw-r--r-- | platform/macos/detect.py | 72 |
1 files changed, 16 insertions, 56 deletions
diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 12db2690de..cfbe9a8ee7 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -1,12 +1,12 @@ import os import sys from methods import detect_darwin_sdk_path, get_compiler_version, is_vanilla_clang -from platform_methods import detect_arch +from platform_methods import detect_arch, detect_mvk from typing import TYPE_CHECKING if TYPE_CHECKING: - from SCons import Environment + from SCons.Script.SConscript import SConsEnvironment def get_name(): @@ -33,6 +33,12 @@ def get_opts(): BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False), BoolVariable("use_coverage", "Use instrumentation codes in the binary (e.g. for code coverage)", False), ("angle_libs", "Path to the ANGLE static libraries", ""), + ( + "bundle_sign_identity", + "The 'Full Name', 'Common Name' or SHA-1 hash of the signing identity used to sign editor .app bundle.", + "-", + ), + BoolVariable("generate_bundle", "Generate an APP bundle after building iOS/macOS binaries", False), ] @@ -53,38 +59,7 @@ def get_flags(): ] -def get_mvk_sdk_path(): - def int_or_zero(i): - try: - return int(i) - except: - return 0 - - def ver_parse(a): - return [int_or_zero(i) for i in a.split(".")] - - dirname = os.path.expanduser("~/VulkanSDK") - if not os.path.exists(dirname): - return "" - - ver_file = "0.0.0.0" - ver_num = ver_parse(ver_file) - - files = os.listdir(dirname) - for file in files: - if os.path.isdir(os.path.join(dirname, file)): - ver_comp = ver_parse(file) - lib_name = os.path.join( - os.path.join(dirname, file), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a" - ) - if os.path.isfile(lib_name) and ver_comp > ver_num: - ver_num = ver_comp - ver_file = file - - return os.path.join(os.path.join(dirname, ver_file), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/") - - -def configure(env: "Environment"): +def configure(env: "SConsEnvironment"): # Validate arch. supported_arches = ["x86_64", "arm64"] if env["arch"] not in supported_arches: @@ -121,12 +96,12 @@ def configure(env: "Environment"): env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.13"]) cc_version = get_compiler_version(env) - cc_version_major = cc_version["major"] - cc_version_minor = cc_version["minor"] + cc_version_major = cc_version["apple_major"] + cc_version_minor = cc_version["apple_minor"] vanilla = is_vanilla_clang(env) # Workaround for Xcode 15 linker bug. - if not vanilla and cc_version_major == 15 and cc_version_minor == 0: + if not vanilla and cc_version_major == 1500 and cc_version_minor == 0: env.Prepend(LINKFLAGS=["-ld_classic"]) env.Append(CCFLAGS=["-fobjc-arc"]) @@ -264,26 +239,11 @@ def configure(env: "Environment"): env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "IOSurface"]) if not env["use_volk"]: env.Append(LINKFLAGS=["-lMoltenVK"]) - mvk_found = False - - mvk_list = [get_mvk_sdk_path(), "/opt/homebrew/lib", "/usr/local/homebrew/lib", "/opt/local/lib"] - if env["vulkan_sdk_path"] != "": - mvk_list.insert(0, os.path.expanduser(env["vulkan_sdk_path"])) - mvk_list.insert( - 0, - os.path.join( - os.path.expanduser(env["vulkan_sdk_path"]), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/" - ), - ) - - for mvk_path in mvk_list: - if mvk_path and os.path.isfile(os.path.join(mvk_path, "libMoltenVK.a")): - mvk_found = True - print("MoltenVK found at: " + mvk_path) - env.Append(LINKFLAGS=["-L" + mvk_path]) - break + mvk_path = detect_mvk(env, "macos-arm64_x86_64") - if not mvk_found: + if mvk_path != "": + env.Append(LINKFLAGS=["-L" + os.path.join(mvk_path, "macos-arm64_x86_64")]) + else: print( "MoltenVK SDK installation directory not found, use 'vulkan_sdk_path' SCons parameter to specify SDK path." ) |