diff --git a/CMakeLists.txt b/CMakeLists.txt index 368a6fe90c..246662a5db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,12 @@ set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fstrict-overflow") ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_STRICT_OVERFLOW -Wstrict-overflow=1) ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_STRICT_OVERFLOW -Wstrict-overflow=1) +if(EXISTS discord-rpc) + add_subdirectory(discord-rpc) + add_definitions(-D__ENABLE_DISCORD__) + include_directories(discord-rpc/include) + set(HAVE_DISCORD_RPC TRUE) +endif() # Include sub-projects include("${ROOT_DIR}/src/openrct2/CMakeLists.txt" NO_POLICY_SCOPE) diff --git a/scripts/linux/install.sh b/scripts/linux/install.sh index 9fd9d512dc..35501b7666 100755 --- a/scripts/linux/install.sh +++ b/scripts/linux/install.sh @@ -97,6 +97,8 @@ if [[ "$(uname)" == "Darwin" ]]; then brew install jansson sdl2 sdl2_ttf speex --universal fi elif [[ $(uname) == "Linux" ]]; then + # Clone discord-rpc for Discord's Rich Presence support + git clone https://github.com/discordapp/discord-rpc # prevent build.sh from re-doing all the steps again case "$TARGET" in "ubuntu_i686") diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index 2865d9e324..65b3549fa4 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -198,6 +198,10 @@ if (UNIX OR STATIC OR ${CMAKE_SYSTEM_NAME} MATCHES "BSD") target_link_libraries(${PROJECT} ${ICONV_LIBRARIES}) endif() +if (HAVE_DISCORD_RPC) + target_link_libraries(libopenrct2 discord-rpc) +endif() + # Includes target_include_directories(${PROJECT} SYSTEM PRIVATE ${LIBZIP_INCLUDE_DIRS}) target_include_directories(${PROJECT} PUBLIC ${JANSSON_INCLUDE_DIRS})