From 3147bbab510bfcab4734b131013b109117119474 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 18 Jan 2022 01:08:35 +0300 Subject: [PATCH] Cleanup sentry support --- CMakeLists.txt | 1 - base/daemon/CMakeLists.txt | 4 ++-- cmake/find/sentry.cmake | 23 ---------------------- cmake/target.cmake | 6 +++--- contrib/CMakeLists.txt | 10 +--------- contrib/sentry-native-cmake/CMakeLists.txt | 13 ++++++++++++ src/configure_config.cmake | 3 +++ 7 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 cmake/find/sentry.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 39e4bc3f20b..a1072e3d9e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -489,7 +489,6 @@ include (GNUInstallDirs) include (cmake/find/llvm.cmake) include (cmake/find/s3.cmake) include (cmake/find/nlp.cmake) -include (cmake/find/sentry.cmake) include (cmake/find/datasketches.cmake) # Need to process before "contrib" dir: diff --git a/base/daemon/CMakeLists.txt b/base/daemon/CMakeLists.txt index 6ef87db6a61..2a4d3d33ff9 100644 --- a/base/daemon/CMakeLists.txt +++ b/base/daemon/CMakeLists.txt @@ -12,6 +12,6 @@ endif() target_link_libraries (daemon PUBLIC loggers PRIVATE clickhouse_common_io clickhouse_common_config common ${EXECINFO_LIBRARIES}) -if (USE_SENTRY) - target_link_libraries (daemon PRIVATE ${SENTRY_LIBRARY}) +if (TARGET ch_contrib::sentry) + target_link_libraries (daemon PRIVATE ch_contrib::sentry) endif () diff --git a/cmake/find/sentry.cmake b/cmake/find/sentry.cmake deleted file mode 100644 index e08cbad1729..00000000000 --- a/cmake/find/sentry.cmake +++ /dev/null @@ -1,23 +0,0 @@ -set (SENTRY_LIBRARY "sentry") - -set (SENTRY_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/sentry-native/include") -if (NOT EXISTS "${SENTRY_INCLUDE_DIR}/sentry.h") - message (WARNING "submodule contrib/sentry-native is missing. to fix try run: \n git submodule update --init") - if (USE_SENTRY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal sentry library") - endif() - return() -endif () - -if (NOT OS_FREEBSD AND NOT SPLIT_SHARED_LIBRARIES AND NOT (OS_DARWIN AND COMPILER_CLANG)) - option (USE_SENTRY "Use Sentry" ${ENABLE_LIBRARIES}) - set (SENTRY_TRANSPORT "curl" CACHE STRING "") - set (SENTRY_BACKEND "none" CACHE STRING "") - set (SENTRY_EXPORT_SYMBOLS OFF CACHE BOOL "") - set (SENTRY_LINK_PTHREAD OFF CACHE BOOL "") - set (SENTRY_PIC OFF CACHE BOOL "") - set (BUILD_SHARED_LIBS OFF) - message (STATUS "Using sentry=${USE_SENTRY}: ${SENTRY_LIBRARY}") -elseif (USE_SENTRY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Sentry is not supported in current configuration") -endif () diff --git a/cmake/target.cmake b/cmake/target.cmake index 4b109d165e7..ff216f86618 100644 --- a/cmake/target.cmake +++ b/cmake/target.cmake @@ -27,10 +27,10 @@ if (CMAKE_CROSSCOMPILING) if (ARCH_AARCH64) # FIXME: broken dependencies set (ENABLE_GRPC OFF CACHE INTERNAL "") - set (USE_SENTRY OFF CACHE INTERNAL "") + set (ENABLE_SENTRY OFF CACHE INTERNAL "") elseif (ARCH_PPC64LE) set (ENABLE_GRPC OFF CACHE INTERNAL "") - set (USE_SENTRY OFF CACHE INTERNAL "") + set (ENABLE_SENTRY OFF CACHE INTERNAL "") endif () elseif (OS_FREEBSD) # FIXME: broken dependencies @@ -43,7 +43,7 @@ if (CMAKE_CROSSCOMPILING) endif () if (USE_MUSL) - set (USE_SENTRY OFF CACHE INTERNAL "") + set (ENABLE_SENTRY OFF CACHE INTERNAL "") set (ENABLE_ODBC OFF CACHE INTERNAL "") set (ENABLE_GRPC OFF CACHE INTERNAL "") set (ENABLE_HDFS OFF CACHE INTERNAL "") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 46a6a824585..45c6bb62091 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -129,17 +129,9 @@ add_subdirectory (fastops-cmake) add_subdirectory (libuv-cmake) add_subdirectory (amqpcpp-cmake) # requires: libuv add_subdirectory (cassandra-cmake) # requires: libuv - -# Should go before: -# - sentry-native add_subdirectory (curl-cmake) - add_subdirectory (azure-cmake) - -if (USE_SENTRY) - add_subdirectory (sentry-native-cmake) -endif() - +add_subdirectory (sentry-native-cmake) # requires: curl add_subdirectory (fmtlib-cmake) add_subdirectory (krb5-cmake) add_subdirectory (cyrus-sasl-cmake) # for krb5 diff --git a/contrib/sentry-native-cmake/CMakeLists.txt b/contrib/sentry-native-cmake/CMakeLists.txt index c0936137db0..18cbc9a2df8 100644 --- a/contrib/sentry-native-cmake/CMakeLists.txt +++ b/contrib/sentry-native-cmake/CMakeLists.txt @@ -1,3 +1,14 @@ +if (NOT OS_FREEBSD AND NOT SPLIT_SHARED_LIBRARIES AND NOT (OS_DARWIN AND COMPILER_CLANG)) + option (ENABLE_SENTRY "Enable Sentry" ${ENABLE_LIBRARIES}) +else() + option (ENABLE_SENTRY "Enable Sentry" OFF) +endif() + +if (NOT ENABLE_SENTRY) + message(STATUS "Not using sentry") + return() +endif() + set (SRC_DIR "${ClickHouse_SOURCE_DIR}/contrib/sentry-native") set (SRCS @@ -50,3 +61,5 @@ endif() target_link_libraries(sentry PRIVATE ch_contrib::curl pthread) target_include_directories(sentry PUBLIC "${SRC_DIR}/include" PRIVATE "${SRC_DIR}/src") target_compile_definitions(sentry PRIVATE SENTRY_WITH_INPROC_BACKEND SIZEOF_LONG=8) + +add_library(ch_contrib::sentry ALIAS sentry) diff --git a/src/configure_config.cmake b/src/configure_config.cmake index 4c599038c4d..18925ac6be2 100644 --- a/src/configure_config.cmake +++ b/src/configure_config.cmake @@ -64,3 +64,6 @@ endif() if (TARGET ch_contrib::krb5) set(USE_KRB5 1) endif() +if (TARGET ch_contrib::sentry) + set(USE_SENTRY 1) +endif()