From d4f5dbf73c0f3d4d2e8ee3bf5ab2ed7f48a3ac8c Mon Sep 17 00:00:00 2001 From: Rye Mutt <lightdrake@gmail.com> Date: Fri, 6 Aug 2021 08:35:07 -0400 Subject: [PATCH] Add sentry integration for linux --- indra/cmake/Sentry.cmake | 2 +- indra/newview/CMakeLists.txt | 32 +++++++++++++++++++++++------- indra/newview/llappviewerlinux.cpp | 2 +- indra/newview/llappviewerlinux.h | 2 ++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/indra/cmake/Sentry.cmake b/indra/cmake/Sentry.cmake index 86f5b0fc4ca..5206534f7d7 100644 --- a/indra/cmake/Sentry.cmake +++ b/indra/cmake/Sentry.cmake @@ -40,5 +40,5 @@ if (USE_SENTRY) endif() set(SENTRY_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/sentry) - set(SENTRY_DEFINE "USE_SENTRY") + set(SENTRY_DEFINE "USE_SENTRY=1") endif () diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5d5595b2da8..c0b69da7f66 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1792,14 +1792,11 @@ add_executable(${VIEWER_BINARY_NAME} ) if (SDL_FOUND) - set_property(TARGET ${VIEWER_BINARY_NAME} - PROPERTY COMPILE_DEFINITIONS LL_SDL=1 - ) + target_compile_definitions(${VIEWER_BINARY_NAME} PRIVATE LL_SDL=1) endif (SDL_FOUND) if (USE_SENTRY) - set_property(TARGET ${VIEWER_BINARY_NAME} - PROPERTY COMPILE_DEFINITIONS "${SENTRY_DEFINE}") + target_compile_definitions(${VIEWER_BINARY_NAME} PRIVATE ${SENTRY_DEFINE}) list(APPEND viewer_LIBRARIES ${SENTRY_LIBRARIES} @@ -2164,6 +2161,29 @@ if (LINUX) media_plugin_libvlc ) + find_program (OBJCOPY NAMES "objcopy" REQUIRED) + + add_custom_command (TARGET ${VIEWER_BINARY_NAME} POST_BUILD + COMMAND ${OBJCOPY} + ARGS + --only-keep-debug --compress-debug-sections=zlib + ${VIEWER_BINARY_NAME} "${VIEWER_BINARY_NAME}.debug" + BYPRODUCTS "${VIEWER_BINARY_NAME}.debug" + COMMENT "Extracting and compressing debug information") + + add_custom_command (TARGET ${VIEWER_BINARY_NAME} POST_BUILD + COMMAND ${OBJCOPY} + ARGS + --strip-all ${VIEWER_BINARY_NAME} + COMMENT "Extracting and compressing debug information") + + add_custom_command (TARGET ${VIEWER_BINARY_NAME} POST_BUILD + COMMAND ${OBJCOPY} + ARGS + --add-gnu-debuglink="${VIEWER_BINARY_NAME}.debug" ${VIEWER_BINARY_NAME} + COMMENT "Extracting and compressing debug information") + + if (PACKAGE) add_custom_command( OUTPUT ${product}.tar.xz COMMAND ${Python3_EXECUTABLE} @@ -2188,8 +2208,6 @@ if (LINUX) ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ${COPY_INPUT_DEPENDENCIES} ) - - if (PACKAGE) endif (PACKAGE) add_custom_command( diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 398bcfb5cbd..5fee1126fda 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -346,7 +346,7 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze) sentry_options_set_release(options, LL_VIEWER_CHANNEL_AND_VERSION); std::string database_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "sentry"); - sentry_options_set_database_path(options, database_path); + sentry_options_set_database_path(options, database_path.c_str()); mSentryInitialized = (sentry_init(options) == 0); if (mSentryInitialized) diff --git a/indra/newview/llappviewerlinux.h b/indra/newview/llappviewerlinux.h index 0289c43043f..c5b61fdb8ea 100644 --- a/indra/newview/llappviewerlinux.h +++ b/indra/newview/llappviewerlinux.h @@ -68,6 +68,8 @@ class LLAppViewerLinux : public LLAppViewer virtual bool initSLURLHandler(); virtual bool sendURLToOtherInstance(const std::string& url); +private: + bool mSentryInitialized; }; #if LL_DBUS_ENABLED -- GitLab