Skip to content

Commit 3482d4d

Browse files
committed
cmake: add option WITH_CORE_TOOLS to exclude tools except ldb and sst_dump (facebook#6506)
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: facebook#6506 Test Plan: cmake and build with WITH_TOOLS and without. Differential Revision: D20473029 fbshipit-source-id: 3d730fd14bbae6eeeae7f9cc9aec50a4e488ad72
1 parent d75da26 commit 3482d4d

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,9 +1169,15 @@ if(WITH_BENCHMARK_TOOLS)
11691169
${ROCKSDB_LIB})
11701170
endif()
11711171

1172+
option(WITH_CORE_TOOLS "build with ldb and sst_dump" ON)
11721173
option(WITH_TOOLS "build with tools" ON)
1173-
if(WITH_TOOLS)
1174+
if(WITH_CORE_TOOLS OR WITH_TOOLS)
11741175
add_subdirectory(tools)
1176+
add_custom_target(core_tools
1177+
DEPENDS ${core_tool_deps})
1178+
endif()
1179+
1180+
if(WITH_TOOLS)
11751181
add_subdirectory(db_stress_tool)
11761182
add_custom_target(tools
11771183
DEPENDS ${tool_deps})

tools/CMakeLists.txt

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
set(TOOLS
1+
set(CORE_TOOLS
22
sst_dump.cc
3-
db_sanity_test.cc
4-
write_stress.cc
5-
ldb.cc
6-
db_repl_stress.cc
7-
dump/rocksdb_dump.cc
8-
dump/rocksdb_undump.cc)
9-
foreach(src ${TOOLS})
3+
ldb.cc)
4+
foreach(src ${CORE_TOOLS})
105
get_filename_component(exename ${src} NAME_WE)
116
add_executable(${exename}${ARTIFACT_SUFFIX}
127
${src})
138
target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB})
14-
list(APPEND tool_deps ${exename})
9+
list(APPEND core_tool_deps ${exename})
1510
endforeach()
1611

17-
list(APPEND tool_deps)
12+
if(WITH_TOOLS)
13+
set(TOOLS
14+
db_sanity_test.cc
15+
write_stress.cc
16+
db_repl_stress.cc
17+
dump/rocksdb_dump.cc
18+
dump/rocksdb_undump.cc)
19+
foreach(src ${TOOLS})
20+
get_filename_component(exename ${src} NAME_WE)
21+
add_executable(${exename}${ARTIFACT_SUFFIX}
22+
${src})
23+
target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${ROCKSDB_LIB})
24+
list(APPEND tool_deps ${exename})
25+
endforeach()
1826

19-
add_custom_target(ldb_tests
20-
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ldb_tests.py
21-
DEPENDS ldb)
27+
add_custom_target(ldb_tests
28+
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ldb_tests.py
29+
DEPENDS ldb)
30+
endif()

0 commit comments

Comments
 (0)