Skip to content

Commit 4cf6bae

Browse files
committed
1. Add rocksdb dependencies, commented right now
2. Add leveldb to thirdparty which is used as default index storage
1 parent 320d1c7 commit 4cf6bae

File tree

161 files changed

+28940
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+28940
-1
lines changed

CMakeLists.txt

+15
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ message(STATUS "Commit-id = ${GIT_COMMIT_ID}")
2020

2121
set(TEST_DATA_PATH ${CMAKE_SOURCE_DIR}/test/data)
2222

23+
#include(cmake/jemalloc.cmake)
24+
#include(cmake/snappy.cmake)
25+
#include(cmake/lz4.cmake)
26+
#include(cmake/zlib.cmake)
27+
#include(cmake/zstd.cmake)
28+
#include(cmake/tbb.cmake)
29+
#include(cmake/rocksdb.cmake)
30+
31+
#list(APPEND EXTERNAL_LIBS jemalloc)
32+
#list(APPEND EXTERNAL_LIBS snappy)
33+
#list(APPEND EXTERNAL_LIBS rocksdb_with_headers)
34+
#list(APPEND EXTERNAL_LIBS lz4)
35+
#list(APPEND EXTERNAL_LIBS zstd)
36+
#list(APPEND EXTERNAL_LIBS zlib_with_headers)
37+
2338
set(CMAKE_CXX_STANDARD 23)
2439

2540
ADD_DEFINITIONS(-D INFINITY_DEBUG)

cmake/jemalloc.cmake

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(jemalloc
23+
jemalloc/jemalloc 5.3.0
24+
SHA1=1be8fdba021e9d6ed201e7d6a3c464b2223fc927
25+
)
26+
27+
FetchContent_GetProperties(jemalloc)
28+
if(NOT jemalloc_POPULATED)
29+
FetchContent_Populate(jemalloc)
30+
31+
execute_process(COMMAND autoconf
32+
WORKING_DIRECTORY ${jemalloc_SOURCE_DIR}
33+
)
34+
execute_process(COMMAND ${jemalloc_SOURCE_DIR}/configure CC=${CMAKE_C_COMPILER} -C --enable-autogen --disable-libdl --with-jemalloc-prefix=""
35+
WORKING_DIRECTORY ${jemalloc_BINARY_DIR}
36+
)
37+
add_custom_target(make_jemalloc
38+
COMMAND make
39+
WORKING_DIRECTORY ${jemalloc_BINARY_DIR}
40+
BYPRODUCTS ${jemalloc_BINARY_DIR}/lib/libjemalloc.a
41+
)
42+
endif()
43+
44+
find_package(Threads REQUIRED)
45+
46+
add_library(jemalloc INTERFACE)
47+
target_include_directories(jemalloc INTERFACE $<BUILD_INTERFACE:${jemalloc_BINARY_DIR}/include>)
48+
target_link_libraries(jemalloc INTERFACE $<BUILD_INTERFACE:${jemalloc_BINARY_DIR}/lib/libjemalloc.a> Threads::Threads)
49+
add_dependencies(jemalloc make_jemalloc)

cmake/lz4.cmake

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(lz4
23+
lz4/lz4 v1.9.4
24+
MD5=9c6b76f71921dd986468dcde7c095793
25+
)
26+
27+
FetchContent_GetProperties(lz4)
28+
if(NOT lz4_POPULATED)
29+
FetchContent_Populate(lz4)
30+
31+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
32+
set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}")
33+
endif()
34+
35+
add_custom_target(make_lz4 COMMAND make CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} liblz4.a
36+
WORKING_DIRECTORY ${lz4_SOURCE_DIR}/lib
37+
BYPRODUCTS ${lz4_SOURCE_DIR}/lib/liblz4.a
38+
)
39+
endif()
40+
41+
add_library(lz4 INTERFACE)
42+
target_include_directories(lz4 INTERFACE $<BUILD_INTERFACE:${lz4_SOURCE_DIR}/lib>)
43+
target_link_libraries(lz4 INTERFACE $<BUILD_INTERFACE:${lz4_SOURCE_DIR}/lib/liblz4.a>)
44+
add_dependencies(lz4 make_lz4)

cmake/rocksdb.cmake

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
set(COMPILE_WITH_JEMALLOC ON)
21+
22+
if (DISABLE_JEMALLOC)
23+
set(COMPILE_WITH_JEMALLOC OFF)
24+
endif()
25+
26+
include(cmake/utils.cmake)
27+
28+
FetchContent_DeclareGitHubWithMirror(rocksdb
29+
facebook/rocksdb v8.1.1
30+
MD5=b362246096dbd15839749da37d3ccda9
31+
)
32+
33+
FetchContent_GetProperties(jemalloc)
34+
FetchContent_GetProperties(snappy)
35+
FetchContent_GetProperties(tbb)
36+
37+
FetchContent_MakeAvailableWithArgs(rocksdb
38+
CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/modules # to locate FindJeMalloc.cmake
39+
Snappy_DIR=${PROJECT_SOURCE_DIR}/cmake/modules # to locate SnappyConfig.cmake
40+
FAIL_ON_WARNINGS=OFF
41+
WITH_TESTS=OFF
42+
WITH_BENCHMARK_TOOLS=OFF
43+
WITH_CORE_TOOLS=OFF
44+
WITH_TOOLS=OFF
45+
WITH_SNAPPY=ON
46+
WITH_LZ4=ON
47+
WITH_ZLIB=ON
48+
WITH_ZSTD=ON
49+
WITH_TOOLS=OFF
50+
WITH_GFLAGS=OFF
51+
WITH_TBB=OFF
52+
USE_RTTI=ON
53+
ROCKSDB_BUILD_SHARED=OFF
54+
WITH_JEMALLOC=${COMPILE_WITH_JEMALLOC}
55+
PORTABLE=${PORTABLE}
56+
)
57+
set(CMAKE_CXX_STANDARD 17)
58+
59+
add_library(rocksdb_with_headers INTERFACE)
60+
target_include_directories(rocksdb_with_headers INTERFACE ${rocksdb_SOURCE_DIR}/include)
61+
target_link_libraries(rocksdb_with_headers INTERFACE rocksdb)

