VERY experimental Nintendo Switch 2 emulator
C++
cmake: prefer system gamemode library
Alexandre Bouvier6d1049366dba
diff --git a/.reuse/dep5 b/.reuse/dep5index d682fbdba4..d98b78087a 100644--- a/.reuse/dep5+++ b/.reuse/dep5@@ -151,3 +151,7 @@ License: GPL-3.0-or-laterFiles: externals/stb/*Copyright: Sean BarrettLicense: MIT++Files: externals/gamemode/*+Copyright: Copyright 2017-2019 Feral Interactive+License: BSD-3-Clausediff --git a/CMakeLists.txt b/CMakeLists.txtindex 599f7c8313..18b8f7967d 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -343,6 +343,10 @@ if(ENABLE_OPENSSL)find_package(OpenSSL 1.1.1 REQUIRED)endif()+if (UNIX AND NOT APPLE)+ find_package(gamemode 1.7 MODULE)+endif()+# Please consider this as a stubif(ENABLE_QT6 AND Qt6_LOCATION)list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}")diff --git a/CMakeModules/Findgamemode.cmake b/CMakeModules/Findgamemode.cmakenew file mode 100644index 0000000000..aa2f366832--- /dev/null+++ b/CMakeModules/Findgamemode.cmake@@ -0,0 +1,15 @@+# SPDX-FileCopyrightText: 2023 yuzu Emulator Project+# SPDX-License-Identifier: GPL-2.0-or-later++find_package(PkgConfig QUIET)+pkg_search_module(GAMEMODE QUIET IMPORTED_TARGET gamemode)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(gamemode+ REQUIRED_VARS GAMEMODE_INCLUDEDIR+ VERSION_VAR GAMEMODE_VERSION+)++if (gamemode_FOUND AND NOT TARGET gamemode::headers)+ add_library(gamemode::headers ALIAS PkgConfig::GAMEMODE)+endif()diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txtindex 04007a5385..407c5c6405 100644--- a/externals/CMakeLists.txt+++ b/externals/CMakeLists.txt@@ -193,8 +193,10 @@ if (ANDROID)endif()endif()-if (UNIX AND NOT APPLE)- add_subdirectory(gamemode)+if (UNIX AND NOT APPLE AND NOT TARGET gamemode::headers)+ add_library(gamemode INTERFACE)+ target_include_directories(gamemode INTERFACE gamemode)+ add_library(gamemode::headers ALIAS gamemode)endif()# Breakpaddiff --git a/externals/gamemode/CMakeLists.txt b/externals/gamemode/CMakeLists.txtdeleted file mode 100644index 87095642e6..0000000000--- a/externals/gamemode/CMakeLists.txt+++ /dev/null@@ -1,11 +0,0 @@-# SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project-# SPDX-License-Identifier: GPL-3.0-or-later--project(gamemode LANGUAGES CXX C)--add_library(gamemode include/gamemode_client.h)--target_link_libraries(gamemode PRIVATE common)--target_include_directories(gamemode PUBLIC include)-set_target_properties(gamemode PROPERTIES LINKER_LANGUAGE C)diff --git a/externals/gamemode/include/gamemode_client.h b/externals/gamemode/gamemode_client.hsimilarity index 99%rename from externals/gamemode/include/gamemode_client.hrename to externals/gamemode/gamemode_client.hindex 184812334e..b9f64fe460 100644--- a/externals/gamemode/include/gamemode_client.h+++ b/externals/gamemode/gamemode_client.h@@ -1,6 +1,3 @@-// SPDX-FileCopyrightText: Copyright 2017-2019 Feral Interactive-// SPDX-License-Identifier: BSD-3-Clause-/*Copyright (c) 2017-2019, Feral Interactivediff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txtindex 2c6fc76570..b58a7073fd 100644--- a/src/common/CMakeLists.txt+++ b/src/common/CMakeLists.txt@@ -188,7 +188,7 @@ if (UNIX AND NOT APPLE)linux/gamemode.h)- target_link_libraries(common PRIVATE gamemode)+ target_link_libraries(common PRIVATE gamemode::headers)endif()if(ARCHITECTURE_x86_64)diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txtindex f3ad2214b5..90278052a8 100644--- a/src/yuzu/CMakeLists.txt+++ b/src/yuzu/CMakeLists.txt@@ -386,7 +386,7 @@ if (NOT WIN32)target_include_directories(yuzu PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})endif()if (UNIX AND NOT APPLE)- target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::DBus gamemode)+ target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::DBus)endif()target_compile_definitions(yuzu PRIVATE