Home | History | Annotate | Download | only in gflags
      1 // Copyright 2012 Google Inc. All Rights Reserved.
      2 // Author: sameeragarwal (at) google.com (Sameer Agarwal)
      3 //
      4 // This shim file serves two purposes.
      5 //
      6 // 1. Translate the gflags includes used by the OSS version of Ceres
      7 // so that it links into the google3 version.
      8 //
      9 // 2. Call InitGoogle when ParseCommandLineFlags is called. This is
     10 // needed because while google3 binaries call InitGoogle and that call
     11 // initializes the logging and command line handling amongst other
     12 // things, the open source versions of gflags and glog are distributed
     13 // separately and require separate initialization. By hijacking this
     14 // function, and calling InitGoogle, we can compile all the example
     15 // code that ships with Ceres without any modifications. This
     16 // modification will have no impact on google3 binaries using Ceres,
     17 // as they will never call google::ParseCommandLineFlags.
     18 
     19 #ifndef GFLAGS_GFLAGS_H_
     20 #define GFLAGS_GFLAGS_H_
     21 
     22 #include "base/init_google.h"
     23 #include "base/commandlineflags.h"
     24 
     25 namespace google {
     26 
     27 inline void ParseCommandLineFlags(int* argc,
     28                                   char*** argv,
     29                                   const bool remove_flags) {
     30   InitGoogle(**argv, argc, argv, remove_flags);
     31 }
     32 
     33 }  // namespace google
     34 
     35 #endif  // GFLAGS_GFLAGS_H_
     36