cmake/snappy.cmake

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(snappy
23+
google/snappy f725f6766bfc62418c6491b504c8e5865ec99412
24+
MD5=17a982c9b0c667b3744e1fecba0046f7
25+
)
26+
27+
FetchContent_MakeAvailableWithArgs(snappy
28+
CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake/modules
29+
SNAPPY_BUILD_TESTS=OFF
30+
SNAPPY_BUILD_BENCHMARKS=OFF
31+
BUILD_SHARED_LIBS=OFF
32+
)

cmake/tbb.cmake

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(tbb
23+
oneapi-src/oneTBB v2021.9.0
24+
MD5=341fd0408cc0230e8d6121096b1d827a
25+
)
26+
27+
FetchContent_MakeAvailableWithArgs(tbb
28+
TBB_TEST=OFF
29+
TBB_EXAMPLES=OFF
30+
TBBMALLOC_BUILD=OFF
31+
BUILD_SHARED_LIBS=OFF
32+
)
33+
34+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
35+
target_compile_options(tbb PRIVATE "-Wno-error=stringop-overflow")
36+
endif()

cmake/utils.cmake

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(FetchContent)
21+
22+
macro(parse_var arg key value)
23+
string(REGEX REPLACE "^(.+)=(.+)$" "\\1;\\2" REGEX_RESULT ${arg})
24+
list(GET REGEX_RESULT 0 ${key})
25+
list(GET REGEX_RESULT 1 ${value})
26+
endmacro()
27+
28+
function(FetchContent_MakeAvailableWithArgs dep)
29+
if(NOT ${dep}_POPULATED)
30+
FetchContent_Populate(${dep})
31+
32+
foreach(arg IN LISTS ARGN)
33+
parse_var(${arg} key value)
34+
set(${key}_OLD ${${key}})
35+
set(${key} ${value} CACHE INTERNAL "")
36+
endforeach()
37+
38+
add_subdirectory(${${dep}_SOURCE_DIR} ${${dep}_BINARY_DIR} EXCLUDE_FROM_ALL)
39+
40+
foreach(arg IN LISTS ARGN)
41+
parse_var(${arg} key value)
42+
set(${key} ${${key}_OLD} CACHE INTERNAL "")
43+
endforeach()
44+
endif()
45+
endfunction()
46+
47+
function(FetchContent_DeclareWithMirror dep url hash)
48+
FetchContent_Declare(${dep}
49+
URL ${DEPS_FETCH_PROXY}${url}
50+
URL_HASH ${hash}
51+
)
52+
endfunction()
53+
54+
function(FetchContent_DeclareGitHubWithMirror dep repo tag hash)
55+
FetchContent_DeclareWithMirror(${dep}
56+
https://github.com/${repo}/archive/${tag}.zip
57+
${hash}
58+
)
59+
endfunction()

cmake/zlib.cmake

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(zlib
23+
madler/zlib v1.2.13
24+
MD5=fdedf0c8972a04a7c153dd73492d2d91
25+
)
26+
27+
FetchContent_MakeAvailableWithArgs(zlib)

cmake/zstd.cmake

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
include_guard()
19+
20+
include(cmake/utils.cmake)
21+
22+
FetchContent_DeclareGitHubWithMirror(zstd
23+
facebook/zstd v1.5.5
24+
MD5=f336cde1961ee7e5d3a7f8c0c0f96987
25+
)
26+
27+
FetchContent_GetProperties(zstd)
28+
if(NOT zstd_POPULATED)
29+
FetchContent_Populate(zstd)
30+
31+
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
32+
set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}")
33+
endif()
34+
35+
add_custom_target(make_zstd COMMAND make CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} libzstd.a
36+
WORKING_DIRECTORY ${zstd_SOURCE_DIR}/lib
37+
BYPRODUCTS ${zstd_SOURCE_DIR}/lib/libzstd.a
38+
)
39+
endif()
40+
41+
add_library(zstd INTERFACE)
42+
target_include_directories(zstd INTERFACE $<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib>)
43+
target_link_libraries(zstd INTERFACE $<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib/libzstd.a>)
44+
add_dependencies(zstd make_zstd)

0 commit comments

Comments
 (0)