OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/atomicops.h" | 5 #include "base/atomicops.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
11 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
12 #include "tools/gn/commands.h" | 12 #include "tools/gn/commands.h" |
13 #include "tools/gn/eclipse_writer.h" | 13 #include "tools/gn/eclipse_writer.h" |
14 #include "tools/gn/ninja_target_writer.h" | 14 #include "tools/gn/ninja_target_writer.h" |
15 #include "tools/gn/ninja_writer.h" | 15 #include "tools/gn/ninja_writer.h" |
16 #include "tools/gn/qt_creator_writer.h" | |
16 #include "tools/gn/runtime_deps.h" | 17 #include "tools/gn/runtime_deps.h" |
17 #include "tools/gn/scheduler.h" | 18 #include "tools/gn/scheduler.h" |
18 #include "tools/gn/setup.h" | 19 #include "tools/gn/setup.h" |
19 #include "tools/gn/standard_out.h" | 20 #include "tools/gn/standard_out.h" |
20 #include "tools/gn/switches.h" | 21 #include "tools/gn/switches.h" |
21 #include "tools/gn/target.h" | 22 #include "tools/gn/target.h" |
22 #include "tools/gn/visual_studio_writer.h" | 23 #include "tools/gn/visual_studio_writer.h" |
23 #include "tools/gn/xcode_writer.h" | 24 #include "tools/gn/xcode_writer.h" |
24 | 25 |
25 namespace commands { | 26 namespace commands { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 const char kSwitchCheck[] = "check"; | 30 const char kSwitchCheck[] = "check"; |
30 const char kSwitchFilters[] = "filters"; | 31 const char kSwitchFilters[] = "filters"; |
31 const char kSwitchIde[] = "ide"; | 32 const char kSwitchIde[] = "ide"; |
32 const char kSwitchIdeValueEclipse[] = "eclipse"; | 33 const char kSwitchIdeValueEclipse[] = "eclipse"; |
34 const char kSwitchIdeValueQtCreator[] = "qtcreator"; | |
33 const char kSwitchIdeValueVs[] = "vs"; | 35 const char kSwitchIdeValueVs[] = "vs"; |
34 const char kSwitchIdeValueVs2013[] = "vs2013"; | 36 const char kSwitchIdeValueVs2013[] = "vs2013"; |
35 const char kSwitchIdeValueVs2015[] = "vs2015"; | 37 const char kSwitchIdeValueVs2015[] = "vs2015"; |
36 const char kSwitchIdeValueXcode[] = "xcode"; | 38 const char kSwitchIdeValueXcode[] = "xcode"; |
37 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args"; | 39 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args"; |
38 const char kSwitchRootTarget[] = "root-target"; | 40 const char kSwitchRootTarget[] = "root-target"; |
39 const char kSwitchSln[] = "sln"; | 41 const char kSwitchSln[] = "sln"; |
40 const char kSwitchWorkspace[] = "workspace"; | 42 const char kSwitchWorkspace[] = "workspace"; |
41 | 43 |
42 // Called on worker thread to write the ninja file. | 44 // Called on worker thread to write the ninja file. |
(...skipping 156 matching lines...) Loading... | |
199 command_line->GetSwitchValueASCII(kSwitchRootTarget), | 201 command_line->GetSwitchValueASCII(kSwitchRootTarget), |
200 command_line->GetSwitchValueASCII(kSwitchNinjaExtraArgs), | 202 command_line->GetSwitchValueASCII(kSwitchNinjaExtraArgs), |
201 command_line->GetSwitchValueASCII(kSwitchFilters), build_settings, | 203 command_line->GetSwitchValueASCII(kSwitchFilters), build_settings, |
202 builder, err); | 204 builder, err); |
203 if (res && !command_line->HasSwitch(switches::kQuiet)) { | 205 if (res && !command_line->HasSwitch(switches::kQuiet)) { |
204 OutputString("Generating Xcode projects took " + | 206 OutputString("Generating Xcode projects took " + |
205 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | 207 base::Int64ToString(timer.Elapsed().InMilliseconds()) + |
206 "ms\n"); | 208 "ms\n"); |
207 } | 209 } |
208 return res; | 210 return res; |
211 } else if (ide == kSwitchIdeValueQtCreator) { | |
212 std::string root_target; | |
213 if (command_line->HasSwitch(kSwitchRootTarget)) | |
214 root_target = command_line->GetSwitchValueASCII(kSwitchRootTarget); | |
215 bool res = QtCreatorWriter::RunAndWriteFile(build_settings, builder, err, | |
216 root_target); | |
217 if (res && !command_line->HasSwitch(switches::kQuiet)) { | |
218 OutputString("Generating QtCreator projects took " + | |
219 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | |
220 "ms\n"); | |
221 } | |
222 return res; | |
209 } | 223 } |
210 | 224 |
211 *err = Err(Location(), "Unknown IDE: " + ide); | 225 *err = Err(Location(), "Unknown IDE: " + ide); |
212 return false; | 226 return false; |
213 } | 227 } |
214 | 228 |
215 } // namespace | 229 } // namespace |
216 | 230 |
217 const char kGen[] = "gen"; | 231 const char kGen[] = "gen"; |
218 const char kGen_HelpShort[] = | 232 const char kGen_HelpShort[] = |
(...skipping 18 matching lines...) Loading... | |
237 " GN optionally generates files for IDE. Possibilities for <ide options>\n" | 251 " GN optionally generates files for IDE. Possibilities for <ide options>\n" |
238 "\n" | 252 "\n" |
239 " --ide=<ide_name>\n" | 253 " --ide=<ide_name>\n" |
240 " Generate files for an IDE. Currently supported values:\n" | 254 " Generate files for an IDE. Currently supported values:\n" |
241 " \"eclipse\" - Eclipse CDT settings file.\n" | 255 " \"eclipse\" - Eclipse CDT settings file.\n" |
242 " \"vs\" - Visual Studio project/solution files.\n" | 256 " \"vs\" - Visual Studio project/solution files.\n" |
243 " (default Visual Studio version: 2015)\n" | 257 " (default Visual Studio version: 2015)\n" |
244 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" | 258 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" |
245 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" | 259 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" |
246 " \"xcode\" - Xcode workspace/solution files.\n" | 260 " \"xcode\" - Xcode workspace/solution files.\n" |
261 " \"qtcreator\" - QtCreator project files.\n" | |
247 "\n" | 262 "\n" |
248 " --filters=<path_prefixes>\n" | 263 " --filters=<path_prefixes>\n" |
249 " Semicolon-separated list of label patterns used to limit the set\n" | 264 " Semicolon-separated list of label patterns used to limit the set\n" |
250 " of generated projects (see \"gn help label_pattern\"). Only\n" | 265 " of generated projects (see \"gn help label_pattern\"). Only\n" |
251 " matching targets will be included to the solution. Only used for\n" | 266 " matching targets will be included to the solution. Only used for\n" |
252 " Visual Studio and Xcode.\n" | 267 " Visual Studio and Xcode.\n" |
253 "\n" | 268 "\n" |
254 "Visual Studio Flags\n" | 269 "Visual Studio Flags\n" |
255 "\n" | 270 "\n" |
256 " --sln=<file_name>\n" | 271 " --sln=<file_name>\n" |
257 " Override default sln file name (\"all\"). Solution file is written\n" | 272 " Override default sln file name (\"all\"). Solution file is written\n" |
258 " to the root build directory.\n" | 273 " to the root build directory.\n" |
259 "\n" | 274 "\n" |
260 "Xcode Flags\n" | 275 "Xcode Flags\n" |
261 "\n" | 276 "\n" |
262 " --workspace=<file_name>\n" | 277 " --workspace=<file_name>\n" |
263 " Override defaut workspace file name (\"all\"). The workspace file\n" | 278 " Override defaut workspace file name (\"all\"). The workspace file\n" |
264 " is written to the root build directory.\n" | 279 " is written to the root build directory.\n" |
265 "\n" | 280 "\n" |
266 " --ninja-extra-args=<string>\n" | 281 " --ninja-extra-args=<string>\n" |
267 " This string is passed without any quoting to the ninja invocation\n" | 282 " This string is passed without any quoting to the ninja invocation\n" |
268 " command-line. Can be used to configure ninja flags, like \"-j\" if\n" | 283 " command-line. Can be used to configure ninja flags, like \"-j\" if\n" |
269 " using goma for example.\n" | 284 " using goma for example.\n" |
270 "\n" | 285 "\n" |
271 " --root-target=<target_name>\n" | 286 " --root-target=<target_name>\n" |
272 " Name of the target corresponding to \"All\" target in Xcode. If\n" | 287 " Name of the target corresponding to \"All\" target in Xcode\n" |
Dirk Pranke
2016/05/13 01:50:23
You didn't create a separate "QtCreator Flags" sec
Krzysztof Olczyk
2016/05/13 10:32:14
Yes, I totally agree. I apologize - somehow, I hav
| |
273 " unset, \"All\" invokes ninja without any target thus build all the\n" | 288 " or QtCreator. If unset, \"All\" invokes ninja without any target\n" |
274 " targets.\n" | 289 " and builds everything.\n" |
275 "\n" | 290 "\n" |
276 "Eclipse IDE Support\n" | 291 "Eclipse IDE Support\n" |
277 "\n" | 292 "\n" |
278 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" | 293 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" |
279 " settings file which can be imported into an Eclipse CDT project. The\n" | 294 " settings file which can be imported into an Eclipse CDT project. The\n" |
280 " XML file contains a list of include paths and defines. Because GN does\n" | 295 " XML file contains a list of include paths and defines. Because GN does\n" |
281 " not generate a full .cproject definition, it is not possible to\n" | 296 " not generate a full .cproject definition, it is not possible to\n" |
282 " properly define includes/defines for each file individually.\n" | 297 " properly define includes/defines for each file individually.\n" |
283 " Instead, one set of includes/defines is generated for the entire\n" | 298 " Instead, one set of includes/defines is generated for the entire\n" |
284 " project. This works fairly well but may still result in a few indexer\n" | 299 " project. This works fairly well but may still result in a few indexer\n" |
(...skipping 66 matching lines...) Loading... | |
351 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 366 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
352 " files in " + | 367 " files in " + |
353 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; | 368 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; |
354 OutputString(stats); | 369 OutputString(stats); |
355 } | 370 } |
356 | 371 |
357 return 0; | 372 return 0; |
358 } | 373 } |
359 | 374 |
360 } // namespace commands | 375 } // namespace commands |
OLD | NEW |