This commit is contained in:
apteryks 2025-07-28 09:14:31 +09:00 committed by GitHub
commit 7df63f6231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 16 deletions

View File

@ -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})

View File

@ -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)

View File

@ -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)

View File

@ -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"