diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e91a70..bacd8b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,8 @@ message(STATUS "VMA_BUILD_REPLAY = ${VMA_BUILD_REPLAY}") option(VMA_RECORDING_ENABLED "Enable VMA memory recording for debugging" OFF) option(VMA_USE_STL_CONTAINERS "Use C++ STL containers instead of VMA's containers" OFF) -option(VMA_STATIC_VULKAN_FUNCTIONS "Link statically with Vulkan API" OFF) -option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" ON) +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) 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) @@ -25,6 +25,7 @@ option(VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT "Never exceed VkPhysica message(STATUS "VMA_RECORDING_ENABLED = ${VMA_RECORDING_ENABLED}") message(STATUS "VMA_USE_STL_CONTAINERS = ${VMA_USE_STL_CONTAINERS}") +message(STATUS "VMA_STATIC_VULKAN_FUNCTIONS = ${VMA_STATIC_VULKAN_FUNCTIONS}") 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}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3af59a9..6e77d2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,8 +26,20 @@ set_target_properties( target_include_directories(VulkanMemoryAllocator PUBLIC "${PROJECT_SOURCE_DIR}/include") +if(${VMA_DYNAMIC_VULKAN_FUNCTIONS}) + set(VULKAN_USE_DYNAMIC ${VMA_DYNAMIC_VULKAN_FUNCTIONS}) +else() + set(VULKAN_USE_DYNAMIC 0) +endif() + +if(${VMA_STATIC_VULKAN_FUNCTIONS}) + set(VULKAN_USE_STATIC ${VMA_STATIC_VULKAN_FUNCTIONS}) +else() + set(VULKAN_USE_STATIC 1) +endif() + # Only link to Vulkan if static linking is used -if(NOT ${VMA_DYNAMIC_VULKAN_FUNCTIONS}) +if(${VULKAN_USE_STATIC}) target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Vulkan) endif() @@ -36,7 +48,8 @@ target_compile_definitions( PUBLIC VMA_USE_STL_CONTAINERS=$ - VMA_DYNAMIC_VULKAN_FUNCTIONS=$ + VMA_STATIC_VULKAN_FUNCTIONS=$ + VMA_DYNAMIC_VULKAN_FUNCTIONS=$ VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$ VMA_DEBUG_INITIALIZE_ALLOCATIONS=$ VMA_DEBUG_GLOBAL_MUTEX=$ diff --git a/src/VmaUsage.h b/src/VmaUsage.h index a79b15c..2e53c75 100644 --- a/src/VmaUsage.h +++ b/src/VmaUsage.h @@ -56,8 +56,6 @@ include all public interface declarations. Example: //#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256 //#define VMA_USE_STL_SHARED_MUTEX 0 //#define VMA_MEMORY_BUDGET 0 -#define VMA_STATIC_VULKAN_FUNCTIONS 0 -#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 #define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2 //#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1