From 493a9fa60dc12b2efdc766f8d9656a3d758fd0cc Mon Sep 17 00:00:00 2001 From: SDeAstis Date: Tue, 16 Nov 2021 15:46:57 +0100 Subject: [PATCH] Modified Cmake and bootstrap to porperly support exclusion of Sentry.io --- CMakeLists.txt | 6 +++++- src/Main/bootstrap.cxx | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43c0ba2e5..c731c5abe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,7 +195,7 @@ option(ENABLE_DEMCONVERT "Set to ON to build the dem conversion tool (default)" option(ENABLE_HID_INPUT "Set to ON to build HID-based input code" ${EVENT_INPUT_DEFAULT}) option(ENABLE_PLIB_JOYSTICK "Set to ON to enable legacy joystick code (default)" ON) option(ENABLE_SWIFT "Set to ON to build the swift module" ON) - +option(ENABLE_SENTRY "Set to ON to build the Sentry.io crash reporting" ON) # Test-suite options. option(ENABLE_AUTOTESTING "Set to ON to execute the test suite after building the test_suite target (default)" ON) @@ -275,6 +275,9 @@ find_package(OpenSceneGraph 3.6.0 REQUIRED osgGA ) +############################################################################## +## Sentry.io setup +if (ENABLE_SENTRY) find_package(sentry QUIET) set(sentry_api_key "https://b10d9504e71244a7a86ba6c93acf6412@o372956.ingest.sentry.io/5188535") @@ -282,6 +285,7 @@ if (TARGET sentry::sentry) message(STATUS "Sentry.io crash reporting enabled") set(HAVE_SENTRY 1) endif() +endif (ENABLE_SENTRY) ############################################################################## ## Sqlite3 setup diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index 510a0ac27..1390b1dd1 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -268,10 +268,13 @@ int main ( int argc, char **argv ) _bootstrap_OSInit = 0; #if defined(HAVE_SENTRY) - std::cerr << "Will init sentry" << std::endl; - flightgear::initSentry(); - std::cerr << "Did init sentry" << std::endl; -#endif + const bool noSentry = flightgear::Options::checkForArg(argc, argv, "disable-sentry"); + if (!noSentry) { + std::cerr << "Will init sentry" << std::endl; + flightgear::initSentry(); + std::cerr << "Did init sentry" << std::endl; + } + #endif // if we're not using the normal crash-reported, install our // custom segfault handler on Linux, in debug builds.