diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cb80cd10..2a4bdb6b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -366,7 +366,7 @@ endif() option(ROCKSDB_LITE "Build RocksDBLite version" OFF) if(ROCKSDB_LITE) add_definitions(-DROCKSDB_LITE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -Os") endif() if(CMAKE_SYSTEM_NAME MATCHES "Cygwin") diff --git a/Makefile b/Makefile index 176ad1217..2b3274f7a 100644 --- a/Makefile +++ b/Makefile @@ -93,9 +93,24 @@ ifeq ($(MAKECMDGOALS),rocksdbjavastaticpublish) DEBUG_LEVEL=0 endif +# Lite build flag. +LITE ?= 0 +ifneq ($(LITE), 0) + OPT += -DROCKSDB_LITE +endif + +# Figure out optimize level. +ifneq ($(DEBUG_LEVEL), 2) +ifeq ($(LITE), 0) + OPT += -O2 +else + OPT += -Os +endif +endif + # compile with -O2 if debug level is not 2 ifneq ($(DEBUG_LEVEL), 2) -OPT += -O2 -fno-omit-frame-pointer +OPT += -fno-omit-frame-pointer # Skip for archs that don't support -momit-leaf-frame-pointer ifeq (,$(shell $(CXX) -fsyntax-only -momit-leaf-frame-pointer -xc /dev/null 2>&1)) OPT += -momit-leaf-frame-pointer diff --git a/build_tools/rocksdb-lego-determinator b/build_tools/rocksdb-lego-determinator index 1365f7fe9..90ff38556 100755 --- a/build_tools/rocksdb-lego-determinator +++ b/build_tools/rocksdb-lego-determinator @@ -85,7 +85,6 @@ NON_SHM="TMPD=/tmp/rocksdb_test_tmp" GCC_481="ROCKSDB_FBCODE_BUILD_WITH_481=1" ASAN="COMPILE_WITH_ASAN=1" CLANG="USE_CLANG=1" -LITE="OPT=\"-DROCKSDB_LITE -g\"" TSAN="COMPILE_WITH_TSAN=1" UBSAN="COMPILE_WITH_UBSAN=1" TSAN_CRASH='CRASH_TEST_EXT_ARGS="--compression_type=zstd --log2_keys_per_lock=22"' @@ -345,7 +344,7 @@ LITE_BUILD_COMMANDS="[ $CLEANUP_ENV, { 'name':'Build RocksDB debug version', - 'shell':'$LITE make J=1 all check || $CONTRUN_NAME=lite $TASK_CREATION_TOOL', + 'shell':'make J=1 LITE=1 all check || $CONTRUN_NAME=lite $TASK_CREATION_TOOL', 'user':'root', $PARSER }, @@ -663,12 +662,12 @@ run_regression() # === lite build === make clean - OPT=-DROCKSDB_LITE make -j$(nproc) static_lib + make LITE=1 -j$(nproc) static_lib send_size_to_ods static_lib_lite $(stat --printf="%s" librocksdb.a) strip librocksdb.a send_size_to_ods static_lib_lite_stripped $(stat --printf="%s" librocksdb.a) - OPT=-DROCKSDB_LITE make -j$(nproc) shared_lib + make LITE=1 -j$(nproc) shared_lib send_size_to_ods shared_lib_lite $(stat --printf="%s" `readlink -f librocksdb.so`) strip `readlink -f librocksdb.so` send_size_to_ods shared_lib_lite_stripped $(stat --printf="%s" `readlink -f librocksdb.so`)