Skip to content

Commit a429733

Browse files
committed
rocksdb: switch to FetchContent
1 parent 06aa3e3 commit a429733

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "extern/folly"]
55
path = extern/folly
66
url = https://github.com/JakeHillion/folly.git
7-
[submodule "extern/rocksdb"]
8-
path = extern/rocksdb
9-
url = https://github.com/facebook/rocksdb.git

CMakeLists.txt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ FetchContent_Declare(
9595
)
9696
FetchContent_MakeAvailable(glog)
9797

98+
### rocksdb
99+
FetchContent_Declare(
100+
rocksdb
101+
GIT_REPOSITORY https://github.com/facebook/rocksdb.git
102+
GIT_TAG 444b3f4845dd01b0d127c4b420fdd3b50ad56682
103+
)
104+
FetchContent_Populate(rocksdb)
105+
add_custom_target(librocksdb ALL
106+
WORKING_DIRECTORY ${rocksdb_SOURCE_DIR}
107+
COMMAND cmake -G Ninja -B ${rocksdb_BINARY_DIR} -DCMAKE_BUILD_TYPE=Release -DWITH_GFLAGS=Off -DWITH_LIBURING=Off -DWITH_ZSTD=On
108+
COMMAND cmake --build ${rocksdb_BINARY_DIR} --target rocksdb
109+
BYPRODUCTS ${rocksdb_BINARY_DIR}/librocksdb.a
110+
COMMENT "Building RocksDB"
111+
USES_TERMINAL
112+
)
113+
include_directories(SYSTEM "${rocksdb_SOURCE_DIR}/include")
114+
98115
### bison & flex (for oid_parser)
99116
find_package(BISON 3.5 REQUIRED)
100117
find_package(FLEX)
@@ -137,18 +154,6 @@ include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/extern/folly)
137154
### zstd (for rocksdb)
138155
find_package(zstd REQUIRED)
139156

140-
### rocksdb
141-
add_custom_target(librocksdb ALL
142-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extern/rocksdb
143-
COMMAND cmake -G Ninja -B build/ -DCMAKE_BUILD_TYPE=Release -DWITH_GFLAGS=Off -DWITH_LIBURING=Off -DWITH_ZSTD=On
144-
COMMAND cmake --build build/ --target rocksdb
145-
BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/extern/rocksdb/build/librocksdb.a
146-
COMMENT "Building RocksDB"
147-
USES_TERMINAL
148-
)
149-
set(ROCKSDB_PATH "${PROJECT_SOURCE_DIR}/extern/rocksdb")
150-
include_directories(SYSTEM "${ROCKSDB_PATH}/include")
151-
152157
### drgn
153158
# The setup.py script in drgn is really meant to build drgn (python
154159
# debugger). It shoves the C headers/lib in a temporary directory (which
@@ -278,7 +283,7 @@ target_link_libraries(oicore
278283
add_library(treebuilder src/TreeBuilder.cpp)
279284
add_dependencies(treebuilder librocksdb)
280285
target_link_libraries(treebuilder
281-
${ROCKSDB_PATH}/build/librocksdb.a
286+
${rocksdb_BINARY_DIR}/librocksdb.a
282287
oicore # overkill but it does need a lot of stuff
283288
zstd::zstd
284289
)

extern/rocksdb

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)