mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-14 19:29:52 +00:00
CMake: Allow both glslang 15 and 16
This commit is contained in:
parent
5af9bd5e46
commit
143fac254e
@ -54,7 +54,42 @@ function(dolphin_find_optional_system_library library bundled_path)
|
||||
dolphin_optional_system_library(use_system ${library})
|
||||
string(TOUPPER ${library} upperlib)
|
||||
if(use_system)
|
||||
find_package(${library} ${ARGN})
|
||||
# Try a list of versions
|
||||
# Will be obsoleted if cmake ever fixes https://gitlab.kitware.com/cmake/cmake/-/issues/26477
|
||||
if("DOLPHIN_TRY_VERSIONS" IN_LIST ARGN)
|
||||
list(FIND ARGN DOLPHIN_TRY_VERSIONS versions_idx)
|
||||
list(REMOVE_AT ARGN ${versions_idx})
|
||||
# Extract list of version-like elements from ARGN into version_list
|
||||
set(version_list)
|
||||
while(TRUE)
|
||||
list(LENGTH ARGN len)
|
||||
if(len EQUAL versions_idx)
|
||||
break()
|
||||
endif()
|
||||
LIST(GET ARGN ${versions_idx} ver)
|
||||
if(ver MATCHES "^[0-9]+(\\.[0-9]+)*$")
|
||||
list(APPEND version_list "${ver}")
|
||||
list(REMOVE_AT ARGN ${versions_idx})
|
||||
else()
|
||||
break()
|
||||
endif()
|
||||
endwhile()
|
||||
# Quietly check all the listed versions
|
||||
foreach(version IN LISTS version_list)
|
||||
find_package(${library} ${version} ${ARGN} QUIET)
|
||||
if(${library}_FOUND)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
# If none were found, find_package one version loudly so the user sees
|
||||
if(NOT ${library}_FOUND)
|
||||
list(GET version_list 0 first_version)
|
||||
find_package(${library} ${first_version} ${ARGN})
|
||||
endif()
|
||||
else()
|
||||
find_package(${library} ${ARGN})
|
||||
endif()
|
||||
|
||||
# Yay for cmake packages being inconsistent
|
||||
if(DEFINED ${library}_FOUND)
|
||||
set(prefix ${library})
|
||||
|
||||
@ -646,7 +646,7 @@ dolphin_find_optional_system_library_pkgconfig(FMT
|
||||
add_subdirectory(Externals/imgui)
|
||||
add_subdirectory(Externals/implot)
|
||||
|
||||
dolphin_find_optional_system_library(glslang Externals/glslang 15.0)
|
||||
dolphin_find_optional_system_library(glslang Externals/glslang DOLPHIN_TRY_VERSIONS 15 16)
|
||||
|
||||
# SPIRV-Cross is used on Windows for GLSL to HLSL conversion for the Direct3D 11 and Direct3D 12
|
||||
# video backends, and on Apple devices for the Metal video backend.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user