From 2500534b1e4d32aed28960af423aa0804741d272 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 7 Apr 2020 09:38:13 +0100 Subject: [PATCH] Build changes for new crash-reporting system. --- CMakeLists.txt | 9 ++++++++- CMakeModules/ConfigureMsvc3rdParty.cmake | 3 +++ CMakeModules/ExportDebugSymbols.cmake | 22 ++++++++++++++++++++++ CMakeModules/SetupFGFSBundle.cmake | 2 +- src/Include/config_cmake.h.in | 2 ++ src/Main/CMakeLists.txt | 15 +++++++++++++++ 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 CMakeModules/ExportDebugSymbols.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e29a6cb0..cfe85b8b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ include(GNUInstallDirs) # System detection/default settings include( DetectDistro ) include( DetectBrowser ) - +include( ExportDebugSymbols ) set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") @@ -306,6 +306,13 @@ find_package(OpenSceneGraph 3.2.0 REQUIRED osgGA ) +find_package(sentry) + +if (TARGET sentry::sentry) + message(STATUS "Sentry.io crash reporting enabled") + set(HAVE_SENTRY 1) +endif() + if (MSVC) find_package(CrashRpt) if (CRASHRPT_FOUND) diff --git a/CMakeModules/ConfigureMsvc3rdParty.cmake b/CMakeModules/ConfigureMsvc3rdParty.cmake index 1651d2f79..5cfdc9dcd 100644 --- a/CMakeModules/ConfigureMsvc3rdParty.cmake +++ b/CMakeModules/ConfigureMsvc3rdParty.cmake @@ -48,6 +48,9 @@ if (MSVC AND MSVC_3RDPARTY_ROOT) set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenRTI/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/SimGear/lib ) set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenRTI/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/SimGear/include) + # ensure 3rdparty/lib/cmake is searched + list(APPEND CMAKE_PREFIX_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}) + if(NOT BOOST_INCLUDEDIR) # if this variable was not set by the user, set it to 3rdparty root's # parent dir, which is the normal location for people using our diff --git a/CMakeModules/ExportDebugSymbols.cmake b/CMakeModules/ExportDebugSymbols.cmake new file mode 100644 index 000000000..e5861fb46 --- /dev/null +++ b/CMakeModules/ExportDebugSymbols.cmake @@ -0,0 +1,22 @@ + + +# placehodler target for other ones to depend upon +add_custom_target( + debug_symbols +) + +function(export_debug_symbols target) + + if (APPLE) + add_custom_target(${target}.dSYM + COMMENT "Generating dSYM files for ${target}" + COMMAND dsymutil --out=${target}.dSYM $ + DEPENDS $ + ) + + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM DESTINATION symbols OPTIONAL) + + add_dependencies(debug_symbols ${target}.dSYM) + endif() + +endfunction() \ No newline at end of file diff --git a/CMakeModules/SetupFGFSBundle.cmake b/CMakeModules/SetupFGFSBundle.cmake index 92efc3e2e..156c8b189 100644 --- a/CMakeModules/SetupFGFSBundle.cmake +++ b/CMakeModules/SetupFGFSBundle.cmake @@ -7,7 +7,7 @@ function(setup_fgfs_bundle target) # in our local CMakeModules dir set_target_properties(${target} PROPERTIES MACOSX_BUNDLE_INFO_PLIST FlightGearBundleInfo.plist.in - MACOSX_BUNDLE_GUI_IDENTIFIER "org.flightgear.FlightGear" + MACOSX_BUNDLE_GUI_IDENTIFIER "org.flightgear.mac-nightly" MACOSX_BUNDLE_SHORT_VERSION_STRING ${FLIGHTGEAR_VERSION} MACOSX_BUNDLE_LONG_VERSION_STRING "FlightGear ${FLIGHTGEAR_VERSION} Nightly" MACOSX_BUNDLE_BUNDLE_VERSION ${FLIGHTGEAR_VERSION} diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index 2dbdc4427..b55bc29a3 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -70,3 +70,5 @@ #cmakedefine ENABLE_COMPOSITOR #cmakedefine ENABLE_SWIFT + +#cmakedefine HAVE_SENTRY diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 391446f73..b2b44956c 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -101,6 +101,7 @@ endif() # Set up the target links. setup_fgfs_libraries(fgfs) +export_debug_symbols(fgfs) if (APPLE) install(TARGETS fgfs BUNDLE DESTINATION .) @@ -108,6 +109,20 @@ else() install(TARGETS fgfs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() +if (TARGET sentry::sentry) + target_link_libraries(fgfs sentry::sentry) +endif() + +if (TARGET sentry::crashpad) + if (APPLE) + # install inside the bundle + install(FILES $ DESTINATION fgfs.app/Contents/MacOS OPTIONAL) + else() + # install in the bin-dir, next to the application binary + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) + endif() +endif() + if(ENABLE_METAR) add_executable(metar metar_main.cxx) target_link_libraries(metar