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
main
Igor Canadi 10 years ago
parent 3257221499
commit d699d70343
  1. 27
      util/benchharness.cc
  2. 8
      util/options_test.cc

@ -17,25 +17,13 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <gflags/gflags.h>
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 #ifndef GFLAGS
bool FLAGS_benchmark = false; bool FLAGS_benchmark = false;
uint64_t FLAGS_bm_min_usec = 100; 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; int32_t FLAGS_bm_max_secs = 1;
#else #else
#include <gflags/gflags.h>
DEFINE_bool(benchmark, false, "Run benchmarks."); DEFINE_bool(benchmark, false, "Run benchmarks.");
DEFINE_uint64(bm_min_usec, 100, 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."); "Maximum # of seconds we'll spend on each benchmark.");
#endif // GFLAGS #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 rocksdb {
namespace benchmark { namespace benchmark {

@ -13,7 +13,6 @@
#include <unordered_map> #include <unordered_map>
#include <inttypes.h> #include <inttypes.h>
#include <gflags/gflags.h>
#include "rocksdb/options.h" #include "rocksdb/options.h"
#include "rocksdb/table.h" #include "rocksdb/table.h"
@ -23,8 +22,13 @@
#include "rocksdb/utilities/leveldb_options.h" #include "rocksdb/utilities/leveldb_options.h"
#include "rocksdb/utilities/convenience.h" #include "rocksdb/utilities/convenience.h"
#ifndef GFLAGS
bool FLAGS_enable_print = false;
#else
#include <gflags/gflags.h>
using GFLAGS::ParseCommandLineFlags; using GFLAGS::ParseCommandLineFlags;
DEFINE_bool(enable_print, false, "Print options generated to console."); DEFINE_bool(enable_print, false, "Print options generated to console.");
#endif // GFLAGS
namespace rocksdb { namespace rocksdb {
@ -357,6 +361,8 @@ TEST(OptionsTest, ConvertOptionsTest) {
} // namespace rocksdb } // namespace rocksdb
int main(int argc, char** argv) { int main(int argc, char** argv) {
#ifdef GFLAGS
ParseCommandLineFlags(&argc, &argv, true); ParseCommandLineFlags(&argc, &argv, true);
#endif // GFLAGS
return rocksdb::test::RunAllTests(); return rocksdb::test::RunAllTests();
} }

Loading…
Cancel
Save