Use GLOBs to get macOS vulkan framework headers

This commit recitfies the situation that this list of header files is out of
date with the upstream Vulkan-Headers repo. It uses GLOB_RECURSE to find all
the files and subdirectories in the vulkan headers include directory.
In a perfect world, the list of headers would be removed because users should
be using the Vulkan-Headers for that purpose. But to maintain any existing
users it will be retained.

CMake 3.12 added CONFIGURE_DEPENDS to globs to better support changes in the
list being caught by CMake. Since this repo uses 3.11 as the minimum, it will
not be added unless supported by the currently installed CMake version. While
better, it is not perfect at catching all changing file lists, and thus it
may still be necessary to re-run CMake manually to get an updated list of
headers files.

Note that this commit is a part of a series of commits and not intended to
work standalone.
This commit is contained in:
Charles Giessen
2021-11-03 15:04:48 -06:00
committed by Charles Giessen
parent 3c2c734113
commit 08b10ccae1
+8 -18
View File
@@ -301,24 +301,14 @@ else()
target_link_libraries(vulkan "-framework CoreFoundation")
# Build vulkan.framework
set(FRAMEWORK_HEADERS
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vk_icd.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vk_layer.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vk_platform.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vk_sdk_platform.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_android.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_core.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_ios.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_macos.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_vi.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_wayland.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_win32.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_xcb.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_xlib.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_xlib_xrandr.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan_screen.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan.h
${VulkanHeaders_INCLUDE_DIRS}/vulkan/vulkan.hpp)
# Use GLOB_RECURSE to find all the header files and populate the vulkan.framework headers with them
# Use CONFIGURE_DEPENDS to ensure that if the header files are updated, this list is also updated
# Note: CONFIGURE_DEPENDS is a 3.12 feature - gate it for now and remove when CMake minimum version is higher
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
file(GLOB_RECURSE FRAMEWORK_HEADERS ${VulkanHeaders_INCLUDE_DIRS} CONFIGURE_DEPENDS)
else()
file(GLOB_RECURSE FRAMEWORK_HEADERS ${VulkanHeaders_INCLUDE_DIRS} CONFIGURE_DEPENDS)
endif()
if(BUILD_STATIC_LOADER)
add_library(vulkan-framework STATIC ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS})
else()