Skip to content

Commit

Permalink
kvrocks 2.3 + rocksdb 7.7.3 + cachelib
Browse files Browse the repository at this point in the history
  • Loading branch information
Chang Guo (Student) authored and Change72 committed Oct 26, 2023
1 parent 8eb4a2c commit eef8e37
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "C

if(ENABLE_STATIC_LIBSTDCXX)
try_compile(FOUND_STATIC_LIBSTDCXX ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/checks/static_libstdcxx.cc
LINK_OPTIONS -static-libstdc++ CXX_STANDARD 11)
LINK_OPTIONS -static-libstdc++ CXX_STANDARD 17)

if(NOT FOUND_STATIC_LIBSTDCXX)
message(FATAL_ERROR "cannot find static library of libstdc++, please add ENABLE_STATIC_LIBSTDCXX=OFF to disable")
Expand All @@ -169,13 +169,24 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "C
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
endif()
endif()
message(STATUS "Found zlib in ${zlib_SOURCE_DIR}")

add_library(zlib_with_headers INTERFACE) # rocksdb use it
target_include_directories(zlib_with_headers INTERFACE $<BUILD_INTERFACE:${zlib_SOURCE_DIR}> $<BUILD_INTERFACE:${zlib_BINARY_DIR}>)
target_link_libraries(zlib_with_headers INTERFACE zlibstatic)
add_library(ZLIB::ZLIB ALIAS zlib_with_headers)
install(TARGETS zlibstatic zlib_with_headers EXPORT RocksDBTargets) # export for install(...)
install(TARGETS zlibstatic zlib_with_headers EXPORT SpeedbTargets) # export for install(...)
# kvrocks objects target
file(GLOB_RECURSE KVROCKS_SRCS src/*.cc)
list(FILTER KVROCKS_SRCS EXCLUDE REGEX src/main.cc)

add_library(kvrocks_objs OBJECT ${KVROCKS_SRCS})

link_directories($ENV{HADOOP_HOME}/lib/native)
link_directories($ENV{JAVA_HOME}/jre/lib/amd64/server)
link_directories($ENV{JAVA_HOME}/jre/lib/amd64)

target_include_directories(kvrocks_objs PUBLIC src src/common ${PROJECT_BINARY_DIR})
target_compile_features(kvrocks_objs PUBLIC cxx_std_17)
target_compile_options(kvrocks_objs PUBLIC -Wall -Wpedantic -Wsign-compare -Wreturn-type -fno-omit-frame-pointer -Werror=unused-result)
Expand Down
11 changes: 6 additions & 5 deletions cmake/rocksdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ endif()

include(cmake/utils.cmake)

FetchContent_DeclareGitHubWithMirror(rocksdb
facebook/rocksdb v7.9.2
MD5=f9e250f3afdc82288925778cf5513acd

FetchContent_DeclareGitHubWithMirrorR(rocksdb
asu-idi/rocksdb_get_block_private.git
origin/cache_filter
)

FetchContent_GetProperties(jemalloc)
FetchContent_GetProperties(snappy)

message(STATUS "Project Source Directory: ${PROJECT_SOURCE_DIR}")
FetchContent_MakeAvailableWithArgs(rocksdb
CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/modules # to locate FindJeMalloc.cmake
# CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/modules # to locate FindJeMalloc.cmake
Snappy_DIR=${PROJECT_SOURCE_DIR}/cmake/modules # to locate SnappyConfig.cmake
FAIL_ON_WARNINGS=OFF
WITH_TESTS=OFF
Expand Down
14 changes: 14 additions & 0 deletions cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,17 @@ function(FetchContent_DeclareGitHubWithMirror dep repo tag hash)
${hash}
)
endfunction()

function(FetchContent_DeclareWithMirrorR dep url tag)
FetchContent_Declare(${dep}
GIT_REPOSITORY ${DEPS_FETCH_PROXY}${url}
GIT_TAG ${tag}
)
endfunction()

function(FetchContent_DeclareGitHubWithMirrorR dep repo tag)
FetchContent_DeclareWithMirrorR(${dep}
https://github.com/${repo}
${tag}
)
endfunction()

0 comments on commit eef8e37

Please sign in to comment.