From 9cd94777f90a08862fb650b1b2ce46e610bc5bbf Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 28 Jul 2021 11:14:32 +0200 Subject: [PATCH] CMake: Fix MoltenVK headers to be found on macOS This fixes building Qt with Vulkan support on macOS which aside from the regular Vulkan headers also needs the location of the MoltenVK headers. This assumes the usage of the LunarG Vulkan SDK for macOS. Fixes: QTBUG-80576 Change-Id: I030b2fdeaafdd7bf5ebe6fb4c9ea860917e84056 Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor (cherry picked from commit 3b2157ed9e738ea03028afd5e8a71b5c54eb3937) Reviewed-by: Qt Cherry-pick Bot --- cmake/FindWrapVulkanHeaders.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/FindWrapVulkanHeaders.cmake b/cmake/FindWrapVulkanHeaders.cmake index a079e073008..766f1e29eb4 100644 --- a/cmake/FindWrapVulkanHeaders.cmake +++ b/cmake/FindWrapVulkanHeaders.cmake @@ -17,6 +17,19 @@ if(Vulkan_INCLUDE_DIR) add_library(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE IMPORTED) target_include_directories(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE ${Vulkan_INCLUDE_DIR}) + + # Also propagate MoltenVK include directory on Apple platforms if found. + # Assumes the folder structure of the LunarG Vulkan SDK. + if(APPLE) + set(__qt_molten_vk_include_path "${Vulkan_INCLUDE_DIR}/../../MoltenVK/include") + get_filename_component( + __qt_molten_vk_include_path + "${__qt_molten_vk_include_path}" ABSOLUTE) + if(EXISTS "${__qt_molten_vk_include_path}") + target_include_directories(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE + ${__qt_molten_vk_include_path}) + endif() + endif() endif() include(FindPackageHandleStandardArgs)