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,19 +38,17 @@ if(ENABLE_WAYLAND)
find_package(Wayland REQUIRED Egl) find_package(Wayland REQUIRED Egl)
endif() endif()
if(ENABLE_VULKAN) find_package(Shaderc REQUIRED)
find_package(Shaderc REQUIRED) find_package(spirv_cross_c_shared 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. # We need to add the rpath for shaderc to the executable.
get_target_property(SHADERC_LIBRARY Shaderc::shaderc_shared IMPORTED_LOCATION) get_target_property(SHADERC_LIBRARY Shaderc::shaderc_shared IMPORTED_LOCATION)
get_filename_component(SHADERC_LIBRARY_DIRECTORY ${SHADERC_LIBRARY} DIRECTORY) get_filename_component(SHADERC_LIBRARY_DIRECTORY ${SHADERC_LIBRARY} DIRECTORY)
list(APPEND CMAKE_BUILD_RPATH ${SHADERC_LIBRARY_DIRECTORY}) list(APPEND CMAKE_BUILD_RPATH ${SHADERC_LIBRARY_DIRECTORY})
get_target_property(SPIRV_CROSS_LIBRARY spirv-cross-c-shared IMPORTED_LOCATION) get_target_property(SPIRV_CROSS_LIBRARY spirv-cross-c-shared IMPORTED_LOCATION)
get_filename_component(SPIRV_CROSS_LIBRARY_DIRECTORY ${SPIRV_CROSS_LIBRARY} DIRECTORY) get_filename_component(SPIRV_CROSS_LIBRARY_DIRECTORY ${SPIRV_CROSS_LIBRARY} DIRECTORY)
list(APPEND CMAKE_BUILD_RPATH ${SPIRV_CROSS_LIBRARY_DIRECTORY}) list(APPEND CMAKE_BUILD_RPATH ${SPIRV_CROSS_LIBRARY_DIRECTORY})
endif()
endif() endif()
if(LINUX) if(LINUX)

View File

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