mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
wrap discord rpc as optional feature
This commit is contained in:
@@ -51,6 +51,7 @@ option(WITH_LUA "Compile with lua scripting support" ON)
|
||||
option(WITH_OPENVR "Compile with OpenVR" ON)
|
||||
option(WITH_ZMQ "Compile with cppzmq" OFF)
|
||||
option(WITH_CRASHPAD "Compile with crashpad" OFF)
|
||||
option(WITH_DISCORD_RPC "Compile with DISCORD RICH PRESENCE" OFF)
|
||||
option(USE_LTO "Use link-time optimization" OFF)
|
||||
|
||||
option(WITH_LIBMANUL "Experimental multi-backend renderer" OFF)
|
||||
@@ -444,9 +445,15 @@ target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
||||
find_package(GLM REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${GLM_INCLUDE_DIR})
|
||||
|
||||
# add ref/discord-rpc to the project in the same way other dependencies are added
|
||||
add_subdirectory(ref/discord-rpc)
|
||||
target_link_libraries(${PROJECT_NAME} discord-rpc)
|
||||
|
||||
if (WITH_DISCORD_RPC)
|
||||
# add ref/discord-rpc to the project in the same way other dependencies are added
|
||||
add_subdirectory(ref/discord-rpc)
|
||||
target_link_libraries(${PROJECT_NAME} discord-rpc)
|
||||
target_compile_definitions(${PROJECT_NAME} "WITH_DISCORD_RPC=1")
|
||||
elseif ()
|
||||
target_compile_definitions(${PROJECT_NAME} "WITH_DISCORD_RPC=0")
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "light.h"
|
||||
#include "utilities.h"
|
||||
#include "motiontelemetry.h"
|
||||
#include "ref/discord-rpc/include/discord_rpc.h"
|
||||
#include <map>
|
||||
|
||||
#ifdef WITH_UART
|
||||
|
||||
@@ -29,7 +29,11 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Timer.h"
|
||||
#include "dictionary.h"
|
||||
#include "version_info.h"
|
||||
#include "ref/discord-rpc/include/discord_rpc.h"
|
||||
|
||||
#if WITH_DISCORD_RPC
|
||||
#include <discord_rpc.h>
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
#include "translation.h"
|
||||
|
||||
@@ -179,6 +183,7 @@ int eu07_application::run_crashgui()
|
||||
}
|
||||
void eu07_application::DiscordRPCService()
|
||||
{
|
||||
#if WITH_DISCORD_RPC
|
||||
// initialize discord-rpc
|
||||
WriteLog("Initializing Discord Rich Presence...");
|
||||
static const char *discord_app_id = "1343662664504840222";
|
||||
@@ -253,6 +258,7 @@ void eu07_application::DiscordRPCService()
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000)); // update RPC every 5 secs
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user