1#include <c10/util/Flags.h>
2
3#include <string>
4
5#include <c10/macros/Macros.h>
6
7#ifdef C10_USE_GFLAGS
8
9namespace c10 {
10
11using std::string;
12
13C10_EXPORT void SetUsageMessage(const string& str) {
14 if (UsageMessage() != nullptr) {
15 // Usage message has already been set, so we will simply return.
16 return;
17 }
18 gflags::SetUsageMessage(str);
19}
20
21C10_EXPORT const char* UsageMessage() {
22 return gflags::ProgramUsage();
23}
24
25C10_EXPORT bool ParseCommandLineFlags(int* pargc, char*** pargv) {
26 // In case there is no commandline flags to parse, simply return.
27 if (*pargc == 0)
28 return true;
29 return gflags::ParseCommandLineFlags(pargc, pargv, true);
30}
31
32C10_EXPORT bool CommandLineFlagsHasBeenParsed() {
33 // There is no way we query gflags right now, so we will simply return true.
34 return true;
35}
36
37} // namespace c10
38#endif // C10_USE_GFLAGS
39