From f68a0ea63bb5d66ae8bcc0bab8457b2961e899ca Mon Sep 17 00:00:00 2001 From: proller Date: Mon, 4 Sep 2017 20:04:33 +0300 Subject: [PATCH] Fix mysql includes and remove libmariadb submodule (#1185) * Use bundled libmariadbclient (CLICKHOUSE-3261) * wip * wip * wip * Update docs about git clone. move docs/en/development/build_*.sh -> utils/build/build_debian.sh * Fix mysql includes * Cmake: don't install mariadb targets * Fix generated includes * Disable mysql tests * cmake: mariadb fixes * Fix * Update find_mysqlclient.cmake * Fix zlib * Remove bundled contrib/mariadb-connector-c * fix * Fix build * Fix includes --- .gitmodules | 3 -- contrib/CMakeLists.txt | 29 ++++++++------------ contrib/mariadb-connector-c | 1 - libs/libmysqlxx/CMakeLists.txt | 7 +++-- libs/libmysqlxx/cmake/find_mysqlclient.cmake | 21 ++------------ 5 files changed, 20 insertions(+), 41 deletions(-) delete mode 160000 contrib/mariadb-connector-c diff --git a/.gitmodules b/.gitmodules index 3e2525f500b..e69de29bb2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "contrib/mariadb-connector-c"] - path = contrib/mariadb-connector-c - url = /MariaDB/mariadb-connector-c.git diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 8d9845f4140..bb61c089acc 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,31 +1,31 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast") if (USE_INTERNAL_BOOST_LIBRARY) - add_subdirectory (libboost) + add_subdirectory (libboost) endif () if (USE_INTERNAL_POCO_LIBRARY) - add_subdirectory (libpoco) + add_subdirectory (libpoco) endif () if (USE_INTERNAL_LZ4_LIBRARY) - add_subdirectory (liblz4) + add_subdirectory (liblz4) endif () if (USE_INTERNAL_ZSTD_LIBRARY) - add_subdirectory (libzstd) + add_subdirectory (libzstd) endif () if (USE_INTERNAL_RE2_LIBRARY) - add_subdirectory (libre2) + add_subdirectory (libre2) endif () if (USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY) - add_subdirectory (libdouble-conversion) + add_subdirectory (libdouble-conversion) endif () if (USE_INTERNAL_ZOOKEEPER_LIBRARY) - add_subdirectory (libzookeeper) + add_subdirectory (libzookeeper) endif () if (USE_INTERNAL_CITYHASH_LIBRARY) @@ -45,26 +45,21 @@ if (USE_INTERNAL_BTRIE_LIBRARY) endif () if (USE_INTERNAL_UNWIND_LIBRARY) - add_subdirectory (libunwind) + add_subdirectory (libunwind) endif () if (USE_INTERNAL_ZLIB_LIBRARY) - add_subdirectory (libzlib-ng) + add_subdirectory (libzlib-ng) endif () if (USE_INTERNAL_CCTZ_LIBRARY) - add_subdirectory (libcctz) + add_subdirectory (libcctz) endif () if (ENABLE_LIBTCMALLOC AND USE_INTERNAL_GPERFTOOLS_LIBRARY) - add_subdirectory (libtcmalloc) + add_subdirectory (libtcmalloc) endif () if (NOT ARCH_ARM) - add_subdirectory (libcpuid) -endif () - -if (USE_INTERNAL_MYSQL_LIBRARY) - add_subdirectory (mariadb-connector-c) - target_include_directories (${MYSQLCLIENT_LIBRARIES} BEFORE PUBLIC ${MYSQL_INCLUDE_DIR}) + add_subdirectory (libcpuid) endif () diff --git a/contrib/mariadb-connector-c b/contrib/mariadb-connector-c deleted file mode 160000 index 35d6fb19961..00000000000 --- a/contrib/mariadb-connector-c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 35d6fb199611158109a898e695eca2564ef826fa diff --git a/libs/libmysqlxx/CMakeLists.txt b/libs/libmysqlxx/CMakeLists.txt index e3a35601f90..9ae1678fcac 100644 --- a/libs/libmysqlxx/CMakeLists.txt +++ b/libs/libmysqlxx/CMakeLists.txt @@ -32,8 +32,11 @@ target_include_directories (mysqlxx PUBLIC include) set(PLATFORM_LIBRARIES ${CMAKE_DL_LIBS}) -if (USE_INTERNAL_MYSQL_LIBRARY) -elseif (USE_STATIC_LIBRARIES AND STATIC_MYSQLCLIENT_LIB) +if (USE_MYSQL) + include_directories (${MYSQL_INCLUDE_DIR}) +endif () + +if (USE_STATIC_LIBRARIES AND STATIC_MYSQLCLIENT_LIB) set (MYSQLCLIENT_LIB ${CMAKE_CURRENT_BINARY_DIR}/libmysqlclient.a) add_custom_command ( OUTPUT ${MYSQLCLIENT_LIB} diff --git a/libs/libmysqlxx/cmake/find_mysqlclient.cmake b/libs/libmysqlxx/cmake/find_mysqlclient.cmake index 19aa1548f59..c27822ec855 100644 --- a/libs/libmysqlxx/cmake/find_mysqlclient.cmake +++ b/libs/libmysqlxx/cmake/find_mysqlclient.cmake @@ -1,15 +1,6 @@ option (ENABLE_MYSQL "Enable MySQL" ON) -option (USE_INTERNAL_MYSQL_LIBRARY "Set to FALSE to use system mysql library instead of bundled" ${NOT_UNBUNDLED}) - if (ENABLE_MYSQL) - - if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/mariadb-connector-c/CMakeLists.txt") - message (WARNING "submodule contrib/mariadb-connector-c is missing. to fix try run: git submodule update --init --recursive") - set (USE_INTERNAL_MYSQL_LIBRARY 0) - endif () - - if (NOT USE_INTERNAL_MYSQL_LIBRARY) set (MYSQL_LIB_PATHS "/usr/local/opt/mysql/lib" "/usr/local/lib/mysql/" @@ -35,22 +26,16 @@ if (ENABLE_MYSQL) else () find_library (MYSQLCLIENT_LIBRARIES mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS}) endif () - endif () if (MYSQL_INCLUDE_DIR AND (STATIC_MYSQLCLIENT_LIB OR MYSQLCLIENT_LIBRARIES)) - include_directories (MYSQL_INCLUDE_DIR) - else () - set (USE_INTERNAL_MYSQL_LIBRARY 1) - set (MYSQLCLIENT_LIBRARIES mariadbclient) - set (MYSQL_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/mariadb-connector-c/include") + set (USE_MYSQL 1) endif () - set(USE_MYSQL 1) - set(MYSQLXX_LIBRARY mysqlxx) + set (MYSQLXX_LIBRARY mysqlxx) endif () if (USE_MYSQL) - message (STATUS "Using mysqlclient=${USE_MYSQL}: ${MYSQL_INCLUDE_DIR} : ${MYSQLCLIENT_LIBRARIES}; staticlib=${STATIC_MYSQLCLIENT_LIB} internal=${USE_INTERNAL_MYSQL_LIBRARY}") + message (STATUS "Using mysqlclient=${USE_MYSQL}: ${MYSQL_INCLUDE_DIR} : ${MYSQLCLIENT_LIBRARIES}; staticlib=${STATIC_MYSQLCLIENT_LIB}") else () message (STATUS "Build without mysqlclient (support for MYSQL dictionary source will be disabled)") endif ()