2020-06-09 00:22:28 +08:00
|
|
|
# FindRocksDB
|
|
|
|
|
|
|
|
find_package(RocksDB)
|
|
|
|
|
|
|
|
include(ExternalProject)
|
|
|
|
|
|
|
|
if (RocksDB_FOUND)
|
|
|
|
ExternalProject_Add(rocksdb
|
|
|
|
SOURCE_DIR "${RocksDB_ROOT}"
|
|
|
|
DOWNLOAD_COMMAND ""
|
2020-06-09 00:46:42 +08:00
|
|
|
CMAKE_ARGS -DUSE_RTTI=1 -DPORTABLE=${PORTABLE_ROCKSDB}
|
2020-06-09 00:22:28 +08:00
|
|
|
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
|
|
|
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
|
|
-DWITH_GFLAGS=OFF
|
|
|
|
-DWITH_TESTS=OFF
|
|
|
|
-DWITH_TOOLS=OFF
|
|
|
|
-DWITH_CORE_TOOLS=OFF
|
|
|
|
-DWITH_BENCHMARK_TOOLS=OFF
|
|
|
|
-DWITH_BZ2=OFF
|
|
|
|
-DWITH_LZ4=OFF
|
|
|
|
-DWITH_SNAPPY=OFF
|
|
|
|
-DWITH_ZLIB=OFF
|
|
|
|
-DWITH_ZSTD=OFF
|
2020-06-11 23:27:36 +08:00
|
|
|
-DROCKSDB_BUILD_SHARED=OFF
|
2020-06-09 00:22:28 +08:00
|
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=True
|
2020-06-11 06:37:03 +08:00
|
|
|
BUILD_BYPRODUCTS <BINARY_DIR>/librocksdb.a
|
2020-06-09 01:00:18 +08:00
|
|
|
INSTALL_COMMAND ""
|
2020-06-09 00:22:28 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
ExternalProject_Get_Property(rocksdb BINARY_DIR)
|
|
|
|
set(ROCKSDB_LIBRARIES
|
|
|
|
${BINARY_DIR}/librocksdb.a)
|
|
|
|
else()
|
|
|
|
ExternalProject_Add(rocksdb
|
|
|
|
URL https://github.com/facebook/rocksdb/archive/v6.10.1.tar.gz
|
|
|
|
URL_HASH SHA256=d573d2f15cdda883714f7e0bc87b814a8d4a53a82edde558f08f940e905541ee
|
2020-06-09 00:46:42 +08:00
|
|
|
CMAKE_ARGS -DUSE_RTTI=1 -DPORTABLE=${PORTABLE_ROCKSDB}
|
2020-06-09 00:22:28 +08:00
|
|
|
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
|
|
|
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
|
|
-DWITH_GFLAGS=OFF
|
|
|
|
-DWITH_TESTS=OFF
|
|
|
|
-DWITH_TOOLS=OFF
|
|
|
|
-DWITH_CORE_TOOLS=OFF
|
|
|
|
-DWITH_BENCHMARK_TOOLS=OFF
|
|
|
|
-DWITH_BZ2=OFF
|
|
|
|
-DWITH_LZ4=OFF
|
|
|
|
-DWITH_SNAPPY=OFF
|
|
|
|
-DWITH_ZLIB=OFF
|
|
|
|
-DWITH_ZSTD=OFF
|
2020-06-11 23:27:36 +08:00
|
|
|
-DROCKSDB_BUILD_SHARED=OFF
|
2020-06-09 00:22:28 +08:00
|
|
|
-DCMAKE_POSITION_INDEPENDENT_CODE=True
|
2020-06-11 06:37:03 +08:00
|
|
|
BUILD_BYPRODUCTS <BINARY_DIR/librocksdb.a
|
2020-06-09 01:00:18 +08:00
|
|
|
INSTALL_COMMAND ""
|
2020-06-09 00:22:28 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
ExternalProject_Get_Property(rocksdb BINARY_DIR)
|
|
|
|
set(ROCKSDB_LIBRARIES
|
|
|
|
${BINARY_DIR}/librocksdb.a)
|
|
|
|
|
|
|
|
set(ROCKSDB_FOUND TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Found RocksDB library: ${ROCKSDB_LIBRARIES}")
|
|
|
|
message(STATUS "Found RocksDB includes: ${ROCKSDB_INCLUDE_DIRS}")
|
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
ROCKSDB_LIBRARIES
|
2020-06-09 00:46:42 +08:00
|
|
|
ROCKSDB_INCLUDE_DIR
|
2020-06-09 00:22:28 +08:00
|
|
|
)
|