Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ option_if_not_defined(GPGMM_STANDALONE "When building from GPGMM's repository" O
option_if_not_defined(GPGMM_ENABLE_TESTS "Enables compilation of tests" ON)
option_if_not_defined(GPGMM_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
option_if_not_defined(GPGMM_ENABLE_VK "Enable compilation of the Vulkan backend" ${ENABLE_VK})
option_if_not_defined(GPGMM_ENABLE_VK_STATIC_FUNCTIONS "Links Vulkan functions by statically importing them" ON)
option_if_not_defined(GPGMM_ENABLE_VK_STATIC_FUNCTIONS "Links Vulkan functions by statically importing them" OFF)
option_if_not_defined(GPGMM_ENABLE_VK_LOADER "Enables compilation of Vulkan loader" ${ENABLE_VK_LOADER})
option_if_not_defined(GPGMM_ENABLE_VK_USE_SDK "Enable compilation of the Vulkan backend by using the installed Vulkan SDK." OFF)

Expand All @@ -111,15 +111,19 @@ option_if_not_defined(GPGMM_DISABLE_SIZE_CACHE "Enables warming of caches with c
option_if_not_defined(GPGMM_ENABLE_MEMORY_LEAK_CHECKS "Enables memory leak detection." OFF)
option_if_not_defined(gpgmm_enable_resource_memory_align_checks "Enables checking of resource alignment." OFF)

# The Vulkan loader is an optional dependency.
if(GPGMM_ENABLE_VK)
if(GPGMM_ENABLE_VK_STATIC_FUNCTIONS OR GPGMM_ENABLE_VK_LOADER)
set(GPGMM_ENABLE_VK_LOADER ON)
if(GPGMM_ENABLE_TESTS)
# Vulkan tests require static linking.
if (GPGMM_ENABLE_VK)
set(GPGMM_ENABLE_VK_STATIC_FUNCTIONS ON)
endif()
enable_testing()
endif()

if(GPGMM_ENABLE_TESTS)
enable_testing()
# Use the Vulkan loader if the SDK isn't available.
if (GPGMM_ENABLE_VK_STATIC_FUNCTIONS)
if (NOT ${GPGMM_ENABLE_VK_USE_SDK})
set(GPGMM_ENABLE_VK_LOADER ON)
endif()
endif()

# ###############################################################################
Expand Down
3 changes: 2 additions & 1 deletion src/gpgmm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ if (GPGMM_ENABLE_VK)
"vk/vk_platform.h"
)

if (GPGMM_ENABLE_VK_LOADER)
# Only link to Vulkan if static linking is used
if (GPGMM_ENABLE_VK_STATIC_FUNCTIONS)
if (GPGMM_ENABLE_VK_USE_SDK)
target_link_libraries(gpgmm PRIVATE
${GPGMM_VK_LIBRARIES_DIR}
Expand Down