[cmake] fix SPIRV-Tools

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-08-27 14:50:35 -04:00
parent 55c390506f
commit 42e2f8cb09
5 changed files with 31 additions and 8 deletions

View file

@ -529,12 +529,6 @@ if(ENABLE_CUBEB)
endif() endif()
endif() endif()
# TODO(crueter): Work around this
if (NOT YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SPIRV-Tools REQUIRED SPIRV-Tools)
endif()
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package # 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 (ENABLE_SDL2)
if (YUZU_USE_EXTERNAL_SDL2) if (YUZU_USE_EXTERNAL_SDL2)
@ -604,6 +598,7 @@ add_subdirectory(externals)
find_package(VulkanHeaders) find_package(VulkanHeaders)
find_package(VulkanUtilityLibraries) find_package(VulkanUtilityLibraries)
find_package(VulkanMemoryAllocator) find_package(VulkanMemoryAllocator)
find_package(SPIRV-Tools)
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
find_package(httplib) find_package(httplib)

View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
pkg_search_module(SPIRV-Tools QUIET IMPORTED_TARGET SPIRV-Tools)
find_package_handle_standard_args(SPIRV-Tools
REQUIRED_VARS SPIRV-Tools_LINK_LIBRARIES
VERSION_VAR SPIRV-Tools_VERSION
)
if (SPIRV-Tools_FOUND AND NOT TARGET SPIRV-Tools::SPIRV-Tools)
if (TARGET SPIRV-Tools)
add_library(SPIRV-Tools::SPIRV-Tools ALIAS SPIRV-Tools)
else()
add_library(SPIRV-Tools::SPIRV-Tools ALIAS PkgConfig::SPIRV-Tools)
endif()
endif()

View file

@ -131,7 +131,15 @@ AddJsonPackage(
) )
# SPIRV Tools # SPIRV Tools
AddJsonPackage(spirv-tools) AddJsonPackage(
NAME spirv-tools
BUNDLED_PACKAGE ${YUZU_USE_EXTERNAL_VULKAN_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()
# TZDB (Time Zone Database) # TZDB (Time Zone Database)
add_subdirectory(nx_tzdb) add_subdirectory(nx_tzdb)

View file

@ -67,6 +67,7 @@
"repo": "KhronosGroup/SPIRV-Tools", "repo": "KhronosGroup/SPIRV-Tools",
"sha": "40eb301f32", "sha": "40eb301f32",
"hash": "58d0fb1047d69373cf24c73e6f78c73a72a6cca3b4df1d9f083b9dcc0962745ef154abf3dbe9b3623b835be20c6ec769431cf11733349f45e7568b3525f707aa", "hash": "58d0fb1047d69373cf24c73e6f78c73a72a6cca3b4df1d9f083b9dcc0962745ef154abf3dbe9b3623b835be20c6ec769431cf11733349f45e7568b3525f707aa",
"find_args": "MODULE",
"options": [ "options": [
"SPIRV_SKIP_EXECUTABLES ON" "SPIRV_SKIP_EXECUTABLES ON"
] ]

View file

@ -246,7 +246,7 @@ add_library(shader_recompiler STATIC
) )
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools-opt SPIRV-Tools SPIRV-Tools-link) target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools::SPIRV-Tools)
if (MSVC) if (MSVC)
target_compile_options(shader_recompiler PRIVATE target_compile_options(shader_recompiler PRIVATE