Index: tools/gn/command_gen.cc |
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc |
index fee3f1a31f836c7843eac42afdeb918722c43413..74a5d90cfd3495b0530a6e679796b53b62b431a1 100644 |
--- a/tools/gn/command_gen.cc |
+++ b/tools/gn/command_gen.cc |
@@ -20,6 +20,7 @@ |
#include "tools/gn/switches.h" |
#include "tools/gn/target.h" |
#include "tools/gn/visual_studio_writer.h" |
+#include "tools/gn/xcode_writer.h" |
namespace commands { |
@@ -32,7 +33,11 @@ const char kSwitchIdeValueEclipse[] = "eclipse"; |
const char kSwitchIdeValueVs[] = "vs"; |
const char kSwitchIdeValueVs2013[] = "vs2013"; |
const char kSwitchIdeValueVs2015[] = "vs2015"; |
+const char kSwitchIdeValueXcode[] = "xcode"; |
+const char kSwitchNinjaExtraArgs[] = "ninja-extra-args"; |
+const char kSwitchRootTarget[] = "root-target"; |
const char kSwitchSln[] = "sln"; |
+const char kSwitchWorkspace[] = "workspace"; |
// Called on worker thread to write the ninja file. |
void BackgroundDoWrite(const Target* target) { |
@@ -188,6 +193,19 @@ bool RunIdeWriter(const std::string& ide, |
"ms\n"); |
} |
return res; |
+ } else if (ide == kSwitchIdeValueXcode) { |
+ bool res = XcodeWriter::RunAndWriteFiles( |
+ command_line->GetSwitchValueASCII(kSwitchWorkspace), |
+ command_line->GetSwitchValueASCII(kSwitchRootTarget), |
+ command_line->GetSwitchValueASCII(kSwitchNinjaExtraArgs), |
+ command_line->GetSwitchValueASCII(kSwitchFilters), build_settings, |
+ builder, err); |
+ if (res && !command_line->HasSwitch(switches::kQuiet)) { |
+ OutputString("Generating Xcode projects took " + |
+ base::Int64ToString(timer.Elapsed().InMilliseconds()) + |
+ "ms\n"); |
+ } |
+ return res; |
} |
*err = Err(Location(), "Unknown IDE: " + ide); |
@@ -225,16 +243,35 @@ const char kGen_Help[] = |
" (default Visual Studio version: 2015)\n" |
" \"vs2013\" - Visual Studio 2013 project/solution files.\n" |
" \"vs2015\" - Visual Studio 2015 project/solution files.\n" |
- "\n" |
- " --sln=<file_name>\n" |
- " Override default sln file name (\"all\"). Solution file is written\n" |
- " to the root build directory. Only for Visual Studio.\n" |
+ " \"xcode\" - Xcode workspace/solution files.\n" |
"\n" |
" --filters=<path_prefixes>\n" |
" Semicolon-separated list of label patterns used to limit the set\n" |
" of generated projects (see \"gn help label_pattern\"). Only\n" |
- " matching targets will be included to the solution. Only for Visual\n" |
- " Studio.\n" |
+ " matching targets will be included to the solution. Only used for\n" |
+ " Visual Studio and Xcode.\n" |
+ "\n" |
+ "Visual Studio Flags\n" |
+ "\n" |
+ " --sln=<file_name>\n" |
+ " Override default sln file name (\"all\"). Solution file is written\n" |
+ " to the root build directory.\n" |
+ "\n" |
+ "Xcode Flags\n" |
+ "\n" |
+ " --workspace=<file_name>\n" |
+ " Override defaut workspace file name (\"all\"). The workspace file\n" |
+ " is written to the root build directory.\n" |
+ "\n" |
+ " --ninja-extra-args=<string>\n" |
+ " This string is passed without any quoting to the ninja invocation\n" |
+ " command-line. Can be used to configure ninja flags, like \"-j\" if\n" |
+ " using goma for example.\n" |
+ "\n" |
+ " --root-target=<target_name>\n" |
+ " Name of the target corresponding to \"All\" target in Xcode. If\n" |
+ " unset, \"All\" invokes ninja without any target thus build all the\n" |
+ " targets.\n" |
"\n" |
"Eclipse IDE Support\n" |
"\n" |