2016-10-06 19:24:09 +02:00
|
|
|
# TODO: Copyrights
|
2017-03-25 19:18:06 +01:00
|
|
|
|
|
|
|
MACRO(SKIP_ROCKSDB_PLUGIN msg)
|
|
|
|
MESSAGE_ONCE(SKIP_ROCKSDB_PLUGIN "Can't build rocksdb engine - ${msg}")
|
|
|
|
RETURN()
|
|
|
|
ENDMACRO()
|
|
|
|
|
2017-02-07 19:40:55 +01:00
|
|
|
IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile AND GIT_EXECUTABLE)
|
|
|
|
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule init
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
ENDIF()
|
2017-02-01 22:27:13 +01:00
|
|
|
|
|
|
|
IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile")
|
2017-03-25 19:18:06 +01:00
|
|
|
SKIP_ROCKSDB_PLUGIN("Missing Makefile in rocksdb directory. Try \"git submodule update\".")
|
2016-10-06 19:24:09 +02:00
|
|
|
ENDIF()
|
|
|
|
|
2017-03-14 00:01:11 +01:00
|
|
|
# We've had our builders hang during the build process. This prevents MariaRocks
|
|
|
|
# to be built on 32 bit intel OS kernels.
|
|
|
|
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86")
|
|
|
|
SKIP_ROCKSDB_PLUGIN("Intel 32 bit not supported.")
|
|
|
|
ENDIF()
|
2017-02-01 22:27:13 +01:00
|
|
|
|
|
|
|
# This plugin needs recent C++ compilers (it is using C++11 features)
|
|
|
|
# Skip build for the old compilers
|
|
|
|
SET(CXX11_FLAGS)
|
|
|
|
SET(OLD_COMPILER_MSG "requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2015)")
|
|
|
|
|
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
|
|
|
IF (GCC_VERSION VERSION_LESS 4.8)
|
|
|
|
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
|
|
|
|
ENDIF()
|
|
|
|
SET(CXX11_FLAGS "-std=c++11")
|
|
|
|
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
|
|
|
|
(CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
|
|
|
|
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
|
|
|
|
ENDIF()
|
2017-02-07 21:10:38 +01:00
|
|
|
SET(CXX11_FLAGS "-std=c++11 -stdlib=libstdc++")
|
2017-02-01 22:27:13 +01:00
|
|
|
ELSEIF(MSVC)
|
|
|
|
IF (MSVC_VERSION LESS 1900)
|
|
|
|
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
|
|
|
|
ENDIF()
|
|
|
|
ELSE()
|
|
|
|
SKIP_ROCKSDB_PLUGIN("Compiler not supported")
|
|
|
|
ENDIF()
|
2016-10-07 10:25:10 +02:00
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
IF(CXX11_FLAGS)
|
|
|
|
ADD_DEFINITIONS(${CXX11_FLAGS})
|
2016-12-31 21:30:09 +01:00
|
|
|
ENDIF()
|
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
SET(ROCKSDB_SE_SOURCES
|
|
|
|
rdb_mariadb_server_port.cc
|
|
|
|
rdb_mariadb_server_port.h
|
|
|
|
ha_rocksdb.cc
|
|
|
|
ha_rocksdb.h
|
|
|
|
rdb_i_s.cc
|
|
|
|
rdb_i_s.h
|
|
|
|
rdb_mutex_wrapper.cc
|
|
|
|
rdb_mutex_wrapper.h
|
|
|
|
rdb_index_merge.cc
|
|
|
|
rdb_index_merge.h
|
|
|
|
properties_collector.cc
|
|
|
|
properties_collector.h
|
|
|
|
rdb_datadic.cc
|
|
|
|
rdb_datadic.h
|
|
|
|
rdb_cf_manager.cc
|
|
|
|
rdb_cf_manager.h
|
|
|
|
rdb_utils.cc rdb_utils.h
|
|
|
|
rdb_threads.cc
|
|
|
|
rdb_threads.h
|
2017-03-11 21:00:08 +01:00
|
|
|
rdb_psi.h
|
|
|
|
rdb_psi.cc
|
2016-10-06 19:24:09 +02:00
|
|
|
)
|
|
|
|
|
2017-03-17 16:08:34 +01:00
|
|
|
MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SE_SOURCES} STORAGE_ENGINE
|
|
|
|
MODULE_OUTPUT_NAME ha_rocksdb
|
|
|
|
COMPONENT rocksdb-engine)
|
2016-10-06 19:24:09 +02:00
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
IF(NOT TARGET rocksdb_se)
|
|
|
|
# Bail out if compilation with rocksdb engine is not requested
|
|
|
|
RETURN()
|
|
|
|
ENDIF()
|
|
|
|
|
2017-03-11 21:00:08 +01:00
|
|
|
# MARIAROCKS-TODO: ???
|
2017-03-11 05:17:42 +01:00
|
|
|
CHECK_FUNCTION_EXISTS(fallocate HAVE_FALLOCATE)
|
|
|
|
IF(HAVE_FALLOCATE)
|
|
|
|
ADD_DEFINITIONS(-DROCKSDB_FALLOCATE_PRESENT)
|
|
|
|
ENDIF()
|
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
INCLUDE(build_rocksdb.cmake)
|
|
|
|
|
|
|
|
ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
|
2016-12-04 21:55:54 +01:00
|
|
|
ha_rocksdb_proto.h
|
2016-10-06 19:24:09 +02:00
|
|
|
logger.h
|
|
|
|
rdb_comparator.h
|
2017-02-01 22:27:13 +01:00
|
|
|
rdb_cf_options.cc
|
|
|
|
rdb_cf_options.h
|
|
|
|
event_listener.cc
|
|
|
|
event_listener.h
|
|
|
|
rdb_perf_context.cc
|
|
|
|
rdb_perf_context.h
|
|
|
|
rdb_sst_info.cc
|
|
|
|
rdb_sst_info.h
|
|
|
|
rdb_buff.h
|
2017-03-11 21:00:08 +01:00
|
|
|
rdb_mariadb_port.h
|
2016-10-06 19:24:09 +02:00
|
|
|
)
|
2017-02-01 22:27:13 +01:00
|
|
|
|
|
|
|
ADD_DEPENDENCIES(rocksdb_aux_lib GenError)
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
|
|
|
|
TARGET_LINK_LIBRARIES(rocksdb_se rocksdb_aux_lib)
|
|
|
|
|
2017-02-07 21:10:38 +01:00
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
# MARIAROCKS_NOT_YET: Add -frtti flag when compiling RocksDB files.
|
|
|
|
# TODO: is this the right way to do this?
|
|
|
|
# - SQL layer and storage/rocksdb/*.cc are compiled with -fnortti
|
|
|
|
# - RocksDB files are compiled with "-fnortti ... -frtti"
|
|
|
|
# - This causes RocksDB headers to be compiled with different settings:
|
|
|
|
# = with RTTI when compiling RocksDB
|
|
|
|
# = without RTTI when compiling storage/rocksdb/*.cc
|
|
|
|
#
|
|
|
|
# (facebook/mysql-5.6 just compiles everything without -f*rtti, which means
|
|
|
|
# everything is compiled with -frtti)
|
|
|
|
#
|
|
|
|
# (also had to add -frtti above, because something that event_listener.cc
|
|
|
|
# includes requires it. So, now everything in MariaRocks is compiled with
|
|
|
|
# -frtti)
|
|
|
|
set_source_files_properties(event_listener.cc rdb_cf_options.cc
|
|
|
|
PROPERTIES COMPILE_FLAGS -frtti)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
|
|
|
|
IF(HAVE_SCHED_GETCPU)
|
|
|
|
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
|
|
|
|
ENDIF()
|
2016-10-06 19:24:09 +02:00
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
IF(WITH_UNIT_TESTS AND WITH_EMBEDDED_SERVER)
|
|
|
|
ADD_SUBDIRECTORY(unittest)
|
|
|
|
ENDIF()
|
2016-12-31 23:50:17 +01:00
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
ADD_LIBRARY(rocksdb_tools STATIC
|
|
|
|
rocksdb/tools/ldb_tool.cc
|
|
|
|
rocksdb/tools/ldb_cmd.cc
|
|
|
|
rocksdb/tools/sst_dump_tool.cc
|
2016-12-04 21:55:54 +01:00
|
|
|
)
|
|
|
|
|
2017-02-01 22:27:13 +01:00
|
|
|
MYSQL_ADD_EXECUTABLE(sst_dump rocksdb/tools/sst_dump.cc)
|
|
|
|
TARGET_LINK_LIBRARIES(sst_dump rocksdblib)
|
|
|
|
|
|
|
|
MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc)
|
|
|
|
TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib)
|
|
|
|
|
2017-02-07 21:10:38 +01:00
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2017-03-25 22:28:05 +01:00
|
|
|
SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS -frtti)
|
2017-02-01 22:27:13 +01:00
|
|
|
ENDIF()
|
|
|
|
IF(MSVC)
|
|
|
|
# RocksDB, the storage engine, overdoes "const" by adding
|
|
|
|
# additional const qualifiers to parameters of the overriden virtual functions
|
|
|
|
# This creates a lot of warnings, that we silence here.
|
|
|
|
ADD_DEFINITIONS(/wd4373)
|
|
|
|
|
|
|
|
# Some checks in C++ runtime that make debug build much slower
|
|
|
|
ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0)
|
2016-10-06 19:24:09 +02:00
|
|
|
ENDIF()
|