forked from ShuriZma/suyu
1
0
Fork 0

cmake: prefer system gamemode library

This commit is contained in:
Alexandre Bouvier 2023-11-03 19:27:08 +01:00
parent 127bfb81d5
commit d2bb9e9729
8 changed files with 29 additions and 18 deletions

View File

@ -151,3 +151,7 @@ License: GPL-3.0-or-later
Files: externals/stb/* Files: externals/stb/*
Copyright: Sean Barrett Copyright: Sean Barrett
License: MIT License: MIT
Files: externals/gamemode/*
Copyright: Copyright 2017-2019 Feral Interactive
License: BSD-3-Clause

View File

@ -343,6 +343,10 @@ if(ENABLE_OPENSSL)
find_package(OpenSSL 1.1.1 REQUIRED) find_package(OpenSSL 1.1.1 REQUIRED)
endif() endif()
if (UNIX AND NOT APPLE)
find_package(gamemode 1.7 MODULE)
endif()
# Please consider this as a stub # Please consider this as a stub
if(ENABLE_QT6 AND Qt6_LOCATION) if(ENABLE_QT6 AND Qt6_LOCATION)
list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}") list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}")

View File

@ -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()

View File

@ -193,8 +193,10 @@ if (ANDROID)
endif() endif()
endif() endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE AND NOT TARGET gamemode::headers)
add_subdirectory(gamemode) add_library(gamemode INTERFACE)
target_include_directories(gamemode INTERFACE gamemode)
add_library(gamemode::headers ALIAS gamemode)
endif() endif()
# Breakpad # Breakpad

View File

@ -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)

View File

@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2017-2019 Feral Interactive
// SPDX-License-Identifier: BSD-3-Clause
/* /*
Copyright (c) 2017-2019, Feral Interactive Copyright (c) 2017-2019, Feral Interactive

View File

@ -188,7 +188,7 @@ if (UNIX AND NOT APPLE)
linux/gamemode.h linux/gamemode.h
) )
target_link_libraries(common PRIVATE gamemode) target_link_libraries(common PRIVATE gamemode::headers)
endif() endif()
if(ARCHITECTURE_x86_64) if(ARCHITECTURE_x86_64)

View File

@ -386,7 +386,7 @@ if (NOT WIN32)
target_include_directories(yuzu PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS}) target_include_directories(yuzu PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
endif() endif()
if (UNIX AND NOT APPLE) 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() endif()
target_compile_definitions(yuzu PRIVATE target_compile_definitions(yuzu PRIVATE