diff options
author | Alexandre Bouvier <contact@amb.tf> | 2022-11-25 19:35:46 +0100 |
---|---|---|
committer | Alexandre Bouvier <contact@amb.tf> | 2022-12-04 17:09:25 +0100 |
commit | 8e17b5469fc7f5211fc3e24841896ea030adce84 (patch) | |
tree | c5baf2ed91c115c7f07063297d2cd611e73b6713 /externals | |
parent | Merge pull request #9375 from jbeich/xbyak-no-install (diff) | |
download | yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar.gz yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar.bz2 yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar.lz yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar.xz yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.tar.zst yuzu-8e17b5469fc7f5211fc3e24841896ea030adce84.zip |
Diffstat (limited to 'externals')
-rw-r--r-- | externals/CMakeLists.txt | 45 | ||||
-rw-r--r-- | externals/find-modules/FindDiscordRPC.cmake | 27 | ||||
-rw-r--r-- | externals/find-modules/Findenet.cmake | 17 | ||||
-rw-r--r-- | externals/find-modules/Findhttplib.cmake | 22 | ||||
-rw-r--r-- | externals/find-modules/Findinih.cmake | 17 | ||||
-rw-r--r-- | externals/find-modules/Findlz4.cmake | 37 | ||||
-rw-r--r-- | externals/find-modules/Findzstd.cmake | 37 | ||||
-rw-r--r-- | externals/inih/CMakeLists.txt | 3 |
8 files changed, 163 insertions, 42 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index d25626ccc..8bb321e35 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) @@ -73,25 +76,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) @@ -119,18 +127,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 @@ -141,3 +151,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/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/Findenet.cmake b/externals/find-modules/Findenet.cmake new file mode 100644 index 000000000..663a2592f --- /dev/null +++ b/externals/find-modules/Findenet.cmake @@ -0,0 +1,17 @@ +# 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 GLOBAL libenet) + if (ENET_FOUND) + add_library(enet::enet ALIAS PkgConfig::ENET) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(enet + REQUIRED_VARS ENET_LINK_LIBRARIES + VERSION_VAR ENET_VERSION +) diff --git a/externals/find-modules/Findhttplib.cmake b/externals/find-modules/Findhttplib.cmake new file mode 100644 index 000000000..56e92a637 --- /dev/null +++ b/externals/find-modules/Findhttplib.cmake @@ -0,0 +1,22 @@ +# 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 GLOBAL cpp-httplib) + if (HTTPLIB_FOUND) + add_library(httplib::httplib ALIAS PkgConfig::HTTPLIB) + endif() + endif() + find_package_handle_standard_args(httplib + REQUIRED_VARS HTTPLIB_INCLUDEDIR + VERSION_VAR HTTPLIB_VERSION + ) +endif() diff --git a/externals/find-modules/Findinih.cmake b/externals/find-modules/Findinih.cmake new file mode 100644 index 000000000..844396471 --- /dev/null +++ b/externals/find-modules/Findinih.cmake @@ -0,0 +1,17 @@ +# 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 GLOBAL INIReader) + if (INIREADER_FOUND) + add_library(inih::INIReader ALIAS PkgConfig::INIREADER) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(inih + REQUIRED_VARS INIREADER_LINK_LIBRARIES + VERSION_VAR INIREADER_VERSION +) diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake index 13ca5de66..a928c4307 100644 --- a/externals/find-modules/Findlz4.cmake +++ b/externals/find-modules/Findlz4.cmake @@ -1,19 +1,30 @@ # 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) + if (NOT TARGET lz4::lz4) + if (TARGET LZ4::lz4_shared) + set_target_properties(LZ4::lz4_shared PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(lz4::lz4 ALIAS LZ4::lz4_shared) + else() + set_target_properties(LZ4::lz4_static PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(lz4::lz4 ALIAS LZ4::lz4_static) + endif() + endif() +else() + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_search_module(liblz4 QUIET IMPORTED_TARGET GLOBAL liblz4) + if (liblz4_FOUND) + add_library(lz4::lz4 ALIAS PkgConfig::liblz4) + endif() endif() + find_package_handle_standard_args(lz4 + REQUIRED_VARS liblz4_LINK_LIBRARIES + VERSION_VAR liblz4_VERSION + ) endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(lz4 - REQUIRED_VARS - liblz4_LINK_LIBRARIES - liblz4_FOUND - VERSION_VAR liblz4_VERSION -) diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake index f4031eb70..1c29f3598 100644 --- a/externals/find-modules/Findzstd.cmake +++ b/externals/find-modules/Findzstd.cmake @@ -1,19 +1,30 @@ # 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) + if (NOT TARGET zstd::zstd) + if (TARGET zstd::libzstd_shared) + set_target_properties(zstd::libzstd_shared PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(zstd::zstd ALIAS zstd::libzstd_shared) + else() + set_target_properties(zstd::libzstd_static PROPERTIES IMPORTED_GLOBAL TRUE) + add_library(zstd::zstd ALIAS zstd::libzstd_static) + endif() + endif() +else() + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_search_module(libzstd QUIET IMPORTED_TARGET GLOBAL libzstd) + if (libzstd_FOUND) + add_library(zstd::zstd ALIAS PkgConfig::libzstd) + endif() endif() + find_package_handle_standard_args(zstd + REQUIRED_VARS libzstd_LINK_LIBRARIES + VERSION_VAR libzstd_VERSION + ) endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(zstd - REQUIRED_VARS - libzstd_LINK_LIBRARIES - libzstd_FOUND - VERSION_VAR libzstd_VERSION -) 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) |