cmake: Allow disabling discord rpc (#1416)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
TheTurtle 2024-10-19 16:09:36 +03:00 committed by GitHub
parent c38e3f77f9
commit 0ecb6695de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View file

@ -30,6 +30,7 @@ if(UNIX AND NOT APPLE)
endif()
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON)
# First, determine whether to use CMAKE_OSX_ARCHITECTURES or CMAKE_SYSTEM_PROCESSOR.
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
@ -405,8 +406,6 @@ set(COMMON src/common/logging/backend.cpp
src/common/debug.h
src/common/decoder.cpp
src/common/decoder.h
src/common/discord_rpc_handler.cpp
src/common/discord_rpc_handler.h
src/common/elf_info.h
src/common/endian.h
src/common/enum.h
@ -447,6 +446,10 @@ set(COMMON src/common/logging/backend.cpp
src/common/scm_rev.h
)
if (ENABLE_DISCORD_RPC)
list(APPEND COMMON src/common/discord_rpc_handler.cpp src/common/discord_rpc_handler.h)
endif()
set(CORE src/core/aerolib/stubs.cpp
src/core/aerolib/stubs.h
src/core/aerolib/aerolib.cpp
@ -895,7 +898,9 @@ if (UNIX AND NOT APPLE)
endif()
# Discord RPC
if (ENABLE_DISCORD_RPC)
target_link_libraries(shadps4 PRIVATE discord-rpc)
endif()
# Install rules
install(TARGETS shadps4 BUNDLE DESTINATION .)

View file

@ -188,9 +188,11 @@ if (NOT TARGET pugixml::pugixml)
endif()
# Discord RPC
if (ENABLE_DISCORD_RPC)
set(BUILD_EXAMPLES OFF)
add_subdirectory(discord-rpc/)
target_include_directories(discord-rpc INTERFACE discord-rpc/include)
endif()
# GCN Headers
add_subdirectory(gcn)

View file

@ -12,7 +12,9 @@
#include "common/memory_patcher.h"
#endif
#include "common/assert.h"
#ifdef ENABLE_DISCORD_RPC
#include "common/discord_rpc_handler.h"
#endif
#include "common/elf_info.h"
#include "common/ntapi.h"
#include "common/path_util.h"
@ -244,6 +246,7 @@ void Emulator::Run(const std::filesystem::path& file) {
}
}
#ifdef ENABLE_DISCORD_RPC
// Discord RPC
if (Config::getEnableDiscordRPC()) {
auto* rpc = Common::Singleton<DiscordRPCHandler::RPC>::Instance();
@ -252,6 +255,7 @@ void Emulator::Run(const std::filesystem::path& file) {
}
rpc->setStatusPlaying(game_info.title, id);
}
#endif
// start execution
std::jthread mainthread =