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 #include -#include +#include #include "Common/IOFile.h" #include "Common/Logging/Log.h"