mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Our own CMakeLists for Cassandra (half-baked)
This commit is contained in:
parent
34f63a37a4
commit
ed09496593
9
contrib/CMakeLists.txt
vendored
9
contrib/CMakeLists.txt
vendored
@ -248,14 +248,7 @@ if (USE_AMQPCPP)
|
||||
add_subdirectory (amqpcpp-cmake)
|
||||
endif()
|
||||
if (USE_CASSANDRA)
|
||||
# Need to use C++17 since the compilation is not possible with C++20 currently.
|
||||
set (CMAKE_CXX_STANDARD_bak ${CMAKE_CXX_STANDARD})
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
|
||||
add_subdirectory (cassandra)
|
||||
|
||||
set (CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD_bak})
|
||||
unset (CMAKE_CXX_STANDARD_bak)
|
||||
add_subdirectory (cassandra-cmake)
|
||||
endif()
|
||||
|
||||
# Should go before:
|
||||
|
117
contrib/cassandra-cmake/CMakeLists.txt
Normal file
117
contrib/cassandra-cmake/CMakeLists.txt
Normal file
@ -0,0 +1,117 @@
|
||||
# Need to use C++17 since the compilation is not possible with C++20 currently.
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CASS_ROOT_DIR ${CMAKE_SOURCE_DIR}/contrib/cassandra)
|
||||
set(CASS_SRC_DIR "${CASS_ROOT_DIR}/src")
|
||||
set(CASS_INCLUDE_DIR "${CASS_ROOT_DIR}/include")
|
||||
|
||||
# Ensure functions/modules are available
|
||||
list(APPEND CMAKE_MODULE_PATH ${CASS_ROOT_DIR}/cmake)
|
||||
|
||||
set(CASS_BUILD_SHARED 1)
|
||||
set(CASS_BUILD_STATIC 1)
|
||||
set(CASS_USE_KERBEROS 0)
|
||||
set(CASS_USE_LIBSSH2 0)
|
||||
set(CASS_USE_OPENSSL 1)
|
||||
set(CASS_USE_STD_ATOMIC 1)
|
||||
set(CASS_USE_ZLIB 1)
|
||||
set(CASS_USE_TIMERFD 0)
|
||||
|
||||
|
||||
file(GLOB SOURCES ${CASS_SRC_DIR}/*.cpp)
|
||||
|
||||
if(APPLE)
|
||||
list(REMOVE_ITEM SOURCES ${CASS_SRC_DIR}/get_time-unix.cpp ${CASS_SRC_DIR}/get_time-win.cpp)
|
||||
elseif(UNIX)
|
||||
list(REMOVE_ITEM SOURCES ${CASS_SRC_DIR}/get_time-mac.cpp ${CASS_SRC_DIR}/get_time-win.cpp)
|
||||
elseif(WIN32)
|
||||
list(REMOVE_ITEM SOURCES ${CASS_SRC_DIR}/get_time-mac.cpp ${CASS_SRC_DIR}/get_time-unix.cpp)
|
||||
endif()
|
||||
|
||||
if(CASS_USE_OPENSSL)
|
||||
list(APPEND INCLUDE_DIRS ${CASS_SRC_DIR}/ssl)
|
||||
list(APPEND SOURCES ${CASS_SRC_DIR}/ssl/ssl_openssl_impl.cpp ${CASS_SRC_DIR}/ssl/ring_buffer_bio.cpp)
|
||||
else()
|
||||
list(APPEND SOURCES ${CASS_SRC_DIR}/ssl/ssl_no_impl.cpp)
|
||||
endif()
|
||||
|
||||
if(CASS_USE_KERBEROS)
|
||||
list(APPEND INCLUDE_DIRS ${CASS_SRC_DIR}/gssapi)
|
||||
list(APPEND SOURCES ${CASS_SRC_DIR}/gssapi/dse_auth_gssapi.cpp ${CASS_SRC_DIR}/gssapi/dse_auth_gssapi.hpp)
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCES ${CASS_SRC_DIR}/atomic/atomic_std.hpp)
|
||||
|
||||
|
||||
add_library(curl_hostcheck OBJECT ${CASS_SRC_DIR}/third_party/curl/hostcheck.cpp)
|
||||
add_library(hdr_histogram OBJECT ${CASS_SRC_DIR}/third_party/hdr_histogram/hdr_histogram.cpp)
|
||||
add_library(http-parser OBJECT ${CASS_SRC_DIR}/third_party/http-parser/http_parser.c)
|
||||
add_library(minizip OBJECT
|
||||
${CASS_SRC_DIR}/third_party/minizip/ioapi.c
|
||||
${CASS_SRC_DIR}/third_party/minizip/zip.c
|
||||
${CASS_SRC_DIR}/third_party/minizip/unzip.c)
|
||||
|
||||
|
||||
list(APPEND INCLUDE_DIRS
|
||||
${CASS_SRC_DIR}/third_party/curl
|
||||
${CASS_SRC_DIR}/third_party/hdr_histogram
|
||||
${CASS_SRC_DIR}/third_party/http-parser
|
||||
${CASS_SRC_DIR}/third_party/minizip
|
||||
${CASS_SRC_DIR}/third_party/mt19937_64
|
||||
${CASS_SRC_DIR}/third_party/rapidjson/rapidjson
|
||||
${CASS_SRC_DIR}/third_party/sparsehash/src)
|
||||
|
||||
list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CASS_SRC_DIR})
|
||||
|
||||
|
||||
# Determine random availability
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
check_symbol_exists(GRND_NONBLOCK "linux/random.h" HAVE_GETRANDOM)
|
||||
if(CASS_USE_TIMERFD)
|
||||
check_symbol_exists(timerfd_create "sys/timerfd.h" HAVE_TIMERFD)
|
||||
endif()
|
||||
else()
|
||||
check_symbol_exists(arc4random_buf "stdlib.h" HAVE_ARC4RANDOM)
|
||||
endif()
|
||||
|
||||
# Determine if sigpipe is available
|
||||
check_symbol_exists(SO_NOSIGPIPE "sys/socket.h;sys/types.h" HAVE_NOSIGPIPE)
|
||||
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
|
||||
if (NOT WIN32 AND NOT HAVE_NOSIGPIPE AND NOT HAVE_SIGTIMEDWAIT)
|
||||
message(WARNING "Unable to handle SIGPIPE on your platform")
|
||||
endif()
|
||||
|
||||
set (HAVE_BUILTIN_BSWAP32 1)
|
||||
set (HAVE_BUILTIN_BSWAP64 1)
|
||||
|
||||
set(HAVE_BOOST_ATOMIC 0)
|
||||
set(HAVE_STD_ATOMIC 1)
|
||||
|
||||
set(HAVE_KERBEROS ${CASS_USE_KERBEROS})
|
||||
set(HAVE_OPENSSL ${CASS_USE_OPENSSL})
|
||||
set(HAVE_ZLIB ${CASS_USE_ZLIB})
|
||||
|
||||
# Generate the driver_config.hpp file
|
||||
configure_file(
|
||||
${CASS_ROOT_DIR}/driver_config.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/driver_config.hpp)
|
||||
|
||||
|
||||
add_library(cassandra
|
||||
${SOURCES}
|
||||
$<TARGET_OBJECTS:curl_hostcheck>
|
||||
$<TARGET_OBJECTS:hdr_histogram>
|
||||
$<TARGET_OBJECTS:http-parser>
|
||||
$<TARGET_OBJECTS:minizip>)
|
||||
|
||||
target_link_libraries(cassandra ${CASS_LIBS})
|
||||
add_library(cassandra_static ALIAS cassandra)
|
||||
target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_definitions(cassandra PRIVATE CASS_BUILDING)
|
||||
|
||||
target_link_libraries(cassandra uv)
|
||||
target_link_libraries(cassandra zlib)
|
||||
|
||||
if(CASS_USE_OPENSSL)
|
||||
target_link_libraries(cassandra ssl)
|
||||
endif()
|
@ -26,33 +26,13 @@ get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
|
||||
SET(CC_SOURCE_DIR ${CMAKE_SOURCE_DIR}/contrib/mariadb-connector-c)
|
||||
SET(CC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
MACRO(ADD_OPTION _name _text _default)
|
||||
IF(NOT DEFINED ${_name})
|
||||
OPTION(${OPT}${_name} "${_text}" "${_default}")
|
||||
ELSE()
|
||||
OPTION(${OPT}${_name} "${_text}" "${${_name}}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
### Options ###
|
||||
ADD_OPTION(WITH_MYSQLCOMPAT "creates libmysql* symbolic links" OFF)
|
||||
ADD_OPTION(WITH_UNIT_TESTS "build test suite" ON)
|
||||
ADD_OPTION(WITH_DYNCOL "Enables support of dynamic coluumns" ON)
|
||||
ADD_OPTION(WITH_EXTERNAL_ZLIB "Enables use of external zlib" OFF)
|
||||
SET(WITH_CURL OFF)
|
||||
ADD_OPTION(WITH_SSL "Enables use of TLS/SSL library" ON)
|
||||
###############
|
||||
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/misc.cmake)
|
||||
INCLUDE(FindCURL)
|
||||
SET(WITH_SSL ON)
|
||||
|
||||
SET(MARIADB_CONNECTOR_C_COPYRIGHT "2013-2017 MariaDB Corporation Ab")
|
||||
|
||||
IF(NOT WIN32)
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/FindGSSAPI.cmake)
|
||||
IF(GSSAPI_FOUND)
|
||||
INCLUDE_DIRECTORIES(${GSSAPI_INCS})
|
||||
ENDIF()
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/FindGSSAPI.cmake)
|
||||
IF(GSSAPI_FOUND)
|
||||
INCLUDE_DIRECTORIES(${GSSAPI_INCS})
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/plugins.cmake)
|
||||
@ -62,17 +42,6 @@ IF(AUTH_GSSAPI_PLUGIN_TYPE MATCHES "STATIC")
|
||||
ENDIF()
|
||||
|
||||
|
||||
# various defines for generating include/mysql_version.h
|
||||
INCLUDE(FindGit)
|
||||
IF(GIT_EXECUTABLE AND EXISTS ${CC_SOURCE_DIR}/.git)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CC_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE OUT RESULT_VARIABLE RES)
|
||||
IF(RES EQUAL 0)
|
||||
STRING(REGEX REPLACE "\n$" "" CC_SOURCE_REVISION "${OUT}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(PROTOCOL_VERSION 10) # we adapted new password option from PHP's mysqlnd !
|
||||
|
||||
# if C/C is build as subproject inside MariaDB server tree we will
|
||||
@ -101,15 +70,6 @@ IF(NOT MARIADB_UNIX_ADDR)
|
||||
SET(MARIADB_UNIX_ADDR "/tmp/mysql.sock")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE("${CC_SOURCE_DIR}/cmake/install.cmake")
|
||||
IF(NOT PLUGINDIR)
|
||||
SET(PLUGINDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINDIR}")
|
||||
ENDIF()
|
||||
|
||||
# todo: we don't character sets in share - all is compiled in
|
||||
SET(SHAREDIR "share")
|
||||
SET(DEFAULT_CHARSET_HOME "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/SearchLibrary.cmake)
|
||||
|
||||
IF(WITH_EXTERNAL_ZLIB)
|
||||
@ -185,20 +145,15 @@ IF(NOT WITH_SSL STREQUAL "OFF")
|
||||
ELSE()
|
||||
SET(TLS_LIBRARY_VERSION "OpenSSL ${OPENSSL_VERSION}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE1(TLS_LIBRARY_VERSION "OpenSSL/LibreSSL not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
MESSAGE1(TLS_LIBRARY_VERSION "TLS library/version: ${TLS_LIBRARY_VERSION}")
|
||||
|
||||
MARK_AS_ADVANCED(SSL_SOURCES)
|
||||
ENDIF()
|
||||
|
||||
SET(ENABLED_LOCAL_INFILE OFF)
|
||||
|
||||
IF(NOT WIN32)
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
|
||||
ENDIF()
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/FindIconv.cmake)
|
||||
|
||||
CONFIGURE_FILE(${CC_SOURCE_DIR}/include/ma_config.h.in
|
||||
${CC_BINARY_DIR}/include/ma_config.h)
|
||||
@ -212,19 +167,15 @@ INCLUDE_DIRECTORIES(${CC_BINARY_DIR}/include)
|
||||
IF(WITH_SSL)
|
||||
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${SSL_LIBRARIES})
|
||||
ENDIF()
|
||||
MESSAGE1(SYSTEM_LIBS "SYSTEM_LIBS ${SYSTEM_LIBS}")
|
||||
MARK_AS_ADVANCED(SYSTEM_LIBS)
|
||||
|
||||
IF(NOT WIN32)
|
||||
IF(NOT AUTH_GSSAPI_PLUGIN_TYPE MATCHES "OFF")
|
||||
IF(NOT AUTH_GSSAPI_PLUGIN_TYPE MATCHES "OFF")
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/FindGSSAPI.cmake)
|
||||
IF(GSSAPI_FOUND)
|
||||
INCLUDE_DIRECTORIES(${GSSAPI_INCS})
|
||||
IF(AUTH_GSSAPI_PLUGIN_TYPE MATCHES "STATIC")
|
||||
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${GSSAPI_LIBS})
|
||||
ENDIF()
|
||||
INCLUDE_DIRECTORIES(${GSSAPI_INCS})
|
||||
IF(AUTH_GSSAPI_PLUGIN_TYPE MATCHES "STATIC")
|
||||
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${GSSAPI_LIBS})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
|
||||
@ -237,9 +188,6 @@ ADD_DEFINITIONS(-D HAVE_COMPRESS)
|
||||
ADD_DEFINITIONS(-D LIBMARIADB)
|
||||
ADD_DEFINITIONS(-D THREAD)
|
||||
|
||||
INCLUDE(${CC_SOURCE_DIR}/cmake/sign.cmake)
|
||||
|
||||
|
||||
# handle static plugins
|
||||
SET(LIBMARIADB_SOURCES ${LIBMARIADB_PLUGIN_SOURCES})
|
||||
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS})
|
||||
|
Loading…
Reference in New Issue
Block a user