From 1993495dbc988c90b968e7fc87548c341f9c05e3 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sun, 21 Jul 2024 13:42:51 +0200 Subject: [PATCH] Add option to link vulkan without shaderc --- 3rdParty/imgui/CMakeLists.txt | 1 + cmake/SetupVulkan.cmake | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/3rdParty/imgui/CMakeLists.txt b/3rdParty/imgui/CMakeLists.txt index 5f0ae37..832dd6d 100644 --- a/3rdParty/imgui/CMakeLists.txt +++ b/3rdParty/imgui/CMakeLists.txt @@ -29,6 +29,7 @@ if (glfw_FOUND) target_link_libraries(imgui_internal PUBLIC glfw) endif () +set(NO_SHADERC ON) SetupVulkan(imgui_internal) target_include_directories(imgui_internal PUBLIC ${Vulkan_INCLUDE_DIR}) diff --git a/cmake/SetupVulkan.cmake b/cmake/SetupVulkan.cmake index 24ed595..3a14b93 100644 --- a/cmake/SetupVulkan.cmake +++ b/cmake/SetupVulkan.cmake @@ -5,10 +5,14 @@ function(SetupVulkan TARGET) else () find_package(Vulkan REQUIRED) target_link_libraries(${TARGET} PRIVATE Vulkan::Vulkan) - find_package(Vulkan OPTIONAL_COMPONENTS shaderc_combined) - if (Vulkan_shaderc_combined_FOUND) - target_link_libraries(${TARGET} PRIVATE Vulkan::shaderc_combined) - target_compile_definitions(${TARGET} PRIVATE HAS_SHADERC) + if (NO_SHADERC) + message("Disable shaderc linking") + else() + find_package(Vulkan OPTIONAL_COMPONENTS shaderc_combined) + if (Vulkan_shaderc_combined_FOUND) + target_link_libraries(${TARGET} PRIVATE Vulkan::shaderc_combined) + target_compile_definitions(${TARGET} PRIVATE HAS_SHADERC) + endif () endif () endif () target_include_directories(${TARGET} PUBLIC ${Vulkan_INCLUDE_DIR})