Fix MoltenVK static linking on macOS (add missing include path, Vulkan SDK path option, use xcframework instead of static framework).

This commit is contained in:
bruvzg 2021-07-22 16:29:24 +03:00
parent 7a6d77ec9e
commit 53f84e39fd
2 changed files with 3 additions and 2 deletions

View file

@ -105,7 +105,7 @@ elif env["builtin_vulkan"]:
else: # Always build VMA.
thirdparty_dir = "#thirdparty/vulkan"
env.Prepend(CPPPATH=[thirdparty_dir])
env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
# Build Vulkan loader library
env_thirdparty = env.Clone()

View file

@ -24,6 +24,7 @@ def get_opts():
return [
("osxcross_sdk", "OSXCross SDK version", "darwin16"),
("MACOS_SDK_PATH", "Path to the macOS SDK", ""),
("VULKAN_SDK_PATH", "Path to the Vulkan SDK", ""),
BoolVariable(
"use_static_mvk",
"Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables"
@ -190,7 +191,7 @@ def configure(env):
env.Append(CPPDEFINES=["VULKAN_ENABLED"])
env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"])
if env["use_static_mvk"]:
env.Append(LINKFLAGS=["-framework", "MoltenVK"])
env.Append(LINKFLAGS=["-L$VULKAN_SDK_PATH/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/", "-lMoltenVK"])
env["builtin_vulkan"] = False
elif not env["builtin_vulkan"]:
env.Append(LIBS=["vulkan"])