From d699d703433357633eed5c178f7f01ae924c759e Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 24 Nov 2014 15:53:23 -0500 Subject: [PATCH] Make RocksDB compile without gflags Summary: We want to make sure people without gflags can compile RocksDB. Test Plan: remove gflags, make all Reviewers: sdong, rven, yhchiang, ljin Reviewed By: ljin Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29469 --- util/benchharness.cc | 27 +++++++++++++-------------- util/options_test.cc | 8 +++++++- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/util/benchharness.cc b/util/benchharness.cc index 1c282aee4..4218f3c30 100644 --- a/util/benchharness.cc +++ b/util/benchharness.cc @@ -17,25 +17,13 @@ #include #include -#include - -using std::function; -using std::get; -using std::make_pair; -using std::max; -using std::min; -using std::pair; -using std::sort; -using std::string; -using std::tuple; -using std::vector; - #ifndef GFLAGS bool FLAGS_benchmark = false; uint64_t FLAGS_bm_min_usec = 100; -int64_t FLAGS_bm_min_iter = 1; +int64_t FLAGS_bm_min_iters = 1; int32_t FLAGS_bm_max_secs = 1; #else +#include DEFINE_bool(benchmark, false, "Run benchmarks."); DEFINE_uint64(bm_min_usec, 100, @@ -48,6 +36,17 @@ DEFINE_int32(bm_max_secs, 1, "Maximum # of seconds we'll spend on each benchmark."); #endif // GFLAGS +using std::function; +using std::get; +using std::make_pair; +using std::max; +using std::min; +using std::pair; +using std::sort; +using std::string; +using std::tuple; +using std::vector; + namespace rocksdb { namespace benchmark { diff --git a/util/options_test.cc b/util/options_test.cc index 1a6702143..4d6746ec2 100644 --- a/util/options_test.cc +++ b/util/options_test.cc @@ -13,7 +13,6 @@ #include #include -#include #include "rocksdb/options.h" #include "rocksdb/table.h" @@ -23,8 +22,13 @@ #include "rocksdb/utilities/leveldb_options.h" #include "rocksdb/utilities/convenience.h" +#ifndef GFLAGS +bool FLAGS_enable_print = false; +#else +#include using GFLAGS::ParseCommandLineFlags; DEFINE_bool(enable_print, false, "Print options generated to console."); +#endif // GFLAGS namespace rocksdb { @@ -357,6 +361,8 @@ TEST(OptionsTest, ConvertOptionsTest) { } // namespace rocksdb int main(int argc, char** argv) { +#ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); +#endif // GFLAGS return rocksdb::test::RunAllTests(); }