From 57ae75cb6d8573aeda04b9ee7fd622a40602c71e Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Thu, 9 Jun 2022 01:32:42 +0200
Subject: [PATCH] Added options to let VMA use most current Vulkan headers from
 submodules

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 config/lib/VulkanMemoryAllocator.cmake | 3 +++
 config/lib/vma/CMakeLists.txt          | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/config/lib/VulkanMemoryAllocator.cmake b/config/lib/VulkanMemoryAllocator.cmake
index fcde834d..3d5b0937 100644
--- a/config/lib/VulkanMemoryAllocator.cmake
+++ b/config/lib/VulkanMemoryAllocator.cmake
@@ -8,6 +8,9 @@ if (${vma_hpp_status})
 		set(VMA_HPP_PATH "${vkcv_lib_path}/VulkanMemoryAllocator-Hpp" CACHE INTERNAL "")
 	endif()
 	
+	set(VMA_VULKAN_H_PATH "${vkcv_lib_path}/Vulkan-Headers/include" CACHE INTERNAL "")
+	set(VMA_VULKAN_HPP_PATH "${vkcv_lib_path}/Vulkan-Hpp" CACHE INTERNAL "")
+	
 	set(VMA_RECORDING_ENABLED OFF CACHE INTERNAL "")
 	set(VMA_USE_STL_CONTAINERS OFF CACHE INTERNAL "")
 	set(VMA_STATIC_VULKAN_FUNCTIONS ON CACHE INTERNAL "")
diff --git a/config/lib/vma/CMakeLists.txt b/config/lib/vma/CMakeLists.txt
index a2c018f2..a656c6f5 100644
--- a/config/lib/vma/CMakeLists.txt
+++ b/config/lib/vma/CMakeLists.txt
@@ -6,6 +6,9 @@ find_package(Vulkan REQUIRED)
 
 option(VMA_HPP_PATH "Location of C++ headers" "")
 
+option(VMA_VULKAN_H_PATH "Location of Vulkan C headers" "")
+option(VMA_VULKAN_HPP_PATH "Location of Vulkan C++ headers" "")
+
 message(STATUS "VMA_BUILD_SAMPLE = ${VMA_BUILD_SAMPLE}")
 message(STATUS "VMA_BUILD_SAMPLE_SHADERS = ${VMA_BUILD_SAMPLE_SHADERS}")
 message(STATUS "VMA_BUILD_REPLAY = ${VMA_BUILD_REPLAY}")
@@ -38,6 +41,7 @@ set_target_properties(
 		CXX_STANDARD_REQUIRED ON
 )
 
+target_include_directories(VulkanMemoryAllocator SYSTEM BEFORE PRIVATE ${VMA_VULKAN_H_PATH} ${VMA_VULKAN_HPP_PATH})
 target_include_directories(VulkanMemoryAllocator PUBLIC ${VMA_HPP_PATH})
 
 # Only link to Vulkan if static linking is used
-- 
GitLab