CMake: Reference shaderc/spirv-cross unconditionally

Should fix build with Vulkan disabled.
This commit is contained in:
Stenzek 2024-10-19 13:10:19 +10:00
parent d3234a29c8
commit 41c709ef6f
No known key found for this signature in database
2 changed files with 14 additions and 18 deletions

View File

@ -38,11 +38,10 @@ if(ENABLE_WAYLAND)
find_package(Wayland REQUIRED Egl)
endif()
if(ENABLE_VULKAN)
find_package(Shaderc REQUIRED)
find_package(spirv_cross_c_shared REQUIRED)
if(LINUX)
if(LINUX AND NOT (ALLOW_INSTALL AND INSTALL_SELF_CONTAINED))
# We need to add the rpath for shaderc to the executable.
get_target_property(SHADERC_LIBRARY Shaderc::shaderc_shared IMPORTED_LOCATION)
get_filename_component(SHADERC_LIBRARY_DIRECTORY ${SHADERC_LIBRARY} DIRECTORY)
@ -51,7 +50,6 @@ if(ENABLE_VULKAN)
get_filename_component(SPIRV_CROSS_LIBRARY_DIRECTORY ${SPIRV_CROSS_LIBRARY} DIRECTORY)
list(APPEND CMAKE_BUILD_RPATH ${SPIRV_CROSS_LIBRARY_DIRECTORY})
endif()
endif()
if(LINUX)
find_package(UDEV REQUIRED)

View File

@ -168,12 +168,10 @@ if(ENABLE_VULKAN)
target_link_libraries(util PUBLIC vulkan-headers)
endif()
if(ENABLE_VULKAN OR APPLE)
# shaderc/spirv-cross is loaded dynamically to reduce module loads on startup.
get_target_property(SHADERC_INCLUDE_DIR Shaderc::shaderc_shared INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(SPIRV_CROSS_INCLUDE_DIR spirv-cross-c-shared INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(util PUBLIC ${SHADERC_INCLUDE_DIR} ${SPIRV_CROSS_INCLUDE_DIR})
endif()
if(NOT ANDROID)
target_sources(util PRIVATE