From 313716be9435da17acfa2e0569a020b8764cf63e Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 17 Jan 2022 08:10:57 +0300 Subject: [PATCH] Remove unbundled thrift support --- CMakeLists.txt | 1 - cmake/find/thrift.cmake | 34 --------------------- contrib/CMakeLists.txt | 7 ++--- contrib/arrow-cmake/CMakeLists.txt | 2 +- contrib/hive-metastore-cmake/CMakeLists.txt | 2 +- contrib/thrift-cmake/CMakeLists.txt | 14 +++++++-- src/Common/examples/CMakeLists.txt | 4 +-- 7 files changed, 17 insertions(+), 47 deletions(-) delete mode 100644 cmake/find/thrift.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e175458f963..3c424b07584 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,7 +510,6 @@ include (cmake/find/h3.cmake) include (cmake/find/libxml2.cmake) include (cmake/find/brotli.cmake) include (cmake/find/protobuf.cmake) -include (cmake/find/thrift.cmake) include (cmake/find/grpc.cmake) include (cmake/find/pdqsort.cmake) include (cmake/find/miniselect.cmake) diff --git a/cmake/find/thrift.cmake b/cmake/find/thrift.cmake deleted file mode 100644 index 08eeb60915e..00000000000 --- a/cmake/find/thrift.cmake +++ /dev/null @@ -1,34 +0,0 @@ -option(ENABLE_THRIFT "Enable Thrift" ${ENABLE_LIBRARIES}) - -if (NOT ENABLE_THRIFT) - message (STATUS "thrift disabled") - set(USE_INTERNAL_THRIFT_LIBRARY 0) - return() -endif() - -option(USE_INTERNAL_THRIFT_LIBRARY "Set to FALSE to use system thrift library instead of bundled" ON) -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/thrift") - if (USE_INTERNAL_THRIFT_LIBRARY) - message (WARNING "submodule contrib/thrift is missing. to fix try run: \n git submodule update --init --recursive") - set(USE_INTERNAL_THRIFT_LIBRARY 0) - endif () -endif() - -if (USE_INTERNAL_THRIFT_LIBRARY) - if (MAKE_STATIC_LIBRARIES) - set(THRIFT_LIBRARY thrift_static) - else() - set(THRIFT_LIBRARY thrift) - endif() - set (THRIFT_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src") - set(USE_THRIFT 1) -else() - find_library(THRIFT_LIBRARY thrift) - if (NOT THRIFT_LIBRARY) - set(USE_THRIFT 0) - else() - set(USE_THRIFT 1) - endif() -endif () - -message (STATUS "Using thrift=${USE_THRIFT}: ${THRIFT_INCLUDE_DIR} : ${THRIFT_LIBRARY}") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 22881290dec..a7c06f31717 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -61,8 +61,9 @@ add_subdirectory (zlib-ng-cmake) add_subdirectory (bzip2-cmake) add_subdirectory (snappy-cmake) add_subdirectory (rocksdb-cmake) +add_subdirectory (thrift-cmake) # parquet/arrow/orc -add_subdirectory (arrow-cmake) # requires: snappy +add_subdirectory (arrow-cmake) # requires: snappy, thrift add_subdirectory (avro-cmake) # requires: snappy add_subdirectory (hive-metastore-cmake) # requires: thrift/avro/arrow @@ -166,10 +167,6 @@ if (USE_INTERNAL_PROTOBUF_LIBRARY) add_subdirectory(protobuf-cmake) endif () -if (USE_INTERNAL_THRIFT_LIBRARY) - add_subdirectory(thrift-cmake) -endif () - if (USE_INTERNAL_HDFS3_LIBRARY) add_subdirectory(libhdfs3-cmake) endif () diff --git a/contrib/arrow-cmake/CMakeLists.txt b/contrib/arrow-cmake/CMakeLists.txt index 6b73add6bd2..09a0158771e 100644 --- a/contrib/arrow-cmake/CMakeLists.txt +++ b/contrib/arrow-cmake/CMakeLists.txt @@ -441,7 +441,7 @@ target_include_directories(_parquet SYSTEM BEFORE target_link_libraries(_parquet PUBLIC _arrow PRIVATE - ${THRIFT_LIBRARY} + ch_contrib::thrift boost::headers_only boost::regex ${OPENSSL_LIBRARIES}) diff --git a/contrib/hive-metastore-cmake/CMakeLists.txt b/contrib/hive-metastore-cmake/CMakeLists.txt index 016c7618ddb..4a1d90b7cef 100644 --- a/contrib/hive-metastore-cmake/CMakeLists.txt +++ b/contrib/hive-metastore-cmake/CMakeLists.txt @@ -13,5 +13,5 @@ set (SRCS add_library(_hivemetastore ${SRCS}) add_library(ch_contrib::hivemetastore ALIAS _hivemetastore) -target_link_libraries(_hivemetastore PUBLIC ${THRIFT_LIBRARY}) +target_link_libraries(_hivemetastore PUBLIC ch_contrib::thrift) target_include_directories(_hivemetastore SYSTEM BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/hive-metastore) diff --git a/contrib/thrift-cmake/CMakeLists.txt b/contrib/thrift-cmake/CMakeLists.txt index 088dd0a969b..2a62a6fe7ab 100644 --- a/contrib/thrift-cmake/CMakeLists.txt +++ b/contrib/thrift-cmake/CMakeLists.txt @@ -1,3 +1,10 @@ +option(ENABLE_THRIFT "Enable Thrift" ${ENABLE_LIBRARIES}) + +if (NOT ENABLE_THRIFT) + message (STATUS "thrift disabled") + return() +endif() + set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp") set(thriftcpp_SOURCES "${LIBRARY_DIR}/src/thrift/TApplicationException.cpp" @@ -82,6 +89,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in" "${CMAKE_CU include_directories("${CMAKE_CURRENT_BINARY_DIR}") -add_library(${THRIFT_LIBRARY} ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES}) -target_include_directories(${THRIFT_LIBRARY} SYSTEM PUBLIC "${THRIFT_INCLUDE_DIR}" ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries (${THRIFT_LIBRARY} PUBLIC boost::headers_only) +add_library(_thrift ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES}) +add_library(ch_contrib::thrift ALIAS _thrift) +target_include_directories(_thrift SYSTEM PUBLIC "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src" ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries (_thrift PUBLIC boost::headers_only) diff --git a/src/Common/examples/CMakeLists.txt b/src/Common/examples/CMakeLists.txt index 7b21591f83e..86b88cda24a 100644 --- a/src/Common/examples/CMakeLists.txt +++ b/src/Common/examples/CMakeLists.txt @@ -81,8 +81,8 @@ target_link_libraries (shell_command_inout PRIVATE clickhouse_common_io) add_executable (executable_udf executable_udf.cpp) target_link_libraries (executable_udf PRIVATE dbms) -add_executable(hive_metastore_client hive_metastore_client.cpp) -target_link_libraries (hive_metastore_client PUBLIC hivemetastore ${THRIFT_LIBRARY}) +add_executable (hive_metastore_client hive_metastore_client.cpp) +target_link_libraries (hive_metastore_client PUBLIC hivemetastore ch_contrib::thrift) add_executable (interval_tree interval_tree.cpp) target_link_libraries (interval_tree PRIVATE dbms)