Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Fix MoltenVK SDK detection after file location changes in 1.3.275.0. #87305

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions platform/macos/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,30 @@ def ver_parse(a):
if not os.path.exists(dirname):
return ""

ver_file = "0.0.0.0"
ver_num = ver_parse(ver_file)

ver_num = ver_parse("0.0.0.0")
files = os.listdir(dirname)
lib_name_out = 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
if ver_comp > ver_num:
# Try new SDK location.
lib_name = os.path.join(
os.path.join(dirname, file), "macOS/lib/MoltenVK.xcframework/macos-arm64_x86_64/"
)
if os.path.isfile(os.path.join(lib_name, "libMoltenVK.a")):
ver_num = ver_comp
lib_name_out = lib_name
else:
# Try old SDK location.
lib_name = os.path.join(
os.path.join(dirname, file), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/"
)
if os.path.isfile(os.path.join(lib_name, "libMoltenVK.a")):
ver_num = ver_comp
lib_name_out = lib_name

return os.path.join(os.path.join(dirname, ver_file), "MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/")
return lib_name_out


def configure(env: "Environment"):
Expand Down Expand Up @@ -269,6 +278,12 @@ def configure(env: "Environment"):
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"]), "macOS/lib/MoltenVK.xcframework/macos-arm64_x86_64/"
),
)
mvk_list.insert(
0,
os.path.join(
Expand Down
Loading