• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#.rst:
2# FindVulkanHeaders
3# -----------------
4#
5# Try to find Vulkan Headers and Registry.
6#
7# This module is intended to be used by projects that build Vulkan
8# "system" components such as the loader and layers.
9# Vulkan applications should instead use the FindVulkan (or similar)
10# find module that locates the headers and the loader library.
11#
12# When using this find module to locate the headers and registry
13# in a Vulkan-Headers repository, the Vulkan-Headers repository
14# should be built with 'install' target and the following environment
15# or CMake variable set to the location of the install directory.
16#
17#    VULKAN_HEADERS_INSTALL_DIR
18#
19# IMPORTED Targets
20# ^^^^^^^^^^^^^^^^
21#
22# This module defines no IMPORTED targets
23#
24# Result Variables
25# ^^^^^^^^^^^^^^^^
26#
27# This module defines the following variables::
28#
29#   VulkanHeaders_FOUND          - True if VulkanHeaders was found
30#   VulkanHeaders_INCLUDE_DIRS   - include directories for VulkanHeaders
31#
32#   VulkanRegistry_FOUND         - True if VulkanRegistry was found
33#   VulkanRegistry_DIRS          - directories for VulkanRegistry
34#
35# The module will also define two cache variables::
36#
37#   VulkanHeaders_INCLUDE_DIR    - the VulkanHeaders include directory
38#   VulkanRegistry_DIR           - the VulkanRegistry directory
39#
40
41# Use HINTS instead of PATH to search these locations before
42# searching system environment variables like $PATH that may
43# contain SDK directories.
44find_path(VulkanHeaders_INCLUDE_DIR
45    NAMES vulkan/vulkan.h
46    HINTS
47        ${VULKAN_HEADERS_INSTALL_DIR}/include
48        "$ENV{VULKAN_HEADERS_INSTALL_DIR}/include"
49        "$ENV{VULKAN_SDK}/include")
50
51if(VulkanHeaders_INCLUDE_DIR)
52   get_filename_component(VULKAN_REGISTRY_PATH_HINT ${VulkanHeaders_INCLUDE_DIR} DIRECTORY)
53   find_path(VulkanRegistry_DIR
54       NAMES vk.xml
55       HINTS "${VULKAN_REGISTRY_PATH_HINT}/share/vulkan/registry")
56endif()
57
58set(VulkanHeaders_INCLUDE_DIRS ${VulkanHeaders_INCLUDE_DIR})
59set(VulkanRegistry_DIRS ${VulkanRegistry_DIR})
60
61include(FindPackageHandleStandardArgs)
62find_package_handle_standard_args(VulkanHeaders
63    DEFAULT_MSG
64    VulkanHeaders_INCLUDE_DIR)
65find_package_handle_standard_args(VulkanRegistry
66    DEFAULT_MSG
67    VulkanRegistry_DIR)
68
69mark_as_advanced(VulkanHeaders_INCLUDE_DIR VulkanRegistry_DIR)
70