VulkanMemoryAllocator-Hpp icon indicating copy to clipboard operation
VulkanMemoryAllocator-Hpp copied to clipboard

Problems including VMA CMake project

Open starcatter opened this issue 2 years ago • 1 comments

Two issues I came across:

  1. VMA-Hpp links the VMA library as VulkanMemoryAllocator::VulkanMemoryAllocator, even though VMA's CMakeLists.txt does not alias the namespace anywhere. I don't know if it's an issue with my installation, but I can't see anything suggesting that might work.
  2. Current CMakeLists.txt doesn't allow VMA-Hpp's users to supply their own VMA Cmake project. I suggest a solution in the code block below:
if(TARGET VulkanMemoryAllocator)
    add_library(VulkanMemoryAllocator::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VulkanMemoryAllocator/CMakeLists.txt)
    add_subdirectory(VulkanMemoryAllocator)
else()
    find_package(VulkanMemoryAllocator REQUIRED)
endif()

Obviously the VulkanMemoryAllocator::VulkanMemoryAllocator situation should be resolved first. Maybe that's how it shows up if find_package does its thing? I don't know since VMA is not installed as a package on my system. If that's the case, then the alias should also be added after the add_subdirectory statement.

starcatter avatar Jun 12 '23 23:06 starcatter

Hi! Would you mind opening a PR for this?

YaaZ avatar Aug 18 '23 11:08 YaaZ