From cad885ab1cbe3af818b52d7462ba2c084a872603 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 18 Jan 2022 09:48:23 +0300 Subject: [PATCH] Remove unbundled aws-s3 support --- CMakeLists.txt | 1 - cmake/find/s3.cmake | 41 ----------------------------- contrib/CMakeLists.txt | 15 +++-------- contrib/aws-s3-cmake/CMakeLists.txt | 19 ++++++++++++- src/CMakeLists.txt | 8 +++--- src/configure_config.cmake | 3 +++ 6 files changed, 27 insertions(+), 60 deletions(-) delete mode 100644 cmake/find/s3.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d35f2faeec9..14fcd0f3023 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -487,7 +487,6 @@ message (STATUS include (GNUInstallDirs) include (cmake/find/llvm.cmake) -include (cmake/find/s3.cmake) include (cmake/find/nlp.cmake) # Need to process before "contrib" dir: diff --git a/cmake/find/s3.cmake b/cmake/find/s3.cmake deleted file mode 100644 index 06029ace63a..00000000000 --- a/cmake/find/s3.cmake +++ /dev/null @@ -1,41 +0,0 @@ -if(NOT OS_FREEBSD) - option(ENABLE_S3 "Enable S3" ${ENABLE_LIBRARIES}) -elseif(ENABLE_S3 OR USE_INTERNAL_AWS_S3_LIBRARY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use S3 on FreeBSD") -endif() - -if(NOT ENABLE_S3) - if(USE_INTERNAL_AWS_S3_LIBRARY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal S3 library with ENABLE_S3=OFF") - endif() - return() -endif() - -option(USE_INTERNAL_AWS_S3_LIBRARY "Set to FALSE to use system S3 instead of bundled (experimental set to OFF on your own risk)" - ON) - -if (NOT USE_INTERNAL_AWS_S3_LIBRARY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Compilation with external S3 library is not supported yet") -endif() - -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3") - message (WARNING "submodule contrib/aws is missing. to fix try run: \n git submodule update --init") - if (USE_INTERNAL_AWS_S3_LIBRARY) - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal S3 library") - endif () - set (MISSING_AWS_S3 1) -endif () - -if (USE_INTERNAL_AWS_S3_LIBRARY AND NOT MISSING_AWS_S3) - set(AWS_S3_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3/include") - set(AWS_S3_CORE_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-core/include") - set(AWS_S3_LIBRARY aws_s3) - set(USE_INTERNAL_AWS_S3_LIBRARY 1) - set(USE_AWS_S3 1) -else() - message (${RECONFIGURE_MESSAGE_LEVEL} "Can't enable S3") - set(USE_INTERNAL_AWS_S3_LIBRARY 0) - set(USE_AWS_S3 0) -endif () - -message (STATUS "Using aws_s3=${USE_AWS_S3}: ${AWS_S3_INCLUDE_DIR} : ${AWS_S3_LIBRARY}") diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index e53ea42ddd3..f74d5cbc3a1 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -110,18 +110,9 @@ if (USE_EMBEDDED_COMPILER) add_llvm() endif () -add_subdirectory(libgsasl-cmake) -add_subdirectory(libxml2-cmake) - -if (USE_INTERNAL_AWS_S3_LIBRARY) - add_subdirectory(aws-s3-cmake) - - # The library is large - avoid bloat. - target_compile_options (aws_s3 PRIVATE -g0) - target_compile_options (aws_s3_checksums PRIVATE -g0) - -endif () - +add_subdirectory (libgsasl-cmake) +add_subdirectory (libxml2-cmake) +add_subdirectory (aws-s3-cmake) add_subdirectory (base64-cmake) add_subdirectory (simdjson-cmake) add_subdirectory (rapidjson-cmake) diff --git a/contrib/aws-s3-cmake/CMakeLists.txt b/contrib/aws-s3-cmake/CMakeLists.txt index 5024763f19d..9c0b3ce192c 100644 --- a/contrib/aws-s3-cmake/CMakeLists.txt +++ b/contrib/aws-s3-cmake/CMakeLists.txt @@ -1,3 +1,14 @@ +if(NOT OS_FREEBSD) + option(ENABLE_S3 "Enable S3" ${ENABLE_LIBRARIES}) +elseif(ENABLE_S3) + message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use S3 on FreeBSD") +endif() + +if(NOT ENABLE_S3) + message(STATUS "Not using S3") + return() +endif() + SET(AWS_S3_LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-s3") SET(AWS_CORE_LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws/aws-cpp-sdk-core") SET(AWS_CHECKSUMS_LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/aws-checksums") @@ -93,7 +104,7 @@ add_library(aws_s3 ${S3_UNIFIED_SRC}) target_compile_definitions(aws_s3 PUBLIC "AWS_SDK_VERSION_MAJOR=1") target_compile_definitions(aws_s3 PUBLIC "AWS_SDK_VERSION_MINOR=7") target_compile_definitions(aws_s3 PUBLIC "AWS_SDK_VERSION_PATCH=231") -target_include_directories(aws_s3 SYSTEM PUBLIC ${S3_INCLUDES}) +target_include_directories(aws_s3 SYSTEM BEFORE PUBLIC ${S3_INCLUDES}) if (TARGET OpenSSL::SSL) target_compile_definitions(aws_s3 PUBLIC -DENABLE_OPENSSL_ENCRYPTION) @@ -101,3 +112,9 @@ if (TARGET OpenSSL::SSL) endif() target_link_libraries(aws_s3 PRIVATE aws_s3_checksums) + +# The library is large - avoid bloat. +target_compile_options (aws_s3 PRIVATE -g0) +target_compile_options (aws_s3_checksums PRIVATE -g0) + +add_library(ch_contrib::aws_s3 ALIAS aws_s3) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87b9b08180d..b6b44c4374f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -105,7 +105,7 @@ if (TARGET ch_contrib::rocksdb) add_headers_and_sources(dbms Storages/RocksDB) endif() -if (USE_AWS_S3) +if (TARGET ch_contrib::aws_s3) add_headers_and_sources(dbms Common/S3) add_headers_and_sources(dbms Disks/S3) endif() @@ -436,10 +436,8 @@ if (TARGET ch_contrib::hivemetastore) endif() -if (USE_AWS_S3) - target_link_libraries (clickhouse_common_io PUBLIC ${AWS_S3_LIBRARY}) - target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${AWS_S3_CORE_INCLUDE_DIR}) - target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${AWS_S3_INCLUDE_DIR}) +if (TARGET ch_contrib::aws_s3) + target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::aws_s3) endif() if (TARGET ch_contrib::azure_sdk) diff --git a/src/configure_config.cmake b/src/configure_config.cmake index 7e191478a44..53a2663e35c 100644 --- a/src/configure_config.cmake +++ b/src/configure_config.cmake @@ -70,3 +70,6 @@ endif() if (TARGET ch_contrib::datasketches) set(USE_DATASKETCHES 1) endif() +if (TARGET ch_contrib::aws_s3) + set(USE_AWS_S3 1) +endif()