This commit is contained in:
Adam Sawicki 2022-06-22 12:48:42 +02:00
commit 51c8b56011
4 changed files with 47 additions and 4 deletions

View File

@ -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)

View File

@ -33,7 +33,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <Windows.h> #include <windows.h>
#if !defined(VK_USE_PLATFORM_WIN32_KHR) #if !defined(VK_USE_PLATFORM_WIN32_KHR)
#define VK_USE_PLATFORM_WIN32_KHR #define VK_USE_PLATFORM_WIN32_KHR
#endif // #if !defined(VK_USE_PLATFORM_WIN32_KHR) #endif // #if !defined(VK_USE_PLATFORM_WIN32_KHR)

10
src/cmake/Config.cmake.in Normal file
View 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@")

View 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
)