From 064625ef58d4166b4983119f5389118113505a84 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Thu, 28 Jul 2022 16:44:52 +0200 Subject: build: simplify find modules With this patch I've deleted a few find modules that are now unused since the vcpkg transition, as the CMake code now forces CONFIG mode for Catch2, fmt and nlohmann_json. I've then simplified the lz4, opus, and zstd modules by exclusively using pkg-config. They were using it already, but were ignoring the result. Also, I believe that manually looking for libraries was required for Conan to work, and it is thus not needed anymore. Lastly, I believe that there is no platform that ships these system libs without pkg-config/pkgconf, so requiring it should be fine. --- externals/find-modules/Findopus.cmake | 49 +++++++++-------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) (limited to 'externals/find-modules/Findopus.cmake') diff --git a/externals/find-modules/Findopus.cmake b/externals/find-modules/Findopus.cmake index ec7b4f61f..4ebf9ef7b 100644 --- a/externals/find-modules/Findopus.cmake +++ b/externals/find-modules/Findopus.cmake @@ -1,44 +1,19 @@ -# SPDX-FileCopyrightText: 2020 yuzu Emulator Project +# SPDX-FileCopyrightText: 2022 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(PkgConfig QUIET) -pkg_check_modules(PC_opus QUIET opus) +find_package(PkgConfig) -find_path(opus_INCLUDE_DIR - NAMES opus.h - PATHS ${PC_opus_INCLUDE_DIRS} - PATH_SUFFIXES opus -) -find_library(opus_LIBRARY - NAMES opus - PATHS ${PC_opus_LIBRARY_DIRS} -) +if (PKG_CONFIG_FOUND) + pkg_search_module(opus IMPORTED_TARGET GLOBAL opus) + if (opus_FOUND) + add_library(Opus::Opus ALIAS PkgConfig::opus) + endif() +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(opus - FOUND_VAR opus_FOUND - REQUIRED_VARS - opus_LIBRARY - opus_INCLUDE_DIR - VERSION_VAR opus_VERSION -) - -if(opus_FOUND) - set(Opus_LIBRARIES ${opus_LIBRARY}) - set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR}) - set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER}) -endif() - -if(opus_FOUND AND NOT TARGET Opus::Opus) - add_library(Opus::Opus UNKNOWN IMPORTED GLOBAL) - set_target_properties(Opus::Opus PROPERTIES - IMPORTED_LOCATION "${opus_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}" - ) -endif() - -mark_as_advanced( - opus_INCLUDE_DIR - opus_LIBRARY + REQUIRED_VARS + opus_LINK_LIBRARIES + opus_FOUND + VERSION_VAR opus_VERSION ) -- cgit v1.2.3 From adc8c03fe463c9c0aaa2cfcbc502bc65dc7b99b6 Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Mon, 1 Aug 2022 12:31:31 +0200 Subject: build(externals): rename Findopus to FindOpus This better matches upstream's FindOpus.cmake file, and it will make using upstream's FindOpus.cmake file easier. --- externals/find-modules/Findopus.cmake | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 externals/find-modules/Findopus.cmake (limited to 'externals/find-modules/Findopus.cmake') diff --git a/externals/find-modules/Findopus.cmake b/externals/find-modules/Findopus.cmake deleted file mode 100644 index 4ebf9ef7b..000000000 --- a/externals/find-modules/Findopus.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-FileCopyrightText: 2022 yuzu Emulator Project -# SPDX-License-Identifier: GPL-2.0-or-later - -find_package(PkgConfig) - -if (PKG_CONFIG_FOUND) - pkg_search_module(opus IMPORTED_TARGET GLOBAL opus) - if (opus_FOUND) - add_library(Opus::Opus ALIAS PkgConfig::opus) - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(opus - REQUIRED_VARS - opus_LINK_LIBRARIES - opus_FOUND - VERSION_VAR opus_VERSION -) -- cgit v1.2.3