diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f1a5056d7..b076ae7210 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,6 +573,10 @@ add_subdirectory(Externals/glslang) if(ENABLE_VULKAN) add_definitions(-DHAS_VULKAN) + + if(APPLE) + add_subdirectory(Externals/MoltenVK) + endif() endif() if(NOT WIN32 OR (NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))) diff --git a/Externals/MoltenVK/CMakeLists.txt b/Externals/MoltenVK/CMakeLists.txt new file mode 100644 index 0000000000..d89b6f8b2e --- /dev/null +++ b/Externals/MoltenVK/CMakeLists.txt @@ -0,0 +1,18 @@ +include(ExternalProject) + +ExternalProject_Add(MoltenVK + GIT_REPOSITORY https://github.com/KhronosGroup/MoltenVK.git + GIT_TAG v1.1.5 + + CONFIGURE_COMMAND /fetchDependencies --macos + + BUILD_COMMAND make -C macos + BUILD_IN_SOURCE ON + BUILD_BYPRODUCTS /Package/Release/MoltenVK/dylib/macOS/libMoltenVK.dylib + + INSTALL_COMMAND "" + + LOG_CONFIGURE ON + LOG_BUILD ON + LOG_OUTPUT_ON_FAILURE ON +) diff --git a/Externals/MoltenVK/libvulkan.dylib b/Externals/MoltenVK/libvulkan.dylib deleted file mode 100755 index 4eddd174d4..0000000000 Binary files a/Externals/MoltenVK/libvulkan.dylib and /dev/null differ diff --git a/Externals/MoltenVK/version.txt b/Externals/MoltenVK/version.txt deleted file mode 100644 index 2454c57670..0000000000 --- a/Externals/MoltenVK/version.txt +++ /dev/null @@ -1 +0,0 @@ -MoltenVK from https://vulkan.lunarg.com/sdk/home#mac, version 1.2.170.0 \ No newline at end of file diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 8b3c7b77be..ec854d5d42 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -528,8 +528,12 @@ if(APPLE) endforeach() # Copy MoltenVK into the bundle - target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Externals/MoltenVK/libvulkan.dylib") - set_source_files_properties("${CMAKE_SOURCE_DIR}/Externals/MoltenVK/libvulkan.dylib" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) + 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) + endif() # Update library references to make the bundle portable include(DolphinPostprocessBundle) diff --git a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp index e36ef7af28..7c94da05e7 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp @@ -43,8 +43,8 @@ static bool OpenVulkanLibrary() if (libvulkan_env && s_vulkan_module.Open(libvulkan_env)) return true; - // Use the libvulkan.dylib from the application bundle. - std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; + // Use the libMoltenVK.dylib from the application bundle. + std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libMoltenVK.dylib"; return s_vulkan_module.Open(filename.c_str()); #else std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1);