Skip to content
Snippets Groups Projects
Verified Commit b39f86bf authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Added option to enforce a Vulkan version in VMA

parent fab61de5
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ option(BUILD_MODULES "Enables building VkCV as shared libraries" ON)
option(BUILD_PROJECTS "Enables building the VkCV projects" ON)
option(BUILD_DOXYGEN_DOCS "Enables building the VkCV doxygen documentation" OFF)
option(BUILD_SHARED "Enables building VkCV as shared libraries" OFF)
option(BUILD_VMA_VULKAN_VERSION "Enforce a specific Vulkan version for VMA" OFF)
if (BUILD_PROJECTS)
set(BUILD_MODULES ${BUILD_PROJECTS})
......
find_package(Vulkan QUIET)
if (Vulkan_VERSION)
set(BUILD_VMA_VULKAN_VERSION ${Vulkan_VERSION})
endif()
set(VMA_VULKAN_VERSION OFF CACHE INTERNAL "")
if (BUILD_VMA_VULKAN_VERSION)
string(REGEX REPLACE "(\\.[0-9]+)+$" "" VMA_VULKAN_MAJOR_VERSION ${BUILD_VMA_VULKAN_VERSION})
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" VMA_VULKAN_MINOR_VERSION ${BUILD_VMA_VULKAN_VERSION})
string(REGEX REPLACE "^([0-9]+\\.)+" "" VMA_VULKAN_PATCH_VERSION ${BUILD_VMA_VULKAN_VERSION})
math(EXPR VMA_VULKAN_VERSION "1000000 * ${VMA_VULKAN_MAJOR_VERSION} + 1000 * ${VMA_VULKAN_MINOR_VERSION} + ${VMA_VULKAN_PATCH_VERSION}" OUTPUT_FORMAT DECIMAL)
endif()
use_git_submodule("${vkcv_lib_path}/VulkanMemoryAllocator-Hpp" vma_hpp_status)
if (${vma_hpp_status})
......@@ -34,5 +50,9 @@ if (${vma_hpp_status})
list(APPEND vkcv_libraries VulkanMemoryAllocator)
list(APPEND vkcv_includes ${VMA_HPP_PATH})
message(${vkcv_config_msg} " VMA - ")
if (VMA_VULKAN_VERSION)
list(APPEND vkcv_definitions "VMA_VULKAN_VERSION=${VMA_VULKAN_VERSION}")
endif()
message(${vkcv_config_msg} " VMA - " ${BUILD_VMA_VULKAN_VERSION})
endif ()
......@@ -4,6 +4,7 @@ project(VulkanMemoryAllocator)
find_package(Vulkan REQUIRED)
option(VMA_VULKAN_VERSION "Enforced Vulkan version" OFF)
option(VMA_HPP_PATH "Location of C++ headers" "")
option(VMA_VULKAN_H_PATH "Location of Vulkan C headers" "")
......@@ -64,4 +65,5 @@ target_compile_definitions(
VMA_DEBUG_GLOBAL_MUTEX=$<BOOL:${VMA_DEBUG_GLOBAL_MUTEX}>
VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$<BOOL:${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}>
VMA_RECORDING_ENABLED=$<BOOL:${VMA_RECORDING_ENABLED}>
VMA_VULKAN_VERSION=${VMA_VULKAN_VERSION}
)
......@@ -89,7 +89,6 @@ namespace vkcv
* @param instance The instance
* @param physicalDevice The optimal physical device
* @return Returns if a suitable GPU is found as physical device
* @see Context.deviceScore
*/
static bool pickPhysicalDevice(const vk::Instance& instance, vk::PhysicalDevice& physicalDevice)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment