diff --git a/CMakeLists.txt b/CMakeLists.txt index 1085d51c92..e14e80d3dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ if(APPLE) option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) # Enable adhoc code signing by default (otherwise makefile builds on ARM will not work) option(MACOS_CODE_SIGNING "Enable codesigning" ON) + option(USE_BUNDLED_MOLTENVK "Build MoltenVK from Externals with Dolphin-specific patches" ON) set(MACOS_CODE_SIGNING_IDENTITY "-" CACHE STRING "The identity used for codesigning.") set(MACOS_CODE_SIGNING_IDENTITY_UPDATER "-" CACHE STRING "The identity used for codesigning, for the updater.") endif() @@ -663,7 +664,7 @@ add_subdirectory(Externals/glslang) if(ENABLE_VULKAN) add_definitions(-DHAS_VULKAN) - if(APPLE) + if(APPLE AND USE_BUNDLED_MOLTENVK) add_subdirectory(Externals/MoltenVK) endif() endif() diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 37915aa5b0..fb9ee8d46b 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -572,10 +572,19 @@ if(APPLE) # Copy MoltenVK into the bundle if(ENABLE_VULKAN) - add_dependencies(dolphin-emu MoltenVK) - ExternalProject_Get_Property(MoltenVK SOURCE_DIR) - target_sources(dolphin-emu PRIVATE "${SOURCE_DIR}/Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib") - set_source_files_properties("${SOURCE_DIR}/Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks GENERATED ON) + if(USE_BUNDLED_MOLTENVK) + add_dependencies(dolphin-emu MoltenVK) + ExternalProject_Get_Property(MoltenVK SOURCE_DIR) + target_sources(dolphin-emu PRIVATE "${SOURCE_DIR}/Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib") + set_source_files_properties("${SOURCE_DIR}/Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks GENERATED ON) + else() + find_file(MOLTENVK_DYLIB NAMES libMoltenVK.dylib PATH_SUFFIXES lib) + if(NOT MOLTENVK_DYLIB) + message(FATAL_ERROR "Couldn't find libMoltenVK.dylib. Enable USE_BUNDLED_MOLTENVK?") + endif() + target_sources(dolphin-emu PRIVATE ${MOLTENVK_DYLIB}) + set_source_files_properties(${MOLTENVK_DYLIB} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) + endif() endif() if(NOT SKIP_POSTPROCESS_BUNDLE)