diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d99df68..756bcbc67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,11 @@ **Breaking changes**: - Make `crashpad` the default backend for Linux. ([#927](https://github.com/getsentry/sentry-native/pull/927)) +- Remove build option `SENTRY_CRASHPAD_SYSTEM`. ([#928](https://github.com/getsentry/sentry-native/pull/928)) **Fixes**: -- Maintain crashpad client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) +- Maintain `crashpad` client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910)) - Specify correct dependencies for CMake client projects using a system-provided breakpad. ([#926](https://github.com/getsentry/sentry-native/pull/926)) **Internal**: diff --git a/CMakeLists.txt b/CMakeLists.txt index eb9d54a9b..8e460cded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,74 +413,68 @@ if(SENTRY_WITH_LIBUNWINDSTACK) endif() if(SENTRY_BACKEND_CRASHPAD) - option(SENTRY_CRASHPAD_SYSTEM "Use system crashpad" OFF) - if(SENTRY_CRASHPAD_SYSTEM) - find_package(crashpad REQUIRED) - target_link_libraries(sentry PUBLIC crashpad::client) + # FIXME: required for cmake 3.12 and lower: + # - NEW behavior lets normal variable override option + cmake_policy(SET CMP0077 NEW) + if(SENTRY_BUILD_SHARED_LIBS) + set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE) else() - # FIXME: required for cmake 3.12 and lower: - # - NEW behavior lets normal variable override option - cmake_policy(SET CMP0077 NEW) - if(SENTRY_BUILD_SHARED_LIBS) - set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE) - else() - set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE) - endif() - add_subdirectory(external/crashpad crashpad_build) + set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE) + endif() + add_subdirectory(external/crashpad crashpad_build) - if(CRASHPAD_WER_ENABLED) - add_dependencies(sentry crashpad::wer) - endif() + if(CRASHPAD_WER_ENABLED) + add_dependencies(sentry crashpad::wer) + endif() - # set static runtime if enabled - if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC) - set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - if(CRASHPAD_WER_ENABLED) - set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - endif() - set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + # set static runtime if enabled + if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC) + set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + if(CRASHPAD_WER_ENABLED) + set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() + set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() - if(DEFINED SENTRY_FOLDER) - set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER}) - set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER}) - if(CRASHPAD_WER_ENABLED) - set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER}) - endif() + if(DEFINED SENTRY_FOLDER) + set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER}) + if(CRASHPAD_WER_ENABLED) + set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER}) endif() + endif() - target_link_libraries(sentry PRIVATE - $ - $ - ) - install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - ) - if(WIN32 AND MSVC) - sentry_install(FILES $ + target_link_libraries(sentry PRIVATE + $ + $ + ) + install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + ) + if(WIN32 AND MSVC) + sentry_install(FILES $ + DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) + if (CRASHPAD_WER_ENABLED) + sentry_install(FILES $ DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) - if (CRASHPAD_WER_ENABLED) - sentry_install(FILES $ - DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) - endif() endif() endif() add_dependencies(sentry crashpad::handler) diff --git a/README.md b/README.md index 8d4994538..3c809b50c 100644 --- a/README.md +++ b/README.md @@ -238,12 +238,8 @@ using `cmake -D BUILD_SHARED_LIBS=OFF ..`. - `SENTRY_INTEGRATION_QT` (Default: OFF): Builds the Qt integration, which turns Qt log messages into breadcrumbs. -- `SENTRY_BREAKPAD_SYSTEM` / `SENTRY_CRASHPAD_SYSTEM` (Default: OFF): - This instructs the build system to use system-installed breakpad or crashpad - libraries instead of using the in-tree version. This is generally not recommended - for crashpad, as sentry uses a patched version that has attachment support. - This is being worked on upstream as well, and a future version might work with - an unmodified crashpad version as well. +- `SENTRY_BREAKPAD_SYSTEM` (Default: OFF): + This instructs the build system to use system-installed breakpad libraries instead of using the in-tree version. | Feature | Windows | macOS | Linux | Android | iOS | | ---------- | ------- | ----- | ----- | ------- | --- | diff --git a/sentry-config.cmake.in b/sentry-config.cmake.in index 483d92c0a..70ce7d3c5 100644 --- a/sentry-config.cmake.in +++ b/sentry-config.cmake.in @@ -5,12 +5,10 @@ set(SENTRY_TRANSPORT @SENTRY_TRANSPORT@) set(SENTRY_BUILD_SHARED_LIBS @SENTRY_BUILD_SHARED_LIBS@) set(SENTRY_LINK_PTHREAD @SENTRY_LINK_PTHREAD@) -if(SENTRY_BACKEND STREQUAL "crashpad") - set(SENTRY_CRASHPAD_SYSTEM @SENTRY_CRASHPAD_SYSTEM@) - if(SENTRY_CRASHPAD_SYSTEM) - find_package(crashpad REQUIRED) - else() - include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake") +if(SENTRY_BACKEND STREQUAL "crashpad" AND NOT SENTRY_BUILD_SHARED_LIBS) + include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake") + if(NOT MSVC AND NOT SENTRY_BUILD_SHARED_LIBS) + find_package(ZLIB REQUIRED) endif() endif()