From fd53956f3009268ac453a6324c887f43b9fc32a6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Tue, 10 Sep 2019 16:55:38 +0200 Subject: [PATCH] Completly build without Discord if no API Key is given. --- indra/cmake/Discord.cmake | 27 +++++++++++++-------------- indra/newview/CMakeLists.txt | 7 ++++++- indra/newview/llviewerfloaterreg.cpp | 4 ++++ indra/newview/llvoavatar.cpp | 4 ++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/indra/cmake/Discord.cmake b/indra/cmake/Discord.cmake index 231d3670a8..a7a36f433d 100644 --- a/indra/cmake/Discord.cmake +++ b/indra/cmake/Discord.cmake @@ -1,18 +1,17 @@ # -*- cmake -*- - - - -include(Prebuilt) -use_prebuilt_binary(discord-rpc) -set(DISCORD_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/discord-rpc) -if (ADDRESS_SIZE EQUAL 32 AND WINDOWS) - set(DISCORD_LIBRARY discord-rpc) -elseif (WINDOWS) - set(DISCORD_LIBRARY discord-rpc_x64) -elseif (LINUX OR DARWIN) - set(DISCORD_LIBRARY libdiscord-rpc) -endif (ADDRESS_SIZE EQUAL 32 AND WINDOWS) if (DISCORD_API_KEY) - add_definitions( -DDISCORD_API_KEY=\"${DISCORD_API_KEY}\") + include(Prebuilt) + use_prebuilt_binary(discord-rpc) + set(DISCORD_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/discord-rpc) + if (ADDRESS_SIZE EQUAL 32 AND WINDOWS) + set(DISCORD_LIBRARY discord-rpc) + elseif (WINDOWS) + set(DISCORD_LIBRARY discord-rpc_x64) + elseif (LINUX OR DARWIN) + set(DISCORD_LIBRARY libdiscord-rpc) + endif (ADDRESS_SIZE EQUAL 32 AND WINDOWS) + add_definitions( -DDISCORD_API_KEY=\"${DISCORD_API_KEY}\") + add_definitions( -DHAS_DISCORD ) + set(USE_DISCORD TRUE) endif (DISCORD_API_KEY) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c6ecca3e00..aad2815251 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1794,8 +1794,10 @@ if (WINDOWS) ) # Discord rich presence + if( USE_DISCORD ) LIST(APPEND viewer_HEADER_FILES fsfloaterdiscord.h fsdiscordconnect.h) LIST(APPEND viewer_SOURCE_FILES fsfloaterdiscord.cpp fsdiscordconnect.cpp) + endif() # # precompiled header configuration @@ -2438,9 +2440,12 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLPHYSICSEXTENSIONS_LIBRARIES} ${LLAPPEARANCE_LIBRARIES} ${GROWL_LIBRARY} - ${DISCORD_LIBRARY} ) +if( USE_DISCORD ) + target_link_libraries(${VIEWER_BINARY_NAME} ${DISCORD_LIBRARY} ) +endif() + if (BUGSPLAT_DB) target_link_libraries(${VIEWER_BINARY_NAME} ${BUGSPLAT_LIBRARIES} diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index ef3b8da9a4..38b78cb3a0 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -180,7 +180,9 @@ #include "fsfloateravatarrendersettings.h" #include "fsfloatercontacts.h" #include "fsfloatercontactsetconfiguration.h" +#ifdef USE_DISCORD #include "fsfloaterdiscord.h" +#endif #include "fsfloaterexport.h" #include "fsfloaterblocklist.h" #include "fsfloatergroup.h" @@ -466,7 +468,9 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("fs_blocklist", "floater_fs_blocklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_add_contact", "floater_fs_contact_add.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_contact_set_config", "floater_fs_contact_set_configuration.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); +#ifdef USE_DISCORD LLFloaterReg::add("fs_discord", "floater_fs_discord.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); +#endif LLFloaterReg::add("fs_group", "floater_fs_group.xml",&LLFloaterReg::build); LLFloaterReg::add("fs_group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_export", "floater_fs_export.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f9aa45158e..23a2fce8e2 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -130,7 +130,9 @@ #include "llsidepanelappearance.h" #include "fsavatarrenderpersistence.h" +#ifdef USE_DISCORD #include "fsdiscordconnect.h" // tapping a place that happens on landing in world to start up discord +#endif extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -3080,8 +3082,10 @@ void LLVOAvatar::idleUpdateLoadingEffect() // Animation Overrider AOEngine::instance().onLoginComplete(); +#ifdef USE_DISCORD // tapping a place that happens on landing in world to start up discord FSDiscordConnect::instance().checkConnectionToDiscord(gSavedPerAccountSettings.getBOOL("FSEnableDiscordIntegration")); +#endif } else {