2017-08-02 11:17:21 +02:00
|
|
|
SET(TOKUDB_VERSION 5.6.36-82.1)
|
2015-10-26 12:48:26 +01:00
|
|
|
# PerconaFT only supports x86-64 and cmake-2.8.9+
|
2016-02-12 18:12:16 +01:00
|
|
|
IF(CMAKE_VERSION VERSION_LESS "2.8.9")
|
|
|
|
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
|
|
|
|
ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
|
|
|
|
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
|
2013-09-09 14:02:42 +02:00
|
|
|
CHECK_CXX_SOURCE_COMPILES(
|
|
|
|
"
|
|
|
|
struct a {int b; int c; };
|
|
|
|
struct a d = { .b=1, .c=2 };
|
|
|
|
int main() { return 0; }
|
|
|
|
" TOKUDB_OK)
|
|
|
|
ENDIF()
|
|
|
|
|
2015-11-13 18:41:58 +01:00
|
|
|
IF(NOT TOKUDB_OK)
|
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
|
|
|
|
2016-06-28 22:01:55 +02:00
|
|
|
SET(TOKUDB_SOURCES
|
|
|
|
ha_tokudb.cc
|
|
|
|
tokudb_background.cc
|
|
|
|
tokudb_information_schema.cc
|
|
|
|
tokudb_sysvars.cc
|
2017-05-19 12:59:43 +02:00
|
|
|
tokudb_thread.cc
|
|
|
|
tokudb_dir_cmd.cc)
|
2015-11-19 16:39:40 +01:00
|
|
|
MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY)
|
2015-11-13 18:41:58 +01:00
|
|
|
|
|
|
|
IF(NOT TARGET tokudb)
|
cmake fixes for tokudb
cmake/jemalloc.cmake:
for dependencies to work, LIBJEMALLOC should be the target name, not the path
storage/tokudb/CMakeLists.txt:
* check the preconditions
* disable bdb tests (compilation errors)
* set variable, instead of SET_PROPERTY. same effect,
but doesn't fail when a plugin is disabled (that is, a target does not exist)
storage/tokudb/ft-index/CMakeLists.txt:
cmake should not look into examples/ directory,
there is hand-crafted examples/Makefile that
cmake will overwrite
storage/tokudb/ft-index/buildheader/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/cmake_modules/TokuMergeLibs.cmake:
Libraries must be specified in the specific order,
REMOVE_DUPLICATES cannot be used, because it destroys this order.
(when OSLIBS contains "-lpthread -ljemalloc -lpthread", REMOVE_DUPLICATES
makes it "-lpthread -ljemalloc". But a thread library *must* be *after* jemalloc)
storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake:
* 'which' might print errors to stderr, they are not important, shut them up
* we don't have TOKUDB_DATA, no need to warn about it
* don't configure_file into itself (with input=output)
storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake:
jemalloc is built externally to tokudb/ft-index
storage/tokudb/ft-index/ft/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/ft/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/locktree/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/portability/CMakeLists.txt:
s/jemalloc/libjemalloc/
storage/tokudb/ft-index/portability/os_malloc.cc:
unnecessary include file
storage/tokudb/ft-index/portability/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/src/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/util/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/utils/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
2013-09-09 13:57:22 +02:00
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
2013-09-09 14:02:42 +02:00
|
|
|
|
2014-09-12 08:41:16 +02:00
|
|
|
IF(NOT LIBJEMALLOC)
|
|
|
|
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
|
|
|
|
ENDIF()
|
|
|
|
|
2015-09-01 21:58:10 +02:00
|
|
|
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
|
2014-12-19 11:35:44 +01:00
|
|
|
|
2013-11-19 15:35:31 +01:00
|
|
|
############################################
|
2015-12-15 23:34:32 +01:00
|
|
|
SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump" PARENT_SCOPE)
|
2013-11-11 17:20:10 +01:00
|
|
|
MARK_AS_ADVANCED(BUILDNAME)
|
|
|
|
MARK_AS_ADVANCED(BUILD_TESTING)
|
|
|
|
MARK_AS_ADVANCED(CMAKE_TOKUDB_REVISION)
|
|
|
|
MARK_AS_ADVANCED(LIBTOKUDB)
|
|
|
|
MARK_AS_ADVANCED(LIBTOKUPORTABILITY)
|
2015-12-15 20:13:09 +01:00
|
|
|
MARK_AS_ADVANCED(PROFILING)
|
|
|
|
MARK_AS_ADVANCED(SNAPPY_SOURCE_DIR)
|
2013-11-11 17:20:10 +01:00
|
|
|
MARK_AS_ADVANCED(TOKUDB_DATA)
|
|
|
|
MARK_AS_ADVANCED(TOKU_DEBUG_PARANOID)
|
|
|
|
MARK_AS_ADVANCED(USE_VALGRIND)
|
|
|
|
MARK_AS_ADVANCED(XZ_SOURCE_DIR)
|
2015-12-15 20:13:09 +01:00
|
|
|
MARK_AS_ADVANCED(gcc_ar)
|
|
|
|
MARK_AS_ADVANCED(gcc_ranlib)
|
cmake fixes for tokudb
cmake/jemalloc.cmake:
for dependencies to work, LIBJEMALLOC should be the target name, not the path
storage/tokudb/CMakeLists.txt:
* check the preconditions
* disable bdb tests (compilation errors)
* set variable, instead of SET_PROPERTY. same effect,
but doesn't fail when a plugin is disabled (that is, a target does not exist)
storage/tokudb/ft-index/CMakeLists.txt:
cmake should not look into examples/ directory,
there is hand-crafted examples/Makefile that
cmake will overwrite
storage/tokudb/ft-index/buildheader/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/cmake_modules/TokuMergeLibs.cmake:
Libraries must be specified in the specific order,
REMOVE_DUPLICATES cannot be used, because it destroys this order.
(when OSLIBS contains "-lpthread -ljemalloc -lpthread", REMOVE_DUPLICATES
makes it "-lpthread -ljemalloc". But a thread library *must* be *after* jemalloc)
storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake:
* 'which' might print errors to stderr, they are not important, shut them up
* we don't have TOKUDB_DATA, no need to warn about it
* don't configure_file into itself (with input=output)
storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake:
jemalloc is built externally to tokudb/ft-index
storage/tokudb/ft-index/ft/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/ft/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/locktree/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/portability/CMakeLists.txt:
s/jemalloc/libjemalloc/
storage/tokudb/ft-index/portability/os_malloc.cc:
unnecessary include file
storage/tokudb/ft-index/portability/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/src/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/util/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/utils/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
2013-09-09 13:57:22 +02:00
|
|
|
############################################
|
|
|
|
|
2015-12-15 17:23:58 +01:00
|
|
|
# pick language dialect
|
2016-06-28 22:01:55 +02:00
|
|
|
MY_CHECK_AND_SET_COMPILER_FLAG(-std=c++11)
|
2015-12-15 17:23:58 +01:00
|
|
|
|
2014-08-11 22:47:36 +02:00
|
|
|
SET(BUILD_TESTING OFF CACHE BOOL "")
|
|
|
|
SET(USE_VALGRIND OFF CACHE BOOL "")
|
|
|
|
SET(TOKU_DEBUG_PARANOID OFF CACHE BOOL "")
|
|
|
|
|
2015-12-15 17:23:58 +01:00
|
|
|
# Enable TokuDB's TOKUDB_DEBUG in debug builds
|
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTOKUDB_DEBUG")
|
|
|
|
|
2014-02-26 16:58:44 +01:00
|
|
|
IF(NOT DEFINED TOKUDB_VERSION)
|
|
|
|
IF(DEFINED ENV{TOKUDB_VERSION})
|
|
|
|
SET(TOKUDB_VERSION $ENV{TOKUDB_VERSION})
|
|
|
|
ENDIF()
|
2013-04-17 06:02:16 +02:00
|
|
|
ENDIF()
|
2014-02-26 16:58:44 +01:00
|
|
|
IF(DEFINED TOKUDB_VERSION)
|
2014-10-18 03:23:17 +02:00
|
|
|
ADD_DEFINITIONS("-DTOKUDB_VERSION=${TOKUDB_VERSION}")
|
2014-10-17 19:46:15 +02:00
|
|
|
IF (${TOKUDB_VERSION} MATCHES "^tokudb-([0-9]+)\\.([0-9]+)\\.([0-9]+.*)")
|
|
|
|
ADD_DEFINITIONS("-DTOKUDB_VERSION_MAJOR=${CMAKE_MATCH_1}")
|
|
|
|
ADD_DEFINITIONS("-DTOKUDB_VERSION_MINOR=${CMAKE_MATCH_2}")
|
2014-10-18 03:23:17 +02:00
|
|
|
ADD_DEFINITIONS("-DTOKUDB_VERSION_PATCH=${CMAKE_MATCH_3}")
|
|
|
|
ENDIF()
|
2013-04-17 06:02:16 +02:00
|
|
|
ENDIF()
|
|
|
|
|
2014-03-31 17:05:45 +02:00
|
|
|
IF(DEFINED TOKUDB_NOPATCH_CONFIG)
|
|
|
|
ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}")
|
|
|
|
ENDIF()
|
|
|
|
|
2015-09-01 21:58:10 +02:00
|
|
|
MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers)
|
2014-07-03 14:44:51 +02:00
|
|
|
|
2015-10-26 12:48:26 +01:00
|
|
|
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/PerconaFT/")
|
|
|
|
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ft-index/")
|
|
|
|
MESSAGE(FATAL_ERROR "Found both PerconaFT and ft-index sources. Don't know which to use.")
|
|
|
|
ENDIF ()
|
|
|
|
SET(TOKU_FT_DIR_NAME "PerconaFT")
|
|
|
|
|
|
|
|
ELSEIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ft-index/")
|
|
|
|
MESSAGE(WARNING "Found ft-index sources, ft-index is deprecated and replaced with PerconaFT.")
|
|
|
|
SET(TOKU_FT_DIR_NAME "ft-index")
|
|
|
|
ELSE ()
|
|
|
|
MESSAGE(FATAL_ERROR "Could not find PerconaFT sources.")
|
|
|
|
ENDIF ()
|
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(${TOKU_FT_DIR_NAME})
|
|
|
|
INCLUDE_DIRECTORIES(${TOKU_FT_DIR_NAME})
|
|
|
|
INCLUDE_DIRECTORIES(${TOKU_FT_DIR_NAME}/portability)
|
|
|
|
INCLUDE_DIRECTORIES(${TOKU_FT_DIR_NAME}/util)
|
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME})
|
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME}/buildheader)
|
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${TOKU_FT_DIR_NAME}/portability)
|
2013-04-17 06:02:04 +02:00
|
|
|
|
2015-11-19 16:39:40 +01:00
|
|
|
TARGET_LINK_LIBRARIES(tokudb tokufractaltree_static tokuportability_static
|
|
|
|
${ZLIB_LIBRARY} stdc++)
|
2015-11-13 18:41:58 +01:00
|
|
|
|
cmake fixes for tokudb
cmake/jemalloc.cmake:
for dependencies to work, LIBJEMALLOC should be the target name, not the path
storage/tokudb/CMakeLists.txt:
* check the preconditions
* disable bdb tests (compilation errors)
* set variable, instead of SET_PROPERTY. same effect,
but doesn't fail when a plugin is disabled (that is, a target does not exist)
storage/tokudb/ft-index/CMakeLists.txt:
cmake should not look into examples/ directory,
there is hand-crafted examples/Makefile that
cmake will overwrite
storage/tokudb/ft-index/buildheader/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/cmake_modules/TokuMergeLibs.cmake:
Libraries must be specified in the specific order,
REMOVE_DUPLICATES cannot be used, because it destroys this order.
(when OSLIBS contains "-lpthread -ljemalloc -lpthread", REMOVE_DUPLICATES
makes it "-lpthread -ljemalloc". But a thread library *must* be *after* jemalloc)
storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake:
* 'which' might print errors to stderr, they are not important, shut them up
* we don't have TOKUDB_DATA, no need to warn about it
* don't configure_file into itself (with input=output)
storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake:
jemalloc is built externally to tokudb/ft-index
storage/tokudb/ft-index/ft/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/ft/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/locktree/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/portability/CMakeLists.txt:
s/jemalloc/libjemalloc/
storage/tokudb/ft-index/portability/os_malloc.cc:
unnecessary include file
storage/tokudb/ft-index/portability/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/src/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/util/tests/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
storage/tokudb/ft-index/utils/CMakeLists.txt:
the syntax is ADD_EXECUTABLE(target source) and "source" is the file name
2013-09-09 13:57:22 +02:00
|
|
|
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -fuse-linker-plugin")
|
2013-11-19 15:35:31 +01:00
|
|
|
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} -flto -fuse-linker-plugin")
|
2013-09-10 22:59:18 +02:00
|
|
|
|
2013-11-11 09:30:35 +01:00
|
|
|
SET(CPACK_RPM_server_PACKAGE_OBSOLETES
|
2013-11-13 23:03:48 +01:00
|
|
|
"${CPACK_RPM_server_PACKAGE_OBSOLETES} MariaDB-tokudb-engine < 10.0.5" PARENT_SCOPE)
|
2013-11-11 09:30:35 +01:00
|
|
|
|
2013-09-10 22:59:18 +02:00
|
|
|
IF (INSTALL_SYSCONF2DIR)
|
2013-11-11 09:30:35 +01:00
|
|
|
INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} COMPONENT Server)
|
2013-09-10 22:59:18 +02:00
|
|
|
ENDIF(INSTALL_SYSCONF2DIR)
|