diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a453071b86..1c5be86f17b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -499,7 +499,6 @@ include (cmake/find/pdqsort.cmake) include (cmake/find/miniselect.cmake) include (cmake/find/curl.cmake) include (cmake/find/s3.cmake) -include (cmake/find/base64.cmake) include (cmake/find/fast_float.cmake) include (cmake/find/fastops.cmake) include (cmake/find/odbc.cmake) diff --git a/cmake/find/base64.cmake b/cmake/find/base64.cmake deleted file mode 100644 index ee12fbb11ba..00000000000 --- a/cmake/find/base64.cmake +++ /dev/null @@ -1,25 +0,0 @@ -if(ARCH_AMD64 OR ARCH_ARM) - option (ENABLE_BASE64 "Enable base64" ${ENABLE_LIBRARIES}) -elseif(ENABLE_BASE64) - message (${RECONFIGURE_MESSAGE_LEVEL} "base64 library is only supported on x86_64 and aarch64") -endif() - -if (NOT ENABLE_BASE64) - return() -endif() - -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64/LICENSE") - set (MISSING_INTERNAL_BASE64_LIBRARY 1) - message (WARNING "submodule contrib/base64 is missing. to fix try run: \n git submodule update --init") -endif () - -if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64") - message (WARNING "submodule contrib/base64 is missing. to fix try run: \n git submodule update --init") -else() - set (BASE64_LIBRARY base64) - set (USE_BASE64 1) -endif() - -if (NOT USE_BASE64) - message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot enable base64") -endif() diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 0a3179620fd..4117559f084 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -135,10 +135,7 @@ if (USE_INTERNAL_AWS_S3_LIBRARY) endif () -if (USE_BASE64) - add_subdirectory (base64-cmake) -endif() - +add_subdirectory (base64-cmake) add_subdirectory (simdjson-cmake) if (USE_FASTOPS) diff --git a/contrib/base64-cmake/CMakeLists.txt b/contrib/base64-cmake/CMakeLists.txt index 4ebb4e68728..2443c899869 100644 --- a/contrib/base64-cmake/CMakeLists.txt +++ b/contrib/base64-cmake/CMakeLists.txt @@ -1,3 +1,14 @@ +if(ARCH_AMD64 OR ARCH_ARM) + option (ENABLE_BASE64 "Enable base64" ${ENABLE_LIBRARIES}) +elseif(ENABLE_BASE64) + message (${RECONFIGURE_MESSAGE_LEVEL} "base64 library is only supported on x86_64 and aarch64") +endif() + +if (NOT ENABLE_BASE64) + message(STATUS "Not using base64") + return() +endif() + SET(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/base64") add_library(base64_scalar OBJECT "${LIBRARY_DIR}/turbob64c.c" "${LIBRARY_DIR}/turbob64d.c") @@ -41,3 +52,5 @@ if (XCODE OR XCODE_VERSION) endif () target_sources(base64 PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dummy.c") endif () + +add_library(ch_contrib::base64 ALIAS base64) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 5fc3f9aa967..184855b386e 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -114,10 +114,6 @@ # include #endif -#if USE_BASE64 -# include -#endif - #if USE_JEMALLOC # include #endif diff --git a/src/Functions/CMakeLists.txt b/src/Functions/CMakeLists.txt index 74d76eb7cbc..cf29aa5bae3 100644 --- a/src/Functions/CMakeLists.txt +++ b/src/Functions/CMakeLists.txt @@ -12,7 +12,6 @@ add_library(clickhouse_functions ${clickhouse_functions_sources}) target_link_libraries(clickhouse_functions PUBLIC - ${BASE64_LIBRARY} ch_contrib::cityhash ch_contrib::farmhash ${FASTOPS_LIBRARY} @@ -72,8 +71,8 @@ if (USE_EMBEDDED_COMPILER) target_include_directories(clickhouse_functions SYSTEM BEFORE PUBLIC ${LLVM_INCLUDE_DIRS}) endif () -if(USE_BASE64) - target_include_directories(clickhouse_functions SYSTEM PRIVATE ${BASE64_INCLUDE_DIR}) +if (TARGET ch_contrib::base64) + target_link_libraries(clickhouse_functions PRIVATE ch_contrib::base64) endif() target_link_libraries(clickhouse_functions PRIVATE ch_contrib::lz4) diff --git a/src/configure_config.cmake b/src/configure_config.cmake index d391870f0eb..024d87f4fe9 100644 --- a/src/configure_config.cmake +++ b/src/configure_config.cmake @@ -49,3 +49,6 @@ endif() if (TARGET ch_contrib::cassandra) set(USE_CASSANDRA 1) endif() +if (TARGET ch_contrib::base64) + set(USE_BASE64 1) +endif()