diff options
Diffstat (limited to '')
-rw-r--r-- | externals/CMakeLists.txt | 49 | ||||
m--------- | externals/dynarmic | 0 | ||||
-rw-r--r-- | externals/find-modules/FindDiscordRPC.cmake | 27 | ||||
-rw-r--r-- | externals/find-modules/FindLibUSB.cmake | 44 | ||||
-rw-r--r-- | externals/find-modules/FindOpus.cmake | 18 | ||||
-rw-r--r-- | externals/find-modules/Findenet.cmake | 18 | ||||
-rw-r--r-- | externals/find-modules/Findhttplib.cmake | 23 | ||||
-rw-r--r-- | externals/find-modules/Findinih.cmake | 18 | ||||
-rw-r--r-- | externals/find-modules/Findlibusb.cmake | 18 | ||||
-rw-r--r-- | externals/find-modules/Findlz4.cmake | 33 | ||||
-rw-r--r-- | externals/find-modules/Findzstd.cmake | 33 | ||||
-rw-r--r-- | externals/inih/CMakeLists.txt | 3 | ||||
-rw-r--r-- | externals/libusb/CMakeLists.txt | 2 |
13 files changed, 190 insertions, 96 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index eb6cb706d..4ffafd18c 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -6,15 +6,16 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/externals/find-modules") include(DownloadExternals) # xbyak -if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) +if ((ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) AND NOT TARGET xbyak::xbyak) add_subdirectory(xbyak EXCLUDE_FROM_ALL) endif() # Dynarmic -if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) +if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmic) set(DYNARMIC_NO_BUNDLED_FMT ON) set(DYNARMIC_IGNORE_ASSERTS ON CACHE BOOL "" FORCE) - add_subdirectory(dynarmic) + add_subdirectory(dynarmic EXCLUDE_FROM_ALL) + add_library(dynarmic::dynarmic ALIAS dynarmic) endif() # getopt @@ -26,7 +27,9 @@ endif() add_subdirectory(glad) # inih -add_subdirectory(inih) +if (NOT TARGET inih::INIReader) + add_subdirectory(inih) +endif() # mbedtls add_subdirectory(mbedtls EXCLUDE_FROM_ALL) @@ -42,8 +45,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12" AND CMAKE_CXX_COMPILER endif() # libusb -if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) - add_subdirectory(libusb) +if (NOT TARGET libusb::usb) + add_subdirectory(libusb EXCLUDE_FROM_ALL) endif() # SDL2 @@ -72,25 +75,30 @@ if (YUZU_USE_EXTERNAL_SDL2) endif() # ENet -add_subdirectory(enet) -target_include_directories(enet INTERFACE ./enet/include) +if (NOT TARGET enet::enet) + add_subdirectory(enet EXCLUDE_FROM_ALL) + target_include_directories(enet INTERFACE ./enet/include) + add_library(enet::enet ALIAS enet) +endif() # Cubeb -if(ENABLE_CUBEB) +if (ENABLE_CUBEB AND NOT TARGET cubeb::cubeb) set(BUILD_TESTS OFF CACHE BOOL "") add_subdirectory(cubeb EXCLUDE_FROM_ALL) + add_library(cubeb::cubeb ALIAS cubeb) endif() # DiscordRPC -if (USE_DISCORD_PRESENCE) +if (USE_DISCORD_PRESENCE AND NOT TARGET DiscordRPC::discord-rpc) add_subdirectory(discord-rpc EXCLUDE_FROM_ALL) target_include_directories(discord-rpc INTERFACE ./discord-rpc/include) + add_library(DiscordRPC::discord-rpc ALIAS discord-rpc) endif() # Sirit -add_subdirectory(sirit) +add_subdirectory(sirit EXCLUDE_FROM_ALL) -if (ENABLE_WEB_SERVICE) +if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib) if (NOT WIN32) find_package(OpenSSL 1.1) if (OPENSSL_FOUND) @@ -118,18 +126,20 @@ if (ENABLE_WEB_SERVICE) if (WIN32) target_link_libraries(httplib INTERFACE crypt32 cryptui ws2_32) endif() - - # cpp-jwt + add_library(httplib::httplib ALIAS httplib) +endif() + +# cpp-jwt +if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt) add_library(cpp-jwt INTERFACE) target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include) target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON) + add_library(cpp-jwt::cpp-jwt ALIAS cpp-jwt) endif() # Opus -if (YUZU_USE_BUNDLED_OPUS) +if (NOT TARGET Opus::opus) add_subdirectory(opus EXCLUDE_FROM_ALL) -else() - find_package(Opus 1.3 REQUIRED) endif() # FFMpeg @@ -140,3 +150,8 @@ if (YUZU_USE_BUNDLED_FFMPEG) set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE) endif() + +# Vulkan-Headers +if (NOT TARGET Vulkan::Headers) + add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL) +endif() diff --git a/externals/dynarmic b/externals/dynarmic -Subproject a76a2fff534b5584c9921bc5c060e910e95b773 +Subproject bd570e093ca1d1206961296b90df65cda7de8e8 diff --git a/externals/find-modules/FindDiscordRPC.cmake b/externals/find-modules/FindDiscordRPC.cmake new file mode 100644 index 000000000..44ca9904f --- /dev/null +++ b/externals/find-modules/FindDiscordRPC.cmake @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +find_path(DiscordRPC_INCLUDE_DIR discord_rpc.h) + +find_library(DiscordRPC_LIBRARY discord-rpc) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DiscordRPC + REQUIRED_VARS + DiscordRPC_LIBRARY + DiscordRPC_INCLUDE_DIR +) + +if (DiscordRPC_FOUND AND NOT TARGET DiscordRPC::discord-rpc) + add_library(DiscordRPC::discord-rpc UNKNOWN IMPORTED) + set_target_properties(DiscordRPC::discord-rpc PROPERTIES + IMPORTED_LOCATION "${DiscordRPC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${DiscordRPC_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + DiscordRPC_INCLUDE_DIR + DiscordRPC_LIBRARY +) diff --git a/externals/find-modules/FindLibUSB.cmake b/externals/find-modules/FindLibUSB.cmake deleted file mode 100644 index 617daf9a5..000000000 --- a/externals/find-modules/FindLibUSB.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-FileCopyrightText: 2009 Michal Cihar <michal@cihar.com> -# SPDX-License-Identifier: GPL-2.0-or-later - -# - Find libusb-1.0 library -# This module defines -# LIBUSB_INCLUDE_DIR, where to find bluetooth.h -# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0. -# LIBUSB_FOUND, If false, do not try to use libusb-1.0. -# -# vim: expandtab sw=4 ts=4 sts=4: - -if(ANDROID) - set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") - message(STATUS "libusb-1.0 not found.") -elseif (NOT LIBUSB_FOUND) - pkg_check_modules (LIBUSB_PKG libusb-1.0) - - find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h - PATHS - ${LIBUSB_PKG_INCLUDE_DIRS} - /usr/include/libusb-1.0 - /usr/include - /usr/local/include/libusb-1.0 - /usr/local/include - ) - - find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb - PATHS - ${LIBUSB_PKG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - ) - - if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") - message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") - else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") - message(STATUS "libusb-1.0 not found.") - endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - - mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) -endif () - diff --git a/externals/find-modules/FindOpus.cmake b/externals/find-modules/FindOpus.cmake index b68a6046b..2ba515352 100644 --- a/externals/find-modules/FindOpus.cmake +++ b/externals/find-modules/FindOpus.cmake @@ -1,19 +1,17 @@ # SPDX-FileCopyrightText: 2022 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(PkgConfig) - +find_package(PkgConfig QUIET) if (PKG_CONFIG_FOUND) - pkg_search_module(opus IMPORTED_TARGET GLOBAL opus) - if (opus_FOUND) - add_library(Opus::opus ALIAS PkgConfig::opus) - endif() + pkg_search_module(OPUS QUIET IMPORTED_TARGET opus) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Opus - REQUIRED_VARS - opus_LINK_LIBRARIES - opus_FOUND - VERSION_VAR opus_VERSION + REQUIRED_VARS OPUS_LINK_LIBRARIES + VERSION_VAR OPUS_VERSION ) + +if (Opus_FOUND AND NOT TARGET Opus::opus) + add_library(Opus::opus ALIAS PkgConfig::OPUS) +endif() diff --git a/externals/find-modules/Findenet.cmake b/externals/find-modules/Findenet.cmake new file mode 100644 index 000000000..6dae76f4c --- /dev/null +++ b/externals/find-modules/Findenet.cmake @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +find_package(PkgConfig QUIET) +if (PKG_CONFIG_FOUND) + pkg_search_module(ENET QUIET IMPORTED_TARGET libenet) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(enet + REQUIRED_VARS ENET_LINK_LIBRARIES + VERSION_VAR ENET_VERSION +) + +if (enet_FOUND AND NOT TARGET enet::enet) + add_library(enet::enet ALIAS PkgConfig::ENET) +endif() diff --git a/externals/find-modules/Findhttplib.cmake b/externals/find-modules/Findhttplib.cmake new file mode 100644 index 000000000..b72bad076 --- /dev/null +++ b/externals/find-modules/Findhttplib.cmake @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2022 Andrea Pappacoda <andrea@pappacoda.it> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +include(FindPackageHandleStandardArgs) + +find_package(httplib QUIET CONFIG) +if (httplib_FOUND) + find_package_handle_standard_args(httplib CONFIG_MODE) +else() + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET cpp-httplib) + endif() + find_package_handle_standard_args(httplib + REQUIRED_VARS HTTPLIB_INCLUDEDIR + VERSION_VAR HTTPLIB_VERSION + ) +endif() + +if (httplib_FOUND AND NOT TARGET httplib::httplib) + add_library(httplib::httplib ALIAS PkgConfig::HTTPLIB) +endif() diff --git a/externals/find-modules/Findinih.cmake b/externals/find-modules/Findinih.cmake new file mode 100644 index 000000000..8d1a07243 --- /dev/null +++ b/externals/find-modules/Findinih.cmake @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +find_package(PkgConfig QUIET) +if (PKG_CONFIG_FOUND) + pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(inih + REQUIRED_VARS INIREADER_LINK_LIBRARIES + VERSION_VAR INIREADER_VERSION +) + +if (inih_FOUND AND NOT TARGET inih::INIReader) + add_library(inih::INIReader ALIAS PkgConfig::INIREADER) +endif() diff --git a/externals/find-modules/Findlibusb.cmake b/externals/find-modules/Findlibusb.cmake new file mode 100644 index 000000000..66f61001c --- /dev/null +++ b/externals/find-modules/Findlibusb.cmake @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +find_package(PkgConfig QUIET) +if (PKG_CONFIG_FOUND) + pkg_search_module(LIBUSB QUIET IMPORTED_TARGET libusb-1.0) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(libusb + REQUIRED_VARS LIBUSB_LINK_LIBRARIES + VERSION_VAR LIBUSB_VERSION +) + +if (libusb_FOUND AND NOT TARGET libusb::usb) + add_library(libusb::usb ALIAS PkgConfig::LIBUSB) +endif() diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake index 13ca5de66..f4c7005ba 100644 --- a/externals/find-modules/Findlz4.cmake +++ b/externals/find-modules/Findlz4.cmake @@ -1,19 +1,28 @@ # SPDX-FileCopyrightText: 2022 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(PkgConfig) +include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_FOUND) - pkg_search_module(liblz4 IMPORTED_TARGET GLOBAL liblz4) - if (liblz4_FOUND) - add_library(lz4::lz4 ALIAS PkgConfig::liblz4) +find_package(lz4 QUIET CONFIG) +if (lz4_FOUND) + find_package_handle_standard_args(lz4 CONFIG_MODE) +else() + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_search_module(LZ4 QUIET IMPORTED_TARGET liblz4) endif() + find_package_handle_standard_args(lz4 + REQUIRED_VARS LZ4_LINK_LIBRARIES + VERSION_VAR LZ4_VERSION + ) endif() -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(lz4 - REQUIRED_VARS - liblz4_LINK_LIBRARIES - liblz4_FOUND - VERSION_VAR liblz4_VERSION -) +if (lz4_FOUND AND NOT TARGET lz4::lz4) + if (TARGET LZ4::lz4_shared) + add_library(lz4::lz4 ALIAS LZ4::lz4_shared) + elseif (TARGET LZ4::lz4_static) + add_library(lz4::lz4 ALIAS LZ4::lz4_static) + else() + add_library(lz4::lz4 ALIAS PkgConfig::LZ4) + endif() +endif() diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake index f4031eb70..1aacc41d0 100644 --- a/externals/find-modules/Findzstd.cmake +++ b/externals/find-modules/Findzstd.cmake @@ -1,19 +1,28 @@ # SPDX-FileCopyrightText: 2022 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(PkgConfig) +include(FindPackageHandleStandardArgs) -if (PKG_CONFIG_FOUND) - pkg_search_module(libzstd IMPORTED_TARGET GLOBAL libzstd) - if (libzstd_FOUND) - add_library(zstd::zstd ALIAS PkgConfig::libzstd) +find_package(zstd QUIET CONFIG) +if (zstd_FOUND) + find_package_handle_standard_args(zstd CONFIG_MODE) +else() + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_search_module(ZSTD QUIET IMPORTED_TARGET libzstd) endif() + find_package_handle_standard_args(zstd + REQUIRED_VARS ZSTD_LINK_LIBRARIES + VERSION_VAR ZSTD_VERSION + ) endif() -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(zstd - REQUIRED_VARS - libzstd_LINK_LIBRARIES - libzstd_FOUND - VERSION_VAR libzstd_VERSION -) +if (zstd_FOUND AND NOT TARGET zstd::zstd) + if (TARGET zstd::libzstd_shared) + add_library(zstd::zstd ALIAS zstd::libzstd_shared) + elseif (TARGET zstd::libzstd_static) + add_library(zstd::zstd ALIAS zstd::libzstd_static) + else() + add_library(zstd::zstd ALIAS PkgConfig::ZSTD) + endif() +endif() diff --git a/externals/inih/CMakeLists.txt b/externals/inih/CMakeLists.txt index b686e3cf5..ebb60a976 100644 --- a/externals/inih/CMakeLists.txt +++ b/externals/inih/CMakeLists.txt @@ -9,4 +9,5 @@ add_library(inih ) create_target_directory_groups(inih) -target_include_directories(inih INTERFACE .) +target_include_directories(inih INTERFACE inih/cpp) +add_library(inih::INIReader ALIAS inih) diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt index 3cb1b3687..6317ea807 100644 --- a/externals/libusb/CMakeLists.txt +++ b/externals/libusb/CMakeLists.txt @@ -273,3 +273,5 @@ else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") configure_file(config.h.in config.h) endif() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + +add_library(libusb::usb ALIAS usb) |