mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-10 02:31:48 +00:00
Fixes in Cmake scripts after merging #350
This commit is contained in:
parent
c503590e54
commit
01fe410548
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.15...3.26)
|
cmake_minimum_required(VERSION 3.15...3.26)
|
||||||
|
|
||||||
project(VMA LANGUAGES CXX)
|
project(VulkanMemoryAllocator LANGUAGES CXX)
|
||||||
|
|
||||||
add_library(VulkanMemoryAllocator INTERFACE)
|
add_library(VulkanMemoryAllocator INTERFACE)
|
||||||
add_library(GPUOpen::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
|
add_library(GPUOpen::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
|
||||||
|
@ -120,9 +120,7 @@ cmake --install build --prefix build/install
|
|||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
After calling either `find_package` or `add_subdirectory` simply link the library.
|
After calling either `find_package` or `add_subdirectory` simply link the library.
|
||||||
This automatically handles configuring the include directory.
|
This automatically handles configuring the include directory. Example:
|
||||||
|
|
||||||
EX:
|
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
|
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
|
||||||
|
@ -126,9 +126,7 @@ See documentation chapter: \ref statistics.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VULKAN_H_
|
#include <vulkan/vulkan.h>
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(VMA_VULKAN_VERSION)
|
#if !defined(VMA_VULKAN_VERSION)
|
||||||
#if defined(VK_VERSION_1_3)
|
#if defined(VK_VERSION_1_3)
|
||||||
|
@ -21,35 +21,8 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
add_library(VmaUsage STATIC)
|
|
||||||
target_sources(VmaUsage PRIVATE
|
|
||||||
VmaUsage.cpp
|
|
||||||
VmaUsage.h
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(VmaUsage PUBLIC GPUOpen::VulkanMemoryAllocator)
|
|
||||||
|
|
||||||
# Provides MSVC users nicer debugging support
|
|
||||||
target_sources(VmaUsage PRIVATE vk_mem_alloc.natvis)
|
|
||||||
|
|
||||||
find_package(Vulkan REQUIRED)
|
find_package(Vulkan REQUIRED)
|
||||||
|
|
||||||
# Only link to Vulkan library if static linking is used, but always add Vulkan headers directory
|
|
||||||
if(VMA_STATIC_VULKAN_FUNCTIONS)
|
|
||||||
target_link_libraries(VmaUsage PUBLIC Vulkan::Vulkan)
|
|
||||||
else()
|
|
||||||
target_link_libraries(VmaUsage PUBLIC Vulkan::Headers)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(VmaUsage PUBLIC
|
|
||||||
VMA_STATIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_STATIC_VULKAN_FUNCTIONS}>
|
|
||||||
VMA_DYNAMIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_DYNAMIC_VULKAN_FUNCTIONS}>
|
|
||||||
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$<BOOL:${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}>
|
|
||||||
VMA_DEBUG_INITIALIZE_ALLOCATIONS=$<BOOL:${VMA_DEBUG_INITIALIZE_ALLOCATIONS}>
|
|
||||||
VMA_DEBUG_GLOBAL_MUTEX=$<BOOL:${VMA_DEBUG_GLOBAL_MUTEX}>
|
|
||||||
VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$<BOOL:${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}>
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(VmaSample)
|
add_executable(VmaSample)
|
||||||
target_sources(VmaSample PRIVATE
|
target_sources(VmaSample PRIVATE
|
||||||
Common.cpp
|
Common.cpp
|
||||||
@ -58,10 +31,30 @@ target_sources(VmaSample PRIVATE
|
|||||||
SparseBindingTest.h
|
SparseBindingTest.h
|
||||||
Tests.cpp
|
Tests.cpp
|
||||||
Tests.h
|
Tests.h
|
||||||
|
VmaUsage.cpp
|
||||||
|
VmaUsage.h
|
||||||
VulkanSample.cpp
|
VulkanSample.cpp
|
||||||
|
../include/vk_mem_alloc.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(VmaSample PRIVATE VmaUsage)
|
# Only link to Vulkan library if static linking is used, but always add Vulkan headers directory
|
||||||
|
if(VMA_STATIC_VULKAN_FUNCTIONS)
|
||||||
|
target_link_libraries(VmaSample PUBLIC Vulkan::Vulkan)
|
||||||
|
else()
|
||||||
|
target_link_libraries(VmaSample PUBLIC Vulkan::Headers)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(VmaSample PUBLIC
|
||||||
|
VMA_STATIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_STATIC_VULKAN_FUNCTIONS}>
|
||||||
|
VMA_DYNAMIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_DYNAMIC_VULKAN_FUNCTIONS}>
|
||||||
|
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$<BOOL:${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}>
|
||||||
|
VMA_DEBUG_INITIALIZE_ALLOCATIONS=$<BOOL:${VMA_DEBUG_INITIALIZE_ALLOCATIONS}>
|
||||||
|
VMA_DEBUG_GLOBAL_MUTEX=$<BOOL:${VMA_DEBUG_GLOBAL_MUTEX}>
|
||||||
|
VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$<BOOL:${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Provides MSVC users nicer debugging support
|
||||||
|
target_sources(VmaSample PRIVATE vk_mem_alloc.natvis)
|
||||||
|
|
||||||
add_subdirectory(Shaders)
|
add_subdirectory(Shaders)
|
||||||
add_dependencies(VmaSample VmaSampleShaders)
|
add_dependencies(VmaSample VmaSampleShaders)
|
||||||
@ -74,3 +67,5 @@ add_compile_options(/permissive- /sdl /W3)
|
|||||||
|
|
||||||
# Set VmaSample as startup project
|
# Set VmaSample as startup project
|
||||||
set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT "VmaSample")
|
set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT "VmaSample")
|
||||||
|
|
||||||
|
set_target_properties(VmaSample PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
|
||||||
|
Loading…
Reference in New Issue
Block a user