mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
fix musl build
This commit is contained in:
parent
310e3a483e
commit
9fa22fe5a3
@ -1,29 +1,34 @@
|
||||
option(USE_MONGODB "Enable MongoDB support" ${ENABLE_LIBRARIES})
|
||||
if (NOT USE_MONGODB)
|
||||
if(NOT USE_MONGODB)
|
||||
message(STATUS "Not using libmongoc and libbson")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set (libbson_VERSION_MAJOR 1)
|
||||
set (libbson_VERSION_MINOR 27)
|
||||
set (libbson_VERSION_PATCH 0)
|
||||
set (libbson_VERSION 1.27.0)
|
||||
set (libmongoc_VERSION_MAJOR 1)
|
||||
set (libmongoc_VERSION_MINOR 27)
|
||||
set (libmongoc_VERSION_PATCH 0)
|
||||
set (libmongoc_VERSION 1.27.0)
|
||||
if(USE_MUSL)
|
||||
message(WARNING "libmongoc and libbson cannot be used with Musl")
|
||||
set(USE_MONGODB 0)
|
||||
endif()
|
||||
|
||||
set(libbson_VERSION_MAJOR 1)
|
||||
set(libbson_VERSION_MINOR 27)
|
||||
set(libbson_VERSION_PATCH 0)
|
||||
set(libbson_VERSION 1.27.0)
|
||||
set(libmongoc_VERSION_MAJOR 1)
|
||||
set(libmongoc_VERSION_MINOR 27)
|
||||
set(libmongoc_VERSION_PATCH 0)
|
||||
set(libmongoc_VERSION 1.27.0)
|
||||
|
||||
set(LIBBSON_SOURCES_ROOT "${ClickHouse_SOURCE_DIR}/contrib/mongo-c-driver/src")
|
||||
set(LIBBSON_SOURCE_DIR "${LIBBSON_SOURCES_ROOT}/libbson/src")
|
||||
file(GLOB_RECURSE LIBBSON_SOURCES "${LIBBSON_SOURCE_DIR}/*.c")
|
||||
|
||||
include (TestBigEndian)
|
||||
test_big_endian (BSON_BIG_ENDIAN)
|
||||
if (BSON_BIG_ENDIAN)
|
||||
set (BSON_BYTE_ORDER 4321)
|
||||
else ()
|
||||
set (BSON_BYTE_ORDER 1234)
|
||||
endif ()
|
||||
include(TestBigEndian)
|
||||
test_big_endian(BSON_BIG_ENDIAN)
|
||||
if(BSON_BIG_ENDIAN)
|
||||
set(BSON_BYTE_ORDER 4321)
|
||||
else()
|
||||
set(BSON_BYTE_ORDER 1234)
|
||||
endif()
|
||||
|
||||
set(BSON_OS 1)
|
||||
set(BSON_EXTRA_ALIGN 1)
|
||||
@ -56,21 +61,21 @@ set(MONGOC_HAVE_RES_NSEARCH 0)
|
||||
set(MONGOC_HAVE_RES_NCLOSE 0)
|
||||
set(MONGOC_HAVE_RES_NDESTROY 0)
|
||||
|
||||
if (OS_LINUX OR OS_DARWIN)
|
||||
if(OS_LINUX OR OS_DARWIN)
|
||||
set(MONGOC_HAVE_RES_NSEARCH 1)
|
||||
set(MONGOC_HAVE_RES_NCLOSE 1)
|
||||
else ()
|
||||
else()
|
||||
set(MONGOC_HAVE_RES_SEARCH 1)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (OS_DARWIN)
|
||||
if(OS_DARWIN)
|
||||
set(MONGOC_HAVE_RES_NDESTROY 1)
|
||||
endif()
|
||||
|
||||
add_definitions(-D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE)
|
||||
if(OS_FREEBSD)
|
||||
add_definitions(-D__BSD_VISIBLE=1)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
set(MONGOC_ENABLE_COMPRESSION 1)
|
||||
set(MONGOC_ENABLE_COMPRESSION_ZLIB 0)
|
||||
@ -90,13 +95,13 @@ set(MONGOC_ENABLE_SSL_LIBRESSL 0)
|
||||
set(MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0)
|
||||
set(MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION 0)
|
||||
set(MONGOC_HAVE_ASN1_STRING_GET0_DATA 0)
|
||||
if (ENABLE_SSL)
|
||||
if(ENABLE_SSL)
|
||||
set(MONGOC_ENABLE_SSL 1)
|
||||
set(MONGOC_ENABLE_CRYPTO 1)
|
||||
set(MONGOC_ENABLE_SSL_OPENSSL 1)
|
||||
set(MONGOC_ENABLE_CRYPTO_LIBCRYPTO 1)
|
||||
set(MONGOC_HAVE_ASN1_STRING_GET0_DATA 1)
|
||||
else ()
|
||||
else()
|
||||
message(WARNING "Building mongoc without SSL")
|
||||
endif()
|
||||
|
||||
@ -136,9 +141,9 @@ add_library(_libbson ${LIBBSON_SOURCES} ${COMMON_SOURCES})
|
||||
add_library(ch_contrib::libbson ALIAS _libbson)
|
||||
target_include_directories(_libbson SYSTEM PUBLIC ${LIBBSON_SOURCE_DIR} ${COMMON_SOURCE_DIR})
|
||||
target_compile_definitions(_libbson PRIVATE BSON_COMPILATION)
|
||||
if (OS_LINUX)
|
||||
if(OS_LINUX)
|
||||
target_compile_definitions(_libbson PRIVATE -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -D_XOPEN_SOURCE=600)
|
||||
elseif (OS_DARWIN)
|
||||
elseif(OS_DARWIN)
|
||||
target_compile_definitions(_libbson PRIVATE -D_DARWIN_C_SOURCE)
|
||||
endif()
|
||||
|
||||
@ -163,6 +168,6 @@ target_include_directories(_libmongoc SYSTEM PUBLIC ${LIBMONGOC_SOURCE_DIR} ${CO
|
||||
target_include_directories(_libmongoc SYSTEM PRIVATE ${LIBMONGOC_SOURCE_DIR}/mongoc ${UTHASH_SOURCE_DIR})
|
||||
target_compile_definitions(_libmongoc PRIVATE MONGOC_COMPILATION)
|
||||
target_link_libraries(_libmongoc ch_contrib::libbson ch_contrib::c-ares ch_contrib::zstd resolv)
|
||||
if (ENABLE_SSL)
|
||||
if(ENABLE_SSL)
|
||||
target_link_libraries(_libmongoc OpenSSL::SSL)
|
||||
endif()
|
||||
|
@ -1,10 +1,15 @@
|
||||
option(USE_MONGODB "Enable MongoDB support" ${ENABLE_LIBRARIES})
|
||||
|
||||
if (NOT USE_MONGODB)
|
||||
if(NOT USE_MONGODB)
|
||||
message(STATUS "Not using mongocxx and bsoncxx")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(USE_MUSL)
|
||||
message(WARNING "libmongoc and libbson cannot be used with Musl")
|
||||
set(USE_MONGODB 0)
|
||||
endif()
|
||||
|
||||
set(BSONCXX_SOURCES_DIR "${ClickHouse_SOURCE_DIR}/contrib/mongo-cxx-driver/src/bsoncxx")
|
||||
set(BSONCXX_SOURCES
|
||||
${BSONCXX_SOURCES_DIR}/lib/bsoncxx/v_noabi/bsoncxx/array/element.cpp
|
||||
@ -157,9 +162,9 @@ set(MONGOCXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}")
|
||||
set(MONGOCXX_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
|
||||
set(MONGOCXX_LINK_WITH_STATIC_MONGOC 1)
|
||||
set(MONGOCXX_BUILD_STATIC 1)
|
||||
if (ENABLE_SSL)
|
||||
if(ENABLE_SSL)
|
||||
set(MONGOCXX_ENABLE_SSL 1)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${MONGOCXX_SOURCES_DIR}/lib/mongocxx/v_noabi/mongocxx/config/config.hpp.in
|
||||
|
Loading…
Reference in New Issue
Block a user