[cmake] force external spirv-tools on apple, fix findpkg logic

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-08-25 12:51:27 -04:00
parent 9647025881
commit 76918a844f
4 changed files with 27 additions and 40 deletions

View file

@ -75,7 +75,9 @@ option(ENABLE_WIFI_SCAN "Enable WiFi scanning" OFF)
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ${EXT_DEFAULT})
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ${EXT_DEFAULT})
option(YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES "Use Vulkan-Utility-Libraries from externals" ${EXT_DEFAULT})
option(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ${EXT_DEFAULT})
# I hate Apple with a burning passion
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS "Use SPIRV-Tools from externals" ${EXT_DEFAULT} "NOT APPLE" ON)
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
@ -587,33 +589,6 @@ endif()
# SimpleIni
AddJsonPackage(simpleini)
# Most linux distros don't package cubeb, so enable regardless of cpm settings
if(ENABLE_CUBEB)
AddJsonPackage(cubeb)
if (cubeb_ADDED)
if (NOT MSVC)
if (TARGET speex)
target_compile_options(speex PRIVATE -Wno-sign-compare)
endif()
set_target_properties(cubeb PROPERTIES COMPILE_OPTIONS "")
target_compile_options(cubeb INTERFACE
-Wno-implicit-const-int-float-conversion
-Wno-shadow
-Wno-missing-declarations
-Wno-return-type
-Wno-uninitialized
)
else()
target_compile_options(cubeb PRIVATE
/wd4456
/wd4458
)
endif()
endif()
endif()
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package
if (ENABLE_SDL2)
if (YUZU_USE_EXTERNAL_SDL2)
@ -697,6 +672,8 @@ if (ENABLE_SDL2)
find_package(SDL2)
endif()
find_package(SPIRV-Tools)
if (ENABLE_QT)
if (YUZU_USE_BUNDLED_QT)
download_qt(6.8.3)

View file

@ -80,9 +80,15 @@ if (ENABLE_LIBUSB AND NOT TARGET libusb::usb)
endif()
# Sirit
# TODO(crueter): spirv-tools doesn't work w/ system
set(SPIRV_WERROR OFF)
AddJsonPackage(spirv-headers)
AddPackage(
NAME SPIRV-Headers
REPO "KhronosGroup/SPIRV-Headers"
SHA 4e209d3d7e
HASH f48bbe18341ed55ea0fe280dbbbc0a44bf222278de6e716e143ca1e95ca320b06d4d23d6583fbf8d03e1428f3dac8fa00e5b82ddcd6b425e6236d85af09550a4
# spirv-tools is stupid and doesn't know how to utilize system spirv headers
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS}
)
AddJsonPackage(sirit)
@ -138,16 +144,19 @@ AddJsonPackage(
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES}
)
# SPIRV Tools
AddJsonPackage(
NAME spirv-tools
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS}
# SPIRV-Tools
AddPackage(
NAME SPIRV-Tools
REPO "KhronosGroup/SPIRV-Tools"
SHA 40eb301f32
HASH 58d0fb1047d69373cf24c73e6f78c73a72a6cca3b4df1d9f083b9dcc0962745ef154abf3dbe9b3623b835be20c6ec769431cf11733349f45e7568b3525f707aa
OPTIONS
"SPIRV_SKIP_EXECUTABLES ON"
"SPIRV_TOOLS_BUILD_STATIC ON"
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_SPIRV_TOOLS}
)
if (SPIRV-Tools_ADDED)
add_library(SPIRV-Tools::SPIRV-Tools ALIAS SPIRV-Tools-static)
target_link_libraries(SPIRV-Tools-static PRIVATE SPIRV-Tools-opt SPIRV-Tools-link)
endif()
set(SPIRV-Tools_ADDED "${SPIRV-Tools_ADDED}" PARENT_SCOPE)
# TZDB (Time Zone Database)
add_subdirectory(nx_tzdb)

View file

@ -1184,7 +1184,6 @@ else()
)
endif()
target_include_directories(core PRIVATE ${OPUS_INCLUDE_DIRS})
target_link_libraries(core PUBLIC common PRIVATE audio_core hid_core network video_core nx_tzdb tz)
if (BOOST_NO_HEADERS)

View file

@ -246,7 +246,9 @@ add_library(shader_recompiler STATIC
)
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools::SPIRV-Tools)
# This can actually cause issues e.g. with Apple
# but forcing external spirv-tools works there
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools-opt SPIRV-Tools SPIRV-Tools-link)
if (MSVC)
target_compile_options(shader_recompiler PRIVATE