From 720eced6657daa9f0221c1398917187c4b5987e3 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 23 Aug 2020 06:45:35 -0400 Subject: [PATCH] Attempt to improve discord-rpc checking in CMake Haven't ever gotten CMake to compile SRB2, so I'm unable to really check if this works --- cmake/Modules/FindDiscordRPC.cmake | 23 ++++++++++++ libs/DLL-README.txt | 20 ++--------- libs/discord-rpc.props | 16 +++++++++ src/CMakeLists.txt | 36 +++++++++++++------ .../! SRB2KART INSTALL INSTRUCTIONS !.txt | 11 ------ 5 files changed, 67 insertions(+), 39 deletions(-) create mode 100644 cmake/Modules/FindDiscordRPC.cmake create mode 100644 libs/discord-rpc.props delete mode 100644 windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt diff --git a/cmake/Modules/FindDiscordRPC.cmake b/cmake/Modules/FindDiscordRPC.cmake new file mode 100644 index 00000000..b43221ab --- /dev/null +++ b/cmake/Modules/FindDiscordRPC.cmake @@ -0,0 +1,23 @@ +include(LibFindMacros) + +libfind_pkg_check_modules(DISCORDRPC_PKGCONF DISCORDRPC) + +find_path(DISCORDRPC_INCLUDE_DIR + NAMES discord-rpc.h + PATHS + ${DISCORDRPC_PKGCONF_INCLUDE_DIRS} + "/usr/include/discord-rpc" + "/usr/local/include/discord-rpc" +) + +find_library(DISCORDRPC_LIBRARY + NAMES discord-rpc + PATHS + ${DISCORDRPC_PKGCONF_LIBRARY_DIRS} + "/usr/lib" + "/usr/local/lib" +) + +set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR) +set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY) +libfind_process(DISCORDRPC) \ No newline at end of file diff --git a/libs/DLL-README.txt b/libs/DLL-README.txt index 06fae127..bbb6d3cd 100644 --- a/libs/DLL-README.txt +++ b/libs/DLL-README.txt @@ -1,6 +1,6 @@ # SRB2Kart - Which DLLs do I need to bundle? -Updated 12/4/2018 (v2.1.21) +Updated 8/23/2020 (v1.3) Here are the required DLLs, per build. For each architecture, copy all the binaries from these folders: @@ -14,6 +14,7 @@ and don't forget to build r_opengl.dll for srb2dd. * libs\dll-binaries\i686\exchndl.dll * libs\dll-binaries\i686\libgme.dll +* libs\dll-binaries\i686\discord-rpc.dll * libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll) * libs\SDL2\i686-w64-mingw32\bin\SDL2.dll * libs\SDL2_mixer\i686-w64-mingw32\bin\*.dll (get everything) @@ -22,22 +23,7 @@ and don't forget to build r_opengl.dll for srb2dd. * libs\dll-binaries\x86_64\exchndl.dll * libs\dll-binaries\x86_64\libgme.dll +* libs\dll-binaries\x86_64\discord-rpc.dll * libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll) * libs\SDL2\x86_64-w64-mingw32\bin\SDL2.dll * libs\SDL2_mixer\x86_64-w64-mingw32\bin\*.dll (get everything) - -## srb2kartdd, 32-bit - -* libs\dll-binaries\i686\exchndl.dll -* libs\dll-binaries\i686\fmodex.dll -* libs\dll-binaries\i686\libgme.dll -* libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll) -* r_opengl.dll (build this from make) - -## srb2kartdd, 64-bit - -* libs\dll-binaries\x86_64\exchndl.dll -* libs\dll-binaries\x86_64\fmodex.dll -* libs\dll-binaries\x86_64\libgme.dll -* libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll) -* r_opengl.dll (build this from make) diff --git a/libs/discord-rpc.props b/libs/discord-rpc.props new file mode 100644 index 00000000..83c7a03f --- /dev/null +++ b/libs/discord-rpc.props @@ -0,0 +1,16 @@ + + + + + $(SolutionDir)libs\discord-rpc\win32-dynamic\lib;$(LibraryPath) + $(SolutionDir)libs\discord-rpc\win32-dynamic\lib;$(IncludePath) + $(SolutionDir)libs\discord-rpc\win64-dynamic\lib;$(LibraryPath) + $(SolutionDir)libs\discord-rpc\win64-dynamic\lib;$(IncludePath) + + + + discord-rpc.dll.a;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2959747..7cb9d119 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -332,7 +332,7 @@ if(${SRB2_CONFIG_HAVE_GME}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) set(GME_FOUND ON) set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include) - if(${SRB2_SYSTEM_BITS} EQUAL 64) + if(${SRB2_SYSTEM_BITS} EQUAL 64) set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme") else() # 32-bit set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme") @@ -348,17 +348,31 @@ if(${SRB2_CONFIG_HAVE_GME}) endif() endif() -# TO-DO: make this check for the dependency like the others.. if(${SRB2_CONFIG_HAVE_DISCORDRPC}) - add_definitions(-DHAVE_DISCORDRPC) - set(SRB2_DISCORDRPC_SOURCES - discord.c - discord.h - ) - - prepend_sources(SRB2_DISCORDRPC_SOURCES) - - source_group("Discord RPC" FILES ${SRB2_DISCORDRPC_SOURCES}) + if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) + set(DISCORDRPC_FOUND ON) + if(${SRB2_SYSTEM_BITS} EQUAL 64) + set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/include) + set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/lib -ldiscord-rpc") + else() # 32-bit + set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/include) + set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/lib -ldiscord-rpc") + endif() + else() + find_package(DISCORDRPC) + endif() + if(${DISCORDRPC_FOUND}) + set(SRB2_HAVE_DISCORDRPC ON) + add_definitions(-DHAVE_DISCORDRPC) + set(SRB2_DISCORDRPC_SOURCES + discord.c + discord.h + ) + prepend_sources(SRB2_DISCORDRPC_SOURCES) + source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES}) + else() + message(WARNING "You have specified that Discord Rich Presence is available but it was not found.") + endif() endif() if(${SRB2_CONFIG_HAVE_ZLIB}) diff --git a/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt b/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt deleted file mode 100644 index 91d055be..00000000 --- a/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt +++ /dev/null @@ -1,11 +0,0 @@ -SRB2Kart Install Instructions - -1. Move every file from the "new-install" folder to this main install folder. - -2. DELETE "staging.bat" and "staging.txt"! These can mess up your installation if run by accident! - -3. Optionally, create a folder in your user profile named "SRB2Kart". This is where your game data and addons may live. For example, - - C:\Users\[User]\SRB2Kart - -4. Run the game! Double-click srb2kart.exe -- or see if you have Start Menu icons under "SRB2Kart". \ No newline at end of file