mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-29 09:54:35 +00:00
cmake: always add vulkan headers dir
This commit is contained in:
parent
0e89587db3
commit
7f9124bad2
@ -2,14 +2,6 @@ cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
project(VulkanMemoryAllocator LANGUAGES CXX)
|
||||
|
||||
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
|
||||
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
find_package(Vulkan REQUIRED)
|
||||
include_directories(${Vulkan_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# VulkanMemoryAllocator contains an sample application which is not built by default
|
||||
option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF)
|
||||
option(VMA_BUILD_SAMPLE_SHADERS "Build VulkanMemoryAllocator sample application's shaders" OFF)
|
||||
@ -31,6 +23,12 @@ message(STATUS "VMA_DEBUG_INITIALIZE_ALLOCATIONS = ${VMA_DEBUG_INITIALIZE_ALLOCA
|
||||
message(STATUS "VMA_DEBUG_GLOBAL_MUTEX = ${VMA_DEBUG_GLOBAL_MUTEX}")
|
||||
message(STATUS "VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = ${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}")
|
||||
|
||||
if(VMA_STATIC_VULKAN_FUNCTIONS OR VMA_BUILD_SAMPLE)
|
||||
find_package(Vulkan REQUIRED)
|
||||
else()
|
||||
find_package(VulkanHeaders REQUIRED)
|
||||
endif()
|
||||
|
||||
if(VMA_BUILD_SAMPLE)
|
||||
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
||||
endif()
|
||||
|
@ -26,9 +26,11 @@ target_include_directories(VulkanMemoryAllocator PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
)
|
||||
|
||||
# Only link to Vulkan if static linking is used
|
||||
if(${VMA_STATIC_VULKAN_FUNCTIONS})
|
||||
# Only link to Vulkan library if static linking is used, but always add Vulkan headers directory
|
||||
if(VMA_STATIC_VULKAN_FUNCTIONS)
|
||||
target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Vulkan)
|
||||
else()
|
||||
target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Headers)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(
|
||||
|
@ -27,6 +27,7 @@ install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/VulkanMemoryAllocatorConfig.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
||||
)
|
||||
add_library(VulkanMemoryAllocator::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user