2021-05-25 15:49:48 +00:00
|
|
|
cmake_minimum_required(VERSION 3.9)
|
|
|
|
|
|
|
|
project(VulkanMemoryAllocator)
|
|
|
|
|
2022-11-29 15:06:36 +00:00
|
|
|
# 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)
|
|
|
|
|
2022-11-29 14:41:52 +00:00
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
|
|
find_package(Vulkan REQUIRED)
|
|
|
|
endif()
|
2021-07-23 09:53:11 +00:00
|
|
|
include_directories(${Vulkan_INCLUDE_DIR})
|
2021-05-25 15:49:48 +00:00
|
|
|
|
2022-01-10 17:11:09 +00:00
|
|
|
# VulkanMemoryAllocator contains an sample application which is not built by default
|
2021-05-31 21:43:54 +00:00
|
|
|
option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF)
|
|
|
|
option(VMA_BUILD_SAMPLE_SHADERS "Build VulkanMemoryAllocator sample application's shaders" OFF)
|
2021-05-27 23:43:56 +00:00
|
|
|
|
2021-06-01 22:22:18 +00:00
|
|
|
message(STATUS "VMA_BUILD_SAMPLE = ${VMA_BUILD_SAMPLE}")
|
|
|
|
message(STATUS "VMA_BUILD_SAMPLE_SHADERS = ${VMA_BUILD_SAMPLE_SHADERS}")
|
|
|
|
|
2021-12-17 11:11:06 +00:00
|
|
|
option(VMA_STATIC_VULKAN_FUNCTIONS "Link statically with Vulkan API" ON)
|
|
|
|
option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" OFF)
|
2021-06-01 22:22:18 +00:00
|
|
|
option(VMA_DEBUG_ALWAYS_DEDICATED_MEMORY "Every allocation will have its own memory block" OFF)
|
|
|
|
option(VMA_DEBUG_INITIALIZE_ALLOCATIONS "Automatically fill new allocations and destroyed allocations with some bit pattern" OFF)
|
|
|
|
option(VMA_DEBUG_GLOBAL_MUTEX "Enable single mutex protecting all entry calls to the library" OFF)
|
|
|
|
option(VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT "Never exceed VkPhysicalDeviceLimits::maxMemoryAllocationCount and return error" OFF)
|
|
|
|
|
2021-12-17 11:11:06 +00:00
|
|
|
message(STATUS "VMA_STATIC_VULKAN_FUNCTIONS = ${VMA_STATIC_VULKAN_FUNCTIONS}")
|
2021-06-01 22:22:18 +00:00
|
|
|
message(STATUS "VMA_DYNAMIC_VULKAN_FUNCTIONS = ${VMA_DYNAMIC_VULKAN_FUNCTIONS}")
|
|
|
|
message(STATUS "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY = ${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}")
|
|
|
|
message(STATUS "VMA_DEBUG_INITIALIZE_ALLOCATIONS = ${VMA_DEBUG_INITIALIZE_ALLOCATIONS}")
|
|
|
|
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}")
|
|
|
|
|
2021-12-02 15:38:48 +00:00
|
|
|
if(VMA_BUILD_SAMPLE)
|
|
|
|
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
|
|
|
endif(VMA_BUILD_SAMPLE)
|
2021-10-06 11:30:04 +00:00
|
|
|
|
2022-11-29 14:41:52 +00:00
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
|
|
find_package(Doxygen)
|
|
|
|
endif()
|
2021-10-06 11:30:04 +00:00
|
|
|
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF)
|
|
|
|
|
2021-12-02 15:38:48 +00:00
|
|
|
if(BUILD_DOCUMENTATION)
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
# set input and output files
|
|
|
|
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
|
|
|
|
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
|
|
|
|
|
|
|
# request to configure the file
|
|
|
|
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
|
|
|
# note the option ALL which allows to build the docs together with the application
|
|
|
|
add_custom_target( doc_doxygen ALL
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating API documentation with Doxygen"
|
|
|
|
VERBATIM )
|
|
|
|
else()
|
|
|
|
message("Doxygen need to be installed to generate the doxygen documentation")
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-10-06 11:30:04 +00:00
|
|
|
|
2021-05-25 15:49:48 +00:00
|
|
|
add_subdirectory(src)
|