1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TOOLS_GN_SWITCHES_H_ 6 #define TOOLS_GN_SWITCHES_H_ 7 8 #include <map> 9 #include <string_view> 10 11 namespace switches { 12 13 struct SwitchInfo { 14 SwitchInfo(); 15 SwitchInfo(const char* short_help, const char* long_help); 16 17 const char* short_help; 18 const char* long_help; 19 }; 20 21 using SwitchInfoMap = std::map<std::string_view, SwitchInfo>; 22 23 // Returns the mapping of all global switches. 24 const SwitchInfoMap& GetSwitches(); 25 26 // This file contains global switches. If a command takes specific ones only 27 // to that command, just put them in that command's .cc file. 28 29 extern const char kArgs[]; 30 extern const char kArgs_HelpShort[]; 31 extern const char kArgs_Help[]; 32 33 extern const char kColor[]; 34 extern const char kColor_HelpShort[]; 35 extern const char kColor_Help[]; 36 37 extern const char kDotfile[]; 38 extern const char kDotfile_HelpShort[]; 39 extern const char kDotfile_Help[]; 40 41 extern const char kFailOnUnusedArgs[]; 42 extern const char kFailOnUnusedArgs_HelpShort[]; 43 extern const char kFailOnUnusedArgs_Help[]; 44 45 extern const char kMarkdown[]; 46 extern const char kMarkdown_HelpShort[]; 47 extern const char kMarkdown_Help[]; 48 49 extern const char kNinjaExecutable[]; 50 extern const char kNinjaExecutable_HelpShort[]; 51 extern const char kNinjaExecutable_Help[]; 52 53 extern const char kNoColor[]; 54 extern const char kNoColor_HelpShort[]; 55 extern const char kNoColor_Help[]; 56 57 extern const char kScriptExecutable[]; 58 extern const char kScriptExecutable_HelpShort[]; 59 extern const char kScriptExecutable_Help[]; 60 61 extern const char kQuiet[]; 62 extern const char kQuiet_HelpShort[]; 63 extern const char kQuiet_Help[]; 64 65 extern const char kRoot[]; 66 extern const char kRoot_HelpShort[]; 67 extern const char kRoot_Help[]; 68 69 extern const char kRootTarget[]; 70 extern const char kRootTarget_HelpShort[]; 71 extern const char kRootTarget_Help[]; 72 73 extern const char kRuntimeDepsListFile[]; 74 extern const char kRuntimeDepsListFile_HelpShort[]; 75 extern const char kRuntimeDepsListFile_Help[]; 76 77 extern const char kThreads[]; 78 extern const char kThreads_HelpShort[]; 79 extern const char kThreads_Help[]; 80 81 extern const char kTime[]; 82 extern const char kTime_HelpShort[]; 83 extern const char kTime_Help[]; 84 85 extern const char kTracelog[]; 86 extern const char kTracelog_HelpShort[]; 87 extern const char kTracelog_Help[]; 88 89 extern const char kVerbose[]; 90 extern const char kVerbose_HelpShort[]; 91 extern const char kVerbose_Help[]; 92 93 extern const char kVersion[]; 94 extern const char kVersion_HelpShort[]; 95 extern const char kVersion_Help[]; 96 97 // This switch is used by several commands. It is here so it can be shared, 98 // but it's documented in the individual commands it applies to rather than 99 // globally. 100 extern const char kDefaultToolchain[]; 101 #define DEFAULT_TOOLCHAIN_SWITCH_HELP \ 102 " --default-toolchain\n" \ 103 " Normally wildcard targets are matched in all toolchains. This\n" \ 104 " switch makes wildcard labels with no explicit toolchain reference\n" \ 105 " only match targets in the default toolchain.\n" \ 106 "\n" \ 107 " Non-wildcard inputs with no explicit toolchain specification will\n" \ 108 " always match only a target in the default toolchain if one exists.\n" 109 110 // This switch is used to signal to the gen command that it is being invoked on 111 // a regeneration step. Ie, ninja has realized that build.ninja needs to be 112 // generated again and has invoked gn gen. There is no help associated with it 113 // because users should not be setting this switch. It is located in this file 114 // so it can be shared between command_gen and ninja_build_writer. 115 extern const char kRegeneration[]; 116 117 } // namespace switches 118 119 #endif // TOOLS_GN_SWITCHES_H_ 120