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 <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3b2157ed9e738ea03028afd5e8a71b5c54eb3937)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2021-07-28 11:14:32 +02:00 committed by Qt Cherry-pick Bot
parent eaa1f53338
commit 9cd94777f9

View File

@ -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)