Merge remote-tracking branch 'origin/MXS-517' into MXS-517
This commit is contained in:
commit
c579ed7fce
@ -33,7 +33,7 @@ check_deps()
|
||||
check_dirs()
|
||||
find_package(OpenSSL)
|
||||
find_package(Valgrind)
|
||||
find_package(MySQLClient)
|
||||
find_package(MariaDBConnector)
|
||||
find_package(MySQL)
|
||||
find_package(Pandoc)
|
||||
find_package(TCMalloc)
|
||||
@ -46,6 +46,12 @@ find_package(RabbitMQ)
|
||||
# Read BuildPCRE2 for details about how to add pcre2 as a dependency to a target
|
||||
include(cmake/BuildPCRE2.cmake)
|
||||
|
||||
# If the connector was not found, download and build it from source
|
||||
if(NOT MARIADB_CONNECTOR_FOUND)
|
||||
message(STATUS "Building MariaDB Connector-C from source.")
|
||||
include(cmake/BuildMariaDBConnector.cmake)
|
||||
endif()
|
||||
|
||||
# You can find the variables set by this in the FindCURL.cmake file
|
||||
# which is a default module in CMake.
|
||||
|
||||
|
26
cmake/BuildMariaDBConnector.cmake
Normal file
26
cmake/BuildMariaDBConnector.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
# Build the MariaDB Connector-C
|
||||
#
|
||||
# If the MariaDB connector is not found, the last option is to download it
|
||||
# and build it from source. This file downloads and builds the connector and
|
||||
# sets the variables set by FindMariaDBConnector.cmake so that it appears that
|
||||
# the system has the connector.
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(connector-c
|
||||
GIT_REPOSITORY https://github.com/MariaDB/mariadb-connector-c.git
|
||||
GIT_TAG v2.2.1
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/connector-c/install
|
||||
BINARY_DIR ${CMAKE_BINARY_DIR}/connector-c
|
||||
INSTALL_DIR ${CMAKE_BINARY_DIR}/connector-c/install)
|
||||
|
||||
set(MARIADB_CONNECTOR_FOUND TRUE CACHE INTERNAL "" FORCE)
|
||||
set(MARIADB_CONNECTOR_STATIC_FOUND TRUE CACHE INTERNAL "" FORCE)
|
||||
set(MARIADB_CONNECTOR_INCLUDE_DIR
|
||||
${CMAKE_BINARY_DIR}/connector-c/install/include/mariadb CACHE INTERNAL "" FORCE)
|
||||
set(MARIADB_CONNECTOR_STATIC_LIBRARIES
|
||||
${CMAKE_BINARY_DIR}/connector-c/install/lib/mariadb/libmariadbclient.a
|
||||
CACHE INTERNAL "" FORCE)
|
||||
set(MARIADB_CONNECTOR_LIBRARIES
|
||||
${CMAKE_BINARY_DIR}/connector-c/install/lib/mariadb/libmariadbclient.a
|
||||
CACHE INTERNAL "" FORCE)
|
42
cmake/FindMariaDBConnector.cmake
Normal file
42
cmake/FindMariaDBConnector.cmake
Normal file
@ -0,0 +1,42 @@
|
||||
# This CMake file tries to find the the MariaDB Connector-C
|
||||
# The following variables are set:
|
||||
# MARIADB_CONNECTOR_FOUND - System has the connector
|
||||
# MARIADB_CONNECTOR_STATIC_FOUND - System has static version of the connector library
|
||||
# MARIADB_CONNECTOR_LIBRARIES - The dynamic connector libraries
|
||||
# MARIADB_CONNECTOR_STATIC_LIBRARIES - The static connector libraries
|
||||
# MARIADB_CONNECTOR_INCLUDE_DIR - The connector headers
|
||||
|
||||
find_library(MARIADB_CONNECTOR_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
|
||||
if(${MARIADB_CONNECTOR_LIBRARIES} MATCHES "NOTFOUND")
|
||||
set(MARIADB_CONNECTOR_FOUND FALSE CACHE INTERNAL "")
|
||||
message(STATUS "Dynamic MySQL client library not found.")
|
||||
unset(MARIADB_CONNECTOR_LIBRARIES)
|
||||
else()
|
||||
set(MARIADB_CONNECTOR_FOUND TRUE CACHE INTERNAL "")
|
||||
message(STATUS "Found dynamic MySQL client library: ${MARIADB_CONNECTOR_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
find_library(MARIADB_CONNECTOR_STATIC_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
|
||||
if(${MARIADB_CONNECTOR_STATIC_LIBRARIES} MATCHES "NOTFOUND")
|
||||
set(MARIADB_CONNECTOR_STATIC_FOUND FALSE CACHE INTERNAL "")
|
||||
message(STATUS "Static MySQL client library not found.")
|
||||
unset(MARIADB_CONNECTOR_STATIC_LIBRARIES)
|
||||
else()
|
||||
set(MARIADB_CONNECTOR_STATIC_FOUND TRUE CACHE INTERNAL "")
|
||||
message(STATUS "Found statc MySQL client library: ${MARIADB_CONNECTOR_STATIC_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
find_path(MARIADB_CONNECTOR_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql mariadb)
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(LIBMARIADB ${MARIADB_CONNECTOR_INCLUDE_DIR}/mysql.h HAVE_MARIADB_CONNECTOR)
|
||||
|
||||
if(HAVE_MARIADB_CONNECTOR)
|
||||
message(STATUS "Found MariaDB Connector-C")
|
||||
else()
|
||||
set(MARIADB_CONNECTOR_FOUND FALSE CACHE INTERNAL "" FORCE)
|
||||
endif()
|
@ -1,42 +1,43 @@
|
||||
# This CMake file tries to find the the mysql_version.h header
|
||||
# and to parse it for version and provider strings
|
||||
# The following variables are set:
|
||||
# MYSQL_VERSION - The MySQL version number
|
||||
# MYSQL_PROVIDER - The MySQL provider e.g. MariaDB
|
||||
# MYSQL_EMBEDDED_LIB - The MySQL embedded library
|
||||
# MYSQL_EMBEDDED_VERSION - The MySQL version number
|
||||
# MYSQL_EMBEDDED_PROVIDER - The MySQL provider e.g. MariaDB
|
||||
# MYSQL_EMBEDDED_LIBRARIES - The MySQL embedded library
|
||||
# MYSQL_EMBEDDED_INCLUDE_DIR - Path to MySQL headers
|
||||
|
||||
find_file(MYSQL_VERSION_H mysql_version.h PATH_SUFFIXES mysql)
|
||||
if(MYSQL_VERSION_H MATCHES "MYSQL_VERSION_H-NOTFOUND")
|
||||
find_file(MYSQL_EMBEDDED_VERSION_H mysql_version.h PATH_SUFFIXES mysql)
|
||||
if(MYSQL_EMBEDDED_VERSION_H MATCHES "MYSQL_EMBEDDED_VERSION_H-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find the mysql_version.h header")
|
||||
else()
|
||||
message(STATUS "Found mysql_version.h: ${MYSQL_VERSION_H}")
|
||||
message(STATUS "Found mysql_version.h: ${MYSQL_EMBEDDED_VERSION_H}")
|
||||
endif()
|
||||
|
||||
|
||||
file(READ ${MYSQL_VERSION_H} MYSQL_VERSION_CONTENTS)
|
||||
string(REGEX REPLACE ".*MYSQL_SERVER_VERSION[^0-9.]+([0-9.]+).*" "\\1" MYSQL_VERSION ${MYSQL_VERSION_CONTENTS})
|
||||
string(REGEX REPLACE ".*MYSQL_COMPILATION_COMMENT[[:space:]]+\"(.+)\".*" "\\1" MYSQL_PROVIDER ${MYSQL_VERSION_CONTENTS})
|
||||
string(TOLOWER ${MYSQL_PROVIDER} MYSQL_PROVIDER)
|
||||
if(MYSQL_PROVIDER MATCHES "[mM]aria[dD][bB]")
|
||||
set(MYSQL_PROVIDER "MariaDB" CACHE INTERNAL "The MySQL provider")
|
||||
elseif(MYSQL_PROVIDER MATCHES "mysql")
|
||||
set(MYSQL_PROVIDER "MySQL" CACHE INTERNAL "The MySQL provider")
|
||||
elseif(MYSQL_PROVIDER MATCHES "percona")
|
||||
set(MYSQL_PROVIDER "Percona" CACHE INTERNAL "The MySQL provider")
|
||||
file(READ ${MYSQL_EMBEDDED_VERSION_H} MYSQL_EMBEDDED_VERSION_CONTENTS)
|
||||
string(REGEX REPLACE ".*MYSQL_SERVER_VERSION[^0-9.]+([0-9.]+).*" "\\1" MYSQL_EMBEDDED_VERSION ${MYSQL_EMBEDDED_VERSION_CONTENTS})
|
||||
string(REGEX REPLACE ".*MYSQL_COMPILATION_COMMENT[[:space:]]+\"(.+)\".*" "\\1" MYSQL_EMBEDDED_PROVIDER ${MYSQL_EMBEDDED_VERSION_CONTENTS})
|
||||
string(TOLOWER ${MYSQL_EMBEDDED_PROVIDER} MYSQL_EMBEDDED_PROVIDER)
|
||||
if(MYSQL_EMBEDDED_PROVIDER MATCHES "[mM]aria[dD][bB]")
|
||||
set(MYSQL_EMBEDDED_PROVIDER "MariaDB" CACHE INTERNAL "The MySQL provider")
|
||||
elseif(MYSQL_EMBEDDED_PROVIDER MATCHES "mysql")
|
||||
set(MYSQL_EMBEDDED_PROVIDER "MySQL" CACHE INTERNAL "The MySQL provider")
|
||||
elseif(MYSQL_EMBEDDED_PROVIDER MATCHES "percona")
|
||||
set(MYSQL_EMBEDDED_PROVIDER "Percona" CACHE INTERNAL "The MySQL provider")
|
||||
else()
|
||||
set(MYSQL_PROVIDER "Unknown" CACHE INTERNAL "The MySQL provider")
|
||||
set(MYSQL_EMBEDDED_PROVIDER "Unknown" CACHE INTERNAL "The MySQL provider")
|
||||
endif()
|
||||
message(STATUS "MySQL version: ${MYSQL_VERSION}")
|
||||
message(STATUS "MySQL provider: ${MYSQL_PROVIDER}")
|
||||
message(STATUS "MySQL version: ${MYSQL_EMBEDDED_VERSION}")
|
||||
message(STATUS "MySQL provider: ${MYSQL_EMBEDDED_PROVIDER}")
|
||||
|
||||
if(NOT MYSQL_PROVIDER STREQUAL "MariaDB")
|
||||
message(WARNING "Not using a release version of MariaDB server. If this is intentional, please ignore this warning. Otherwise make sure the right libraries are installed and CMake finds the right libraries.")
|
||||
if(NOT MYSQL_EMBEDDED_PROVIDER STREQUAL "MariaDB")
|
||||
message(WARNING "Not using a release version of MariaDB server. If this is intentional, please ignore this warning. Otherwise make sure the right libraries are installed and CMake finds the right libraries.")
|
||||
endif()
|
||||
if(MYSQL_VERSION VERSION_LESS 5.5.41)
|
||||
message(WARNING "MySQL version is ${MYSQL_VERSION}. Minimum supported version is 5.5.41.")
|
||||
if(MYSQL_EMBEDDED_VERSION VERSION_LESS 5.5.41)
|
||||
message(WARNING "MySQL version is ${MYSQL_EMBEDDED_VERSION}. Minimum supported version is 5.5.41.")
|
||||
endif()
|
||||
|
||||
if(NOT (MYSQL_VERSION VERSION_LESS 10.1))
|
||||
if(NOT (MYSQL_EMBEDDED_VERSION VERSION_LESS 10.1))
|
||||
|
||||
# 10.1 needs lzma
|
||||
find_library(HAVE_LIBLZMA NAMES lzma)
|
||||
@ -47,18 +48,18 @@ if(NOT (MYSQL_VERSION VERSION_LESS 10.1))
|
||||
endif()
|
||||
|
||||
|
||||
if (DEFINED MYSQL_EMBEDDED_LIB)
|
||||
if( NOT (IS_DIRECTORY ${MYSQL_EMBEDDED_LIB}) )
|
||||
debugmsg("MYSQL_EMBEDDED_LIB is not a directory: ${MYSQL_EMBEDDED_LIB}")
|
||||
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
|
||||
if( NOT (IS_DIRECTORY ${MYSQL_EMBEDDED_LIBRARIES}) )
|
||||
debugmsg("MYSQL_EMBEDDED_LIBRARIES is not a directory: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
|
||||
set(COMP_VAR PATH)
|
||||
else()
|
||||
set(COMP_VAR DIRECTORY)
|
||||
endif()
|
||||
get_filename_component(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB} ${COMP_VAR})
|
||||
debugmsg("MYSQL_EMBEDDED_LIB directory component: ${MYSQL_EMBEDDED_LIB}")
|
||||
get_filename_component(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} ${COMP_VAR})
|
||||
debugmsg("MYSQL_EMBEDDED_LIBRARIES directory component: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
endif()
|
||||
debugmsg("Searching for the embedded library at: ${MYSQL_EMBEDDED_LIB}")
|
||||
debugmsg("Searching for the embedded library at: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(STATIC_EMBEDDED)
|
||||
@ -66,38 +67,38 @@ if(STATIC_EMBEDDED)
|
||||
debugmsg("Using the static embedded library...")
|
||||
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
if (DEFINED MYSQL_EMBEDDED_LIB)
|
||||
debugmsg("Searching for libmysqld.a at: ${MYSQL_EMBEDDED_LIB}")
|
||||
find_library(MYSQL_EMBEDDED_LIB_STATIC libmysqld.a PATHS ${MYSQL_EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
|
||||
debugmsg("Searching for libmysqld.a at: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
find_library(MYSQL_EMBEDDED_LIBRARIES_STATIC libmysqld.a PATHS ${MYSQL_EMBEDDED_LIBRARIES} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(MYSQL_EMBEDDED_LIB_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
|
||||
find_library(MYSQL_EMBEDDED_LIBRARIES_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
|
||||
endif()
|
||||
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIB_STATIC}")
|
||||
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIBRARIES_STATIC}")
|
||||
|
||||
set(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE)
|
||||
set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
|
||||
else()
|
||||
debugmsg("Using the dynamic embedded library...")
|
||||
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
|
||||
if (DEFINED MYSQL_EMBEDDED_LIB)
|
||||
debugmsg("Searching for libmysqld.so at: ${MYSQL_EMBEDDED_LIB}")
|
||||
find_library(MYSQL_EMBEDDED_LIB_DYNAMIC mysqld PATHS ${MYSQL_EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
|
||||
debugmsg("Searching for libmysqld.so at: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
find_library(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC mysqld PATHS ${MYSQL_EMBEDDED_LIBRARIES} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(MYSQL_EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
|
||||
find_library(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
|
||||
endif()
|
||||
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIB_DYNAMIC}")
|
||||
set(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE)
|
||||
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIBRARIES_DYNAMIC}")
|
||||
set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
|
||||
endif()
|
||||
|
||||
unset(MYSQL_EMBEDDED_LIB_DYNAMIC)
|
||||
unset(MYSQL_EMBEDDED_LIB_STATIC)
|
||||
unset(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC)
|
||||
unset(MYSQL_EMBEDDED_LIBRARIES_STATIC)
|
||||
unset(OLD_SUFFIXES)
|
||||
|
||||
check_library_exists(${MYSQL_EMBEDDED_LIB} pcre_stack_guard ${MYSQL_EMBEDDED_LIB} HAVE_EMBEDDED_PCRE)
|
||||
check_library_exists(${MYSQL_EMBEDDED_LIBRARIES} pcre_stack_guard ${MYSQL_EMBEDDED_LIBRARIES} HAVE_EMBEDDED_PCRE)
|
||||
|
||||
if(HAVE_EMBEDDED_PCRE)
|
||||
set(PCRE_LINK_FLAGS "" CACHE INTERNAL "pcre linker flags")
|
||||
@ -110,8 +111,49 @@ else()
|
||||
message(FATAL_ERROR "Could not find PCRE libraries.")
|
||||
endif()
|
||||
endif()
|
||||
if( (${MYSQL_EMBEDDED_LIB} MATCHES "NOTFOUND") OR (${MYSQL_EMBEDDED_LIB} MATCHES "NOTFOUND"))
|
||||
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DMYSQL_EMBEDDED_LIB=<path to library>")
|
||||
if( (${MYSQL_EMBEDDED_LIBRARIES} MATCHES "NOTFOUND") OR (${MYSQL_EMBEDDED_LIBRARIES} MATCHES "NOTFOUND"))
|
||||
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DMYSQL_EMBEDDED_LIBRARIES=<path to library>")
|
||||
else()
|
||||
message(STATUS "Using embedded library: ${MYSQL_EMBEDDED_LIB}")
|
||||
message(STATUS "Using embedded library: ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# Find the MySQL headers if they were not defined
|
||||
if(DEFINED MYSQL_EMBEDDED_INCLUDE_DIR)
|
||||
list(APPEND CMAKE_INCLUDE_PATH ${MYSQL_EMBEDDED_INCLUDE_DIR})
|
||||
find_path(MYSQL_EMBEDDED_INCLUDE_DIR_LOC mysql.h PATHS ${MYSQL_EMBEDDED_INCLUDE_DIR} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path(MYSQL_EMBEDDED_INCLUDE_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb)
|
||||
endif()
|
||||
|
||||
if(${MYSQL_EMBEDDED_INCLUDE_DIR_LOC} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
|
||||
else()
|
||||
set(MYSQL_EMBEDDED_INCLUDE_DIR ${MYSQL_EMBEDDED_INCLUDE_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
|
||||
message(STATUS "Using MySQL headers found at: ${MYSQL_EMBEDDED_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
unset(MYSQL_EMBEDDED_INCLUDE_DIR_LOC)
|
||||
|
||||
# Find the errmsg.sys file if it was not defied
|
||||
if( DEFINED ERRMSG )
|
||||
debugmsg("Looking for errmsg.sys at: ${ERRMSG}")
|
||||
if(NOT(IS_DIRECTORY ${ERRMSG}))
|
||||
get_filename_component(ERRMSG ${ERRMSG} PATH)
|
||||
debugmsg("Path to file is: ${ERRMSG}")
|
||||
endif()
|
||||
find_file(ERRMSG_FILE errmsg.sys PATHS ${ERRMSG} NO_DEFAULT_PATH)
|
||||
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found at ${ERRMSG}")
|
||||
else()
|
||||
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
|
||||
endif()
|
||||
else()
|
||||
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
|
||||
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
|
||||
else()
|
||||
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
|
||||
unset(ERRMSG_FILE)
|
||||
|
@ -1,33 +0,0 @@
|
||||
# This CMake file tries to find the the MySQL client library
|
||||
# The following variables are set:
|
||||
# MYSQLCLIENT_FOUND - System has MySQL client
|
||||
# MYSQLCLIENT_STATIC_FOUND - System has statically linked MySQL client
|
||||
# MARIADB_CONNECTOR_LIB - The MySQL client library
|
||||
# MARIADB_CONNECTOR_STATIC_LIB - The static MySQL client library
|
||||
# MYSQLCLIENT_HEADERS - The MySQL client headers
|
||||
|
||||
find_library(MARIADB_CONNECTOR_LIB NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
|
||||
if(${MARIADB_CONNECTOR_LIB} MATCHES "NOTFOUND")
|
||||
set(MYSQLCLIENT_FOUND FALSE CACHE INTERNAL "")
|
||||
message(STATUS "Dynamic MySQL client library not found.")
|
||||
unset(MARIADB_CONNECTOR_LIB)
|
||||
else()
|
||||
set(MYSQLCLIENT_FOUND TRUE CACHE INTERNAL "")
|
||||
message(STATUS "Found dynamic MySQL client library: ${MARIADB_CONNECTOR_LIB}")
|
||||
endif()
|
||||
|
||||
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
find_library(MARIADB_CONNECTOR_STATIC_LIB NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
|
||||
|
||||
if(${MARIADB_CONNECTOR_STATIC_LIB} MATCHES "NOTFOUND")
|
||||
set(MYSQLCLIENT_STATIC_FOUND FALSE CACHE INTERNAL "")
|
||||
message(STATUS "Static MySQL client library not found.")
|
||||
unset(MARIADB_CONNECTOR_STATIC_LIB)
|
||||
else()
|
||||
set(MYSQLCLIENT_STATIC_FOUND TRUE CACHE INTERNAL "")
|
||||
message(STATUS "Found statc MySQL client library: ${MARIADB_CONNECTOR_STATIC_LIB}")
|
||||
endif()
|
||||
|
||||
find_path(MYSQLCLIENT_HEADERS mysql.h PATH_SUFFIXES mysql mariadb)
|
@ -144,60 +144,15 @@ macro(check_deps)
|
||||
endmacro()
|
||||
|
||||
macro(check_dirs)
|
||||
# Find the MySQL headers if they were not defined
|
||||
|
||||
if(DEFINED MYSQL_DIR)
|
||||
debugmsg("Searching for MySQL headers at: ${MYSQL_DIR}")
|
||||
list(APPEND CMAKE_INCLUDE_PATH ${MYSQL_DIR})
|
||||
find_path(MYSQL_DIR_LOC mysql.h PATHS ${MYSQL_DIR} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path(MYSQL_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb)
|
||||
endif()
|
||||
|
||||
debugmsg("Search returned: ${MYSQL_DIR_LOC}")
|
||||
|
||||
if(${MYSQL_DIR_LOC} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
|
||||
else()
|
||||
set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
|
||||
message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}")
|
||||
endif()
|
||||
|
||||
unset(MYSQL_DIR_LOC)
|
||||
|
||||
# Find the errmsg.sys file if it was not defied
|
||||
if( DEFINED ERRMSG )
|
||||
debugmsg("Looking for errmsg.sys at: ${ERRMSG}")
|
||||
if(NOT(IS_DIRECTORY ${ERRMSG}))
|
||||
get_filename_component(ERRMSG ${ERRMSG} PATH)
|
||||
debugmsg("Path to file is: ${ERRMSG}")
|
||||
endif()
|
||||
find_file(ERRMSG_FILE errmsg.sys PATHS ${ERRMSG} NO_DEFAULT_PATH)
|
||||
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found at ${ERRMSG}")
|
||||
else()
|
||||
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
|
||||
endif()
|
||||
else()
|
||||
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
|
||||
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
|
||||
else()
|
||||
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
|
||||
unset(ERRMSG_FILE)
|
||||
|
||||
# Check which init.d script to install
|
||||
if(WITH_SCRIPTS)
|
||||
find_file(RPM_FNC functions PATHS /etc/rc.d/init.d)
|
||||
if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND")
|
||||
find_file(DEB_FNC init-functions PATHS /lib/lsb)
|
||||
if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND")
|
||||
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
|
||||
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
|
||||
else()
|
||||
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
|
||||
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
|
||||
endif()
|
||||
else()
|
||||
set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
|
||||
@ -215,16 +170,17 @@ endmacro()
|
||||
|
||||
function(subdirs VAR DIRPATH)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
|
||||
set(COMP_VAR PATH)
|
||||
else()
|
||||
set(COMP_VAR DIRECTORY)
|
||||
endif()
|
||||
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
|
||||
set(COMP_VAR PATH)
|
||||
else()
|
||||
set(COMP_VAR DIRECTORY)
|
||||
endif()
|
||||
file(GLOB_RECURSE SDIR ${DIRPATH}/*)
|
||||
foreach(LOOP ${SDIR})
|
||||
get_filename_component(LOOP ${LOOP} ${COMP_VAR})
|
||||
list(APPEND ALLDIRS ${LOOP})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES ALLDIRS)
|
||||
set(${VAR} "${ALLDIRS}" CACHE PATH " " FORCE)
|
||||
set(${VAR} "${ALLDIRS}" CACHE PATH " " FORCE)
|
||||
|
||||
endfunction()
|
||||
|
@ -1,12 +1,14 @@
|
||||
subdirs(MYSQL_DIR_ALL ${MYSQL_DIR})
|
||||
foreach(DIR ${MYSQL_DIR_ALL})
|
||||
# Include the embedded library headers
|
||||
subdirs(MYSQL_INCLUDE_DIR_ALL ${MYSQL_EMBEDDED_INCLUDE_DIR})
|
||||
foreach(DIR ${MYSQL_INCLUDE_DIR_ALL})
|
||||
include_directories(${DIR})
|
||||
endforeach()
|
||||
include_directories(${MYSQL_INCLUDE})
|
||||
include_directories(${MYSQL_EMMBEDDED_INCLUDE_DIR}/..)
|
||||
|
||||
add_library(qc_mysqlembedded SHARED qc_mysqlembedded.cc)
|
||||
|
||||
target_link_libraries(qc_mysqlembedded ${MYSQL_EMBEDDED_LIB} aio crypt crypto dl m ${PCRE_LINK_FLAGS} ssl stdc++ z)
|
||||
include_directories(${MYSQL_INCLUDE_DIR})
|
||||
target_link_libraries(qc_mysqlembedded ${MYSQL_EMBEDDED_LIBRARIES} aio crypt crypto dl m ${PCRE_LINK_FLAGS} ssl stdc++ z)
|
||||
set_target_properties(qc_mysqlembedded PROPERTIES VERSION "1.0.0")
|
||||
set_target_properties(qc_mysqlembedded PROPERTIES LINK_FLAGS -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/qc_mysqlembedded.map)
|
||||
#set_target_properties(qc_mysqlembedded PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||
|
@ -133,12 +133,21 @@ bool qc_is_real_query(GWBUF* query)
|
||||
|
||||
return classifier->qc_is_real_query(query);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
char** qc_get_table_names(GWBUF* query, int* tblsize, bool fullnames)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
=======
|
||||
|
||||
char** qc_get_table_names(GWBUF* query, int* tblsize, bool fullnames)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
>>>>>>> origin/MXS-517
|
||||
return classifier->qc_get_table_names(query, tblsize, fullnames);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
subdirs(MYSQL_DIR_ALL ${MYSQL_DIR})
|
||||
foreach(DIR ${MYSQL_DIR_ALL})
|
||||
# Include the embedded library headers
|
||||
subdirs(MYSQL_INCLUDE_DIR_ALL ${MYSQL_EMBEDDED_INCLUDE_DIR})
|
||||
foreach(DIR ${MYSQL_INCLUDE_DIR_ALL})
|
||||
include_directories(${DIR})
|
||||
endforeach()
|
||||
include_directories(${MYSQL_INCLUDE})
|
||||
include_directories(${MYSQL_EMMBEDDED_INCLUDE_DIR}/..)
|
||||
|
||||
if(${ERRMSG} MATCHES "ERRMSG-NOTFOUND")
|
||||
message(FATAL_ERROR "The errmsg.sys file was not found, please define the path with -DERRMSG=<path>")
|
||||
|
@ -1,4 +1,5 @@
|
||||
include_directories(${MARIADB_CONNECTOR_INCLUDE})
|
||||
# Use the client libraries in MaxScale core
|
||||
include_directories(${MARIADB_CONNECTOR_INCLUDE_DIR})
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(modules)
|
||||
|
@ -1,6 +1,6 @@
|
||||
add_library(maxscale-common SHARED adminusers.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c maxscale_pcre2.c memlog.c modutil.c monitor.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/utils/skygw_utils.cc statistics.c)
|
||||
|
||||
target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIB} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
|
||||
target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
|
||||
|
||||
if(WITH_JEMALLOC)
|
||||
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})
|
||||
@ -10,6 +10,7 @@ endif()
|
||||
|
||||
add_dependencies(maxscale-common pcre2)
|
||||
install(TARGETS maxscale-common DESTINATION ${MAXSCALE_LIBDIR})
|
||||
set_target_properties(maxscale-common PROPERTIES VERSION "1.0.0")
|
||||
|
||||
add_executable(maxscale gateway.c)
|
||||
add_dependencies(maxscale pcre2)
|
||||
|
@ -6,7 +6,7 @@ install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR})
|
||||
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c)
|
||||
# maxbinlogcheck refers to my_uuid_init and my_uuin. They are non-public functions and
|
||||
# should not be used. They are found only from the embedded lib.
|
||||
target_link_libraries(maxbinlogcheck maxscale-common query_classifier ${MYSQL_EMBEDDED_LIB})
|
||||
target_link_libraries(maxbinlogcheck maxscale-common query_classifier ${MYSQL_EMBEDDED_LIBRARIES})
|
||||
|
||||
install(TARGETS maxbinlogcheck DESTINATION bin)
|
||||
|
||||
|
@ -2,6 +2,6 @@ if(BUILD_TESTS)
|
||||
add_executable(testbinlogrouter testbinlog.c ../blr.c ../blr_slave.c ../blr_master.c ../blr_file.c ../blr_cache.c)
|
||||
# testbinlogrouter refers to my_uuid_init and my_uuin. They are non-public functions and
|
||||
# should not be used. They are found only from the embedded lib.
|
||||
target_link_libraries(testbinlogrouter maxscale-common query_classifier ${MYSQL_EMBEDDED_LIB})
|
||||
target_link_libraries(testbinlogrouter maxscale-common query_classifier ${MYSQL_EMBEDDED_LIBRARIES})
|
||||
add_test(TestBinlogRouter ${CMAKE_CURRENT_BINARY_DIR}/testbinlogrouter)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user