externals: allow user to use system VulkanMemoryAllocator (#7149)

This commit is contained in:
Castor215 2023-11-11 19:52:28 +00:00 committed by GitHub
parent 1c75d895fc
commit b74c91457e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -362,8 +362,17 @@ if (ENABLE_OPENAL)
endif() endif()
# VMA # VMA
if(USE_SYSTEM_VMA)
add_library(vma INTERFACE)
find_package(VulkanMemoryAllocator REQUIRED)
if(TARGET GPUOpen::VulkanMemoryAllocator)
message(STATUS "Found VulkanMemoryAllocator")
target_link_libraries(vma INTERFACE GPUOpen::VulkanMemoryAllocator)
endif()
else()
add_library(vma INTERFACE) add_library(vma INTERFACE)
target_include_directories(vma SYSTEM INTERFACE ./vma/include) target_include_directories(vma SYSTEM INTERFACE ./vma/include)
endif()
# vulkan-headers # vulkan-headers
add_library(vulkan-headers INTERFACE) add_library(vulkan-headers INTERFACE)

View File

@ -23,6 +23,7 @@ option(USE_SYSTEM_CRYPTOPP "Use the system cryptopp (instead of the bundled one)
option(USE_SYSTEM_CUBEB "Use the system cubeb (instead of the bundled one)" OFF) option(USE_SYSTEM_CUBEB "Use the system cubeb (instead of the bundled one)" OFF)
option(USE_SYSTEM_LODEPNG "Use the system lodepng (instead of the bundled one)" OFF) option(USE_SYSTEM_LODEPNG "Use the system lodepng (instead of the bundled one)" OFF)
option(USE_SYSTEM_OPENAL "Use the system OpenAL (instead of the bundled one)" OFF) option(USE_SYSTEM_OPENAL "Use the system OpenAL (instead of the bundled one)" OFF)
option(USE_SYSTEM_VMA "Use the system VulkanMemoryAllocator (instead of the bundled one)" OFF)
# Qt and MoltenVK are handled separately # Qt and MoltenVK are handled separately
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SDL2 "Disable system SDL2" OFF "USE_SYSTEM_LIBS" OFF) CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SDL2 "Disable system SDL2" OFF "USE_SYSTEM_LIBS" OFF)
@ -45,6 +46,7 @@ CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CRYPTOPP "Disable system cryptopp" OFF "US
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CUBEB "Disable system cubeb" OFF "USE_SYSTEM_LIBS" OFF) CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CUBEB "Disable system cubeb" OFF "USE_SYSTEM_LIBS" OFF)
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LODEPNG "Disable system lodepng" OFF "USE_SYSTEM_LIBS" OFF) CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LODEPNG "Disable system lodepng" OFF "USE_SYSTEM_LIBS" OFF)
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENAL "Disable system OpenAL" OFF "USE_SYSTEM_LIBS" OFF) CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENAL "Disable system OpenAL" OFF "USE_SYSTEM_LIBS" OFF)
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_VMA "Disable system VulkanMemoryAllocator" OFF "USE_SYSTEM_LIBS" OFF)
set(LIB_VAR_LIST set(LIB_VAR_LIST
SDL2 SDL2
@ -67,6 +69,7 @@ set(LIB_VAR_LIST
CUBEB CUBEB
LODEPNG LODEPNG
OPENAL OPENAL
VMA
) )
# First, check that USE_SYSTEM_XXX is not used with USE_SYSTEM_LIBS # First, check that USE_SYSTEM_XXX is not used with USE_SYSTEM_LIBS