Skip to content

Commit d67c658

Browse files
guillemjJohnSully
authored andcommitted
build: Add support for linking against a system librocksdb
Add a new USE_SYSTEM_ROCKSDB make variable to select whether to link against the system librocksdb.
1 parent ae130d1 commit d67c658

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

deps/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ distclean:
4040
ifneq ($(USE_SYSTEM_JEMALLOC),yes)
4141
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
4242
endif
43+
ifneq ($(USE_SYSTEM_ROCKSDB),yes)
4344
-(cd rocksdb && $(MAKE) clean) > /dev/null || true
45+
endif
4446
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
4547
-(rm -f .make-*)
4648

src/Makefile

+9-2
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,19 @@ ifneq ($(strip $(SANITIZE)),)
7373
endif
7474

7575
ifeq ($(ENABLE_FLASH),yes)
76+
STORAGE_OBJ+= storage/rocksdb.o storage/rocksdbfactory.o
77+
ifeq ($(USE_SYSTEM_ROCKSDB),yes)
78+
FINAL_LIBS+= $(shell pkg-config --libs rocksdb)
79+
FINAL_CXXFLAGS+= $(shell pkg-config --cflags rocksdb) -DENABLE_ROCKSDB
80+
81+
else
7682
FINAL_LIBS+= -lz -lcrypto -lbz2 -lzstd -llz4 -lsnappy
7783
CXXFLAGS+= -I../deps/rocksdb/include/ -DENABLE_ROCKSDB
78-
STORAGE_OBJ+= storage/rocksdb.o storage/rocksdbfactory.o
84+
FINAL_CXXFLAGS+= -I../deps/rocksdb/include/
7985
FINAL_LIBS+= ../deps/rocksdb/librocksdb.a
8086
DEPENDENCY_TARGETS+= rocksdb
8187
endif
88+
endif
8289

8390

8491
ifeq ($(CHECKED),true)
@@ -268,7 +275,7 @@ endif
268275

269276
# Include paths to dependencies
270277
FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram
271-
FINAL_CXXFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/rocksdb/include/
278+
FINAL_CXXFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram
272279

273280
ifeq ($(USE_SYSTEM_CONCURRENTQUEUE),yes)
274281
FINAL_CXXFLAGS+= -I/usr/include/concurrentqueue/moodycamel

0 commit comments

Comments
 (0)