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
This commit is contained in:
proller 2017-09-04 20:04:33 +03:00 committed by alexey-milovidov
parent ea8790d077
commit f68a0ea63b
5 changed files with 20 additions and 41 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "contrib/mariadb-connector-c"]
path = contrib/mariadb-connector-c
url = /MariaDB/mariadb-connector-c.git

View File

@ -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 ()

@ -1 +0,0 @@
Subproject commit 35d6fb199611158109a898e695eca2564ef826fa

View File

@ -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}

View File

@ -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 ()