mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-21 20:00:11 +00:00
[cmake] Updated installation process to use modern CMake targets
This commit is contained in:
parent
b51fea7a53
commit
2bb598acd0
@ -24,7 +24,9 @@ set_target_properties(
|
|||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(VulkanMemoryAllocator PUBLIC "${PROJECT_SOURCE_DIR}/include")
|
target_include_directories(VulkanMemoryAllocator PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||||
|
)
|
||||||
|
|
||||||
# Only link to Vulkan if static linking is used
|
# Only link to Vulkan if static linking is used
|
||||||
if(${VMA_STATIC_VULKAN_FUNCTIONS})
|
if(${VMA_STATIC_VULKAN_FUNCTIONS})
|
||||||
@ -44,8 +46,7 @@ target_compile_definitions(
|
|||||||
VMA_RECORDING_ENABLED=$<BOOL:${VMA_RECORDING_ENABLED}>
|
VMA_RECORDING_ENABLED=$<BOOL:${VMA_RECORDING_ENABLED}>
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS VulkanMemoryAllocator DESTINATION "lib")
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/install_target.cmake)
|
||||||
install(FILES "${PROJECT_SOURCE_DIR}/include/vk_mem_alloc.h" DESTINATION "include")
|
|
||||||
|
|
||||||
if(VMA_BUILD_SAMPLE)
|
if(VMA_BUILD_SAMPLE)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
10
src/cmake/Config.cmake.in
Normal file
10
src/cmake/Config.cmake.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
|
find_package(Vulkan REQUIRED)
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/VulkanMemoryAllocatorTargets.cmake")
|
||||||
|
check_required_components("@PROJECT_NAME@")
|
||||||
|
|
||||||
|
|
32
src/cmake/install_target.cmake
Normal file
32
src/cmake/install_target.cmake
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
include(GNUInstallDirs)
|
||||||
|
target_include_directories(VulkanMemoryAllocator PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDE_DIRS}>
|
||||||
|
)
|
||||||
|
install(TARGETS VulkanMemoryAllocator
|
||||||
|
EXPORT VulkanMemoryAllocatorTargets
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
# install(FILES "${PROJECT_SOURCE_DIR}/include/vk_mem_alloc.h" DESTINATION "include")
|
||||||
|
install(FILES "${PROJECT_SOURCE_DIR}/include/vk_mem_alloc.h"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
install(EXPORT VulkanMemoryAllocatorTargets
|
||||||
|
FILE VulkanMemoryAllocatorTargets.cmake
|
||||||
|
NAMESPACE VulkanMemoryAllocator::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
||||||
|
)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/VulkanMemoryAllocatorConfig.cmake"
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
||||||
|
)
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/VulkanMemoryAllocatorConfig.cmake"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/VulkanMemoryAllocator
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user