mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-24 21:10:12 +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)
|
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
|
# VulkanMemoryAllocator contains an sample application which is not built by default
|
||||||
option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF)
|
option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF)
|
||||||
option(VMA_BUILD_SAMPLE_SHADERS "Build VulkanMemoryAllocator sample application's shaders" 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_GLOBAL_MUTEX = ${VMA_DEBUG_GLOBAL_MUTEX}")
|
||||||
message(STATUS "VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = ${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}")
|
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)
|
if(VMA_BUILD_SAMPLE)
|
||||||
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -26,9 +26,11 @@ target_include_directories(VulkanMemoryAllocator PUBLIC
|
|||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Only link to Vulkan if static linking is used
|
# Only link to Vulkan library if static linking is used, but always add Vulkan headers directory
|
||||||
if(${VMA_STATIC_VULKAN_FUNCTIONS})
|
if(VMA_STATIC_VULKAN_FUNCTIONS)
|
||||||
target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Vulkan)
|
target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Vulkan)
|
||||||
|
else()
|
||||||
|
target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Headers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
|
@ -27,6 +27,7 @@ install(FILES
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/VulkanMemoryAllocatorConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/VulkanMemoryAllocatorConfig.cmake"
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
||||||
)
|
)
|
||||||
|
add_library(VulkanMemoryAllocator::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user