YaaZ / VulkanMemoryAllocator-Hpp

C++ bindings for VulkanMemoryAllocator
Creative Commons Zero v1.0 Universal
57 stars 31 forks source link

Problems including VMA CMake project #25

Closed starcatter closed 3 weeks ago

starcatter commented 1 year ago

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.

YaaZ commented 1 year ago

Hi! Would you mind opening a PR for this?