]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
cmake: add option WITH_CORE_TOOLS to exclude tools except ldb and sst_dump (#6506)
authorsdong <siying.d@fb.com>
Wed, 18 Mar 2020 17:57:46 +0000 (10:57 -0700)
committersdong <siying.d@fb.com>
Wed, 18 Mar 2020 20:34:03 +0000 (13:34 -0700)
Summary:
ldb and sst_dump are most important tools and they don't dependend on gflags. In cmake, we don't have an way to only build these two tools and exclude other tools. This is inconvenient if the environment has a problem with gflags. Add such an option WITH_CORE_TOOLS.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6506

Test Plan: cmake and build with WITH_TOOLS and without.

Differential Revision: D20473029

fbshipit-source-id: 3d730fd14bbae6eeeae7f9cc9aec50a4e488ad72

CMakeLists.txt
tools/CMakeLists.txt

index 017fe86757faabbbae85f6fc94b2402b25fc678d..9db02a1e895d904f8477a3c5e00d4e88fad3e2d4 100644 (file)
@@ -1166,9 +1166,15 @@ if(WITH_BENCHMARK_TOOLS)
     ${ROCKSDB_LIB})
 endif()
 
+option(WITH_CORE_TOOLS "build with ldb and sst_dump" ON)
 option(WITH_TOOLS "build with tools" ON)
-if(WITH_TOOLS)
+if(WITH_CORE_TOOLS OR WITH_TOOLS)
   add_subdirectory(tools)
+  add_custom_target(core_tools
+    DEPENDS ${core_tool_deps})
+endif()
+
+if(WITH_TOOLS)
   add_subdirectory(db_stress_tool)
   add_custom_target(tools
     DEPENDS ${tool_deps})
index 50ee3b1b6edf1816df53daf963dce5b0f99b423a..4a4b0bcdac9fe26838a4b139726995be92254601 100644 (file)
@@ -1,21 +1,30 @@
-set(TOOLS
+set(CORE_TOOLS
   sst_dump.cc
-  db_sanity_test.cc
-  write_stress.cc
-  ldb.cc
-  db_repl_stress.cc
-  dump/rocksdb_dump.cc
-  dump/rocksdb_undump.cc)
-foreach(src ${TOOLS})
+  ldb.cc)
+foreach(src ${CORE_TOOLS})
   get_filename_component(exename ${src} NAME_WE)
   add_executable(${exename}${ARTIFACT_SUFFIX}
     ${src})
   target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB})
-  list(APPEND tool_deps ${exename})
+  list(APPEND core_tool_deps ${exename})
 endforeach()
 
-list(APPEND tool_deps)
+if(WITH_TOOLS)
+  set(TOOLS
+    db_sanity_test.cc
+    write_stress.cc
+    db_repl_stress.cc
+    dump/rocksdb_dump.cc
+    dump/rocksdb_undump.cc)
+  foreach(src ${TOOLS})
+    get_filename_component(exename ${src} NAME_WE)
+    add_executable(${exename}${ARTIFACT_SUFFIX}
+      ${src})
+    target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB})
+    list(APPEND tool_deps ${exename})
+  endforeach()
 
-add_custom_target(ldb_tests
-  COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ldb_tests.py
-  DEPENDS ldb)
+  add_custom_target(ldb_tests
+    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ldb_tests.py
+    DEPENDS ldb)
+endif()