Merge pull request #686 from asuessenbach/cmake

Use VulkanRegistry_DIR and VulkanHeaders_INCLUDE_DIR as introduced in Vulkan-Tools/cmake/FindVulkanHeaders.cmake
This commit is contained in:
Andreas Süßenbach 2020-07-27 13:32:27 +02:00 committed by GitHub
commit 77942b2941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,21 +55,28 @@ endif(MSVC)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
if (NOT DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR) if (NOT DEFINED VulkanRegistry_DIR)
set(VULKAN_HPP_VULKAN_HEADERS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers") if (DEFINED VULKAN_HPP_VULKAN_HEADERS_SRC_DIR)
set(VulkanRegistry_DIR VULKAN_HPP_VULKAN_HEADERS_SRC_DIR)
else()
set(VulkanRegistry_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers")
endif() endif()
file(TO_NATIVE_PATH ${VULKAN_HPP_VULKAN_HEADERS_SRC_DIR}/registry/vk.xml vk_spec) endif()
file(TO_NATIVE_PATH ${VulkanRegistry_DIR}/registry/vk.xml vk_spec)
string(REPLACE "\\" "\\\\" vk_spec ${vk_spec}) string(REPLACE "\\" "\\\\" vk_spec ${vk_spec})
add_definitions(-DVK_SPEC="${vk_spec}") add_definitions(-DVK_SPEC="${vk_spec}")
if (NOT DEFINED VULKAN_HPP_PATH) if (NOT DEFINED VulkanHeaders_INCLUDE_DIR)
set(VULKAN_HPP_PATH "${CMAKE_CURRENT_SOURCE_DIR}/vulkan") if (DEFINED VULKAN_HPP_PATH)
set(VulkanHeaders_INCLUDE_DIR VULKAN_HPP_PATH)
else()
set(VulkanHeaders_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endif() endif()
file(TO_NATIVE_PATH ${VULKAN_HPP_PATH}/vulkan.hpp vulkan_hpp) endif()
file(TO_NATIVE_PATH ${VulkanHeaders_INCLUDE_DIR}/vulkan/vulkan.hpp vulkan_hpp)
string(REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp}) string(REPLACE "\\" "\\\\" vulkan_hpp ${vulkan_hpp})
add_definitions(-DVULKAN_HPP_FILE="${vulkan_hpp}") add_definitions(-DVULKAN_HPP_FILE="${vulkan_hpp}")
include_directories(${VULKAN_HPP_PATH}) include_directories(${VulkanHeaders_INCLUDE_DIR})
set(HEADERS set(HEADERS
VulkanHppGenerator.hpp VulkanHppGenerator.hpp