|
|
@ -32,18 +32,19 @@ |
|
|
|
# 3. cmake .. |
|
|
|
# 3. cmake .. |
|
|
|
# 4. make -j |
|
|
|
# 4. make -j |
|
|
|
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.8.12) |
|
|
|
cmake_minimum_required(VERSION 3.5.1) |
|
|
|
project(rocksdb) |
|
|
|
|
|
|
|
enable_language(CXX) |
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/") |
|
|
|
enable_language(C) |
|
|
|
include(ReadVersion) |
|
|
|
enable_language(ASM) |
|
|
|
get_rocksdb_version(rocksdb_VERSION) |
|
|
|
|
|
|
|
project(rocksdb |
|
|
|
|
|
|
|
VERSION ${rocksdb_VERSION} |
|
|
|
|
|
|
|
LANGUAGES CXX C ASM) |
|
|
|
|
|
|
|
|
|
|
|
if(POLICY CMP0042) |
|
|
|
if(POLICY CMP0042) |
|
|
|
cmake_policy(SET CMP0042 NEW) |
|
|
|
cmake_policy(SET CMP0042 NEW) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_program(CCACHE_FOUND ccache) |
|
|
|
find_program(CCACHE_FOUND ccache) |
|
|
|
if(CCACHE_FOUND) |
|
|
|
if(CCACHE_FOUND) |
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) |
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) |
|
|
@ -74,8 +75,7 @@ else() |
|
|
|
if(WITH_JEMALLOC) |
|
|
|
if(WITH_JEMALLOC) |
|
|
|
find_package(JeMalloc REQUIRED) |
|
|
|
find_package(JeMalloc REQUIRED) |
|
|
|
add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) |
|
|
|
add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) |
|
|
|
include_directories(${JEMALLOC_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS JeMalloc::JeMalloc) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${JEMALLOC_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
@ -93,43 +93,38 @@ else() |
|
|
|
if(WITH_SNAPPY) |
|
|
|
if(WITH_SNAPPY) |
|
|
|
find_package(snappy REQUIRED) |
|
|
|
find_package(snappy REQUIRED) |
|
|
|
add_definitions(-DSNAPPY) |
|
|
|
add_definitions(-DSNAPPY) |
|
|
|
include_directories(${SNAPPY_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS snappy::snappy) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(WITH_ZLIB) |
|
|
|
if(WITH_ZLIB) |
|
|
|
find_package(ZLIB REQUIRED) |
|
|
|
find_package(ZLIB REQUIRED) |
|
|
|
add_definitions(-DZLIB) |
|
|
|
add_definitions(-DZLIB) |
|
|
|
if(ZLIB_INCLUDE_DIRS) |
|
|
|
list(APPEND THIRDPARTY_LIBS ZLIB::ZLIB) |
|
|
|
# CMake 3 |
|
|
|
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS}) |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
# CMake 2 |
|
|
|
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIR}) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
option(WITH_BZ2 "build with bzip2" OFF) |
|
|
|
option(WITH_BZ2 "build with bzip2" OFF) |
|
|
|
if(WITH_BZ2) |
|
|
|
if(WITH_BZ2) |
|
|
|
find_package(bzip2 REQUIRED) |
|
|
|
find_package(BZip2 REQUIRED) |
|
|
|
add_definitions(-DBZIP2) |
|
|
|
add_definitions(-DBZIP2) |
|
|
|
|
|
|
|
if(BZIP2_INCLUDE_DIRS) |
|
|
|
|
|
|
|
include_directories(${BZIP2_INCLUDE_DIRS}) |
|
|
|
|
|
|
|
else() |
|
|
|
include_directories(${BZIP2_INCLUDE_DIR}) |
|
|
|
include_directories(${BZIP2_INCLUDE_DIR}) |
|
|
|
|
|
|
|
endif() |
|
|
|
list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES}) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(WITH_LZ4) |
|
|
|
if(WITH_LZ4) |
|
|
|
find_package(lz4 REQUIRED) |
|
|
|
find_package(lz4 REQUIRED) |
|
|
|
add_definitions(-DLZ4) |
|
|
|
add_definitions(-DLZ4) |
|
|
|
include_directories(${LZ4_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS lz4::lz4) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${LZ4_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(WITH_ZSTD) |
|
|
|
if(WITH_ZSTD) |
|
|
|
find_package(zstd REQUIRED) |
|
|
|
find_package(zstd REQUIRED) |
|
|
|
add_definitions(-DZSTD) |
|
|
|
add_definitions(-DZSTD) |
|
|
|
include_directories(${ZSTD_INCLUDE_DIR}) |
|
|
|
include_directories(${ZSTD_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${ZSTD_LIBRARIES}) |
|
|
|
list(APPEND THIRDPARTY_LIBS zstd::zstd) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
@ -150,17 +145,6 @@ endif() |
|
|
|
string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA "${GIT_SHA}") |
|
|
|
string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA "${GIT_SHA}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Read rocksdb version from version.h header file. |
|
|
|
|
|
|
|
file(READ include/rocksdb/version.h version_header_file) |
|
|
|
|
|
|
|
string(REGEX MATCH "#define ROCKSDB_MAJOR ([0-9]+)" _ ${version_header_file}) |
|
|
|
|
|
|
|
set(ROCKSDB_VERSION_MAJOR ${CMAKE_MATCH_1}) |
|
|
|
|
|
|
|
string(REGEX MATCH "#define ROCKSDB_MINOR ([0-9]+)" _ ${version_header_file}) |
|
|
|
|
|
|
|
set(ROCKSDB_VERSION_MINOR ${CMAKE_MATCH_1}) |
|
|
|
|
|
|
|
string(REGEX MATCH "#define ROCKSDB_PATCH ([0-9]+)" _ ${version_header_file}) |
|
|
|
|
|
|
|
set(ROCKSDB_VERSION_PATCH ${CMAKE_MATCH_1}) |
|
|
|
|
|
|
|
set(ROCKSDB_VERSION ${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
option(WITH_MD_LIBRARY "build with MD" ON) |
|
|
|
option(WITH_MD_LIBRARY "build with MD" ON) |
|
|
|
if(WIN32 AND MSVC) |
|
|
|
if(WIN32 AND MSVC) |
|
|
|
if(WITH_MD_LIBRARY) |
|
|
|
if(WITH_MD_LIBRARY) |
|
|
@ -316,15 +300,14 @@ if(WITH_NUMA) |
|
|
|
find_package(NUMA REQUIRED) |
|
|
|
find_package(NUMA REQUIRED) |
|
|
|
add_definitions(-DNUMA) |
|
|
|
add_definitions(-DNUMA) |
|
|
|
include_directories(${NUMA_INCLUDE_DIR}) |
|
|
|
include_directories(${NUMA_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${NUMA_LIBRARIES}) |
|
|
|
list(APPEND THIRDPARTY_LIBS NUMA::NUMA) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
option(WITH_TBB "build with Threading Building Blocks (TBB)" OFF) |
|
|
|
option(WITH_TBB "build with Threading Building Blocks (TBB)" OFF) |
|
|
|
if(WITH_TBB) |
|
|
|
if(WITH_TBB) |
|
|
|
find_package(TBB REQUIRED) |
|
|
|
find_package(TBB REQUIRED) |
|
|
|
add_definitions(-DTBB) |
|
|
|
add_definitions(-DTBB) |
|
|
|
include_directories(${TBB_INCLUDE_DIR}) |
|
|
|
list(APPEND THIRDPARTY_LIBS TBB::TBB) |
|
|
|
list(APPEND THIRDPARTY_LIBS ${TBB_LIBRARIES}) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Stall notifications eat some performance from inserts |
|
|
|
# Stall notifications eat some performance from inserts |
|
|
@ -777,8 +760,8 @@ else() |
|
|
|
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) |
|
|
|
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) |
|
|
|
set_target_properties(${ROCKSDB_SHARED_LIB} PROPERTIES |
|
|
|
set_target_properties(${ROCKSDB_SHARED_LIB} PROPERTIES |
|
|
|
LINKER_LANGUAGE CXX |
|
|
|
LINKER_LANGUAGE CXX |
|
|
|
VERSION ${ROCKSDB_VERSION} |
|
|
|
VERSION ${rocksdb_VERSION} |
|
|
|
SOVERSION ${ROCKSDB_VERSION_MAJOR} |
|
|
|
SOVERSION ${rocksdb_VERSION_MAJOR} |
|
|
|
CXX_STANDARD 11 |
|
|
|
CXX_STANDARD 11 |
|
|
|
OUTPUT_NAME "rocksdb") |
|
|
|
OUTPUT_NAME "rocksdb") |
|
|
|
endif() |
|
|
|
endif() |
|
|
@ -833,7 +816,7 @@ if(NOT WIN32 OR ROCKSDB_INSTALL_ON_WINDOWS) |
|
|
|
|
|
|
|
|
|
|
|
write_basic_package_version_file( |
|
|
|
write_basic_package_version_file( |
|
|
|
RocksDBConfigVersion.cmake |
|
|
|
RocksDBConfigVersion.cmake |
|
|
|
VERSION ${ROCKSDB_VERSION} |
|
|
|
VERSION ${rocksdb_VERSION} |
|
|
|
COMPATIBILITY SameMajorVersion |
|
|
|
COMPATIBILITY SameMajorVersion |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|