guix-mirrors/gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch
Maxim Cournoyer 186a9714a3
gnu: dolphin-emu: Update to 2506-0.79a3af2.
* gnu/packages/emulators.scm (dolphin-emu): Update to 2506-0.79a3af2.
[source] {patches}: Update patches.
(dolphin-rcheevos-submodule): New variable.
[source]: Refine and update snippet.
[#:phases] {remove-unittests-target-post-build-command}: Delete.
{generate-fonts&hardcode-libvulkan-path}: Fix typo in phase name. Remove
obsolete cstdint patching.
{post-check}: Delete.
[#:configure-flags]: Streamline. Add -DUSE_DISCORD_PRESENCE=OFF.
[native-inputs]: Add googletest
[inputs]: Replace ffmpeg-4 with ffmpeg. Replace fmt-7 with fmt-11. Replace
gtk+-2 with gtk+ and minizip-ng-compat with minizip-ng. Add lz4,
mgba-for-dolphin, qtsvg, spirv-cross, spng, tinygltf, vulkan-headers,
vulkan-memory-allocator and watcher. Replace qtbase-5 with qtbase. Replace
sdl2 with sdl3. Replace sfml-2 with sfml. Remove soundtouch-1/integer-samples.
(libretro-dolphin-emu): Update to 5.0-1.a09f78f.
[source]: Break inheritance with dolphin-emu, adjusting snippet for its older
code base.
[patches]: Apply libretro-dolphin-emu-libusb-assert.patch and
libretro-dolphin-emu-vulkan-headers.patch.
[#:phases] {link-unittest-to-gtest}: New phase.
[inputs]: Do not inherit from dolphin-emu. Replace fmt-7 with fmt. Replace
minizip-ng with minizip-ng-compat.
googletest, vulkan-headers.
* gnu/packages/patches/dolphin-emu-data.patch: Delete file.
* gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch
* gnu/packages/patches/dolphin-emu-unbundle-watcher.patch
* gnu/packages/patches/libretro-dolphin-emu-gc-font-tool.patch
* gnu/packages/patches/libretro-dolphin-emu-libusb-assert.patch
* gnu/packages/patches/libretro-dolphin-emu-vulkan-headers.patch: New files.
* gnu/local.mk (dist_patch_DATA): Update accordingly.

Fixes: #1327
Change-Id: I5a870a5e29c1ca243fb1d5e049ee06c5e254a04f
2025-08-01 11:47:41 +09:00

80 lines
3.3 KiB
Diff

Upstream-status: https://github.com/dolphin-emu/dolphin/pull/13824
diff --git a/CMake/DolphinLibraryTools.cmake b/CMake/DolphinLibraryTools.cmake
index 4c395a8ef9..efa0d6a9e2 100644
--- a/CMake/DolphinLibraryTools.cmake
+++ b/CMake/DolphinLibraryTools.cmake
@@ -1,14 +1,3 @@
-# like add_library(new ALIAS old) but avoids add_library cannot create ALIAS target "new" because target "old" is imported but not globally visible. on older cmake
-# This can be replaced with a direct alias call once our minimum is cmake 3.18
-function(dolphin_alias_library new old)
- string(REPLACE "::" "" library_no_namespace ${old})
- if (NOT TARGET _alias_${library_no_namespace})
- add_library(_alias_${library_no_namespace} INTERFACE)
- target_link_libraries(_alias_${library_no_namespace} INTERFACE ${old})
- endif()
- add_library(${new} ALIAS _alias_${library_no_namespace})
-endfunction()
-
# Makes an imported target if it doesn't exist. Useful for when find scripts from older versions of cmake don't make the targets you need
function(dolphin_make_imported_target_if_missing target lib)
if(${lib}_FOUND AND NOT TARGET ${target})
@@ -85,7 +74,7 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
endif()
if(${library}_FOUND)
message(STATUS "Using system ${library}")
- dolphin_alias_library(${alias} PkgConfig::${library})
+ add_library(${alias} ALIAS PkgConfig::${library})
set(${library}_TYPE "System" PARENT_SCOPE)
else()
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c277e2a10a..67b72179f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
########################################
# General setup
#
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0079 NEW) # let target_link_libraries() link to a target defined in a different directory
cmake_policy(SET CMP0080 OLD) # allow using BundleUtilities at configure time
@@ -657,7 +657,11 @@ add_subdirectory(Externals/glslang)
if(WIN32 OR APPLE)
add_subdirectory(Externals/spirv_cross)
endif()
-add_subdirectory(Externals/tinygltf)
+
+dolphin_find_optional_system_library(TinyGLTF Externals/tinygltf)
+if(NOT DEFINED tinygltf)
+ add_library(tinygltf ALIAS tinygltf::tinygltf) # using system library
+endif()
if(ENABLE_VULKAN)
add_definitions(-DHAS_VULKAN)
diff --git a/Externals/tinygltf/CMakeLists.txt b/Externals/tinygltf/CMakeLists.txt
index 0d86268bbe..9e6a99c6f8 100644
--- a/Externals/tinygltf/CMakeLists.txt
+++ b/Externals/tinygltf/CMakeLists.txt
@@ -7,5 +7,5 @@ if (NOT MSVC)
endif()
target_sources(tinygltf PRIVATE
tinygltf/tiny_gltf.cc)
-target_include_directories(tinygltf INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(tinygltf INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/tinygltf)
dolphin_disable_warnings(tinygltf)
diff --git a/Source/Core/VideoCommon/Assets/MeshAsset.cpp b/Source/Core/VideoCommon/Assets/MeshAsset.cpp
index bde8c8aab6..13eb2b4448 100644
--- a/Source/Core/VideoCommon/Assets/MeshAsset.cpp
+++ b/Source/Core/VideoCommon/Assets/MeshAsset.cpp
@@ -7,7 +7,7 @@
#include <array>
#include <utility>
-#include <tinygltf/tiny_gltf.h>
+#include <tiny_gltf.h>
#include "Common/IOFile.h"
#include "Common/Logging/Log.h"