Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: tools/gn/visual_studio_writer.cc

Issue 1819353002: Convert GN group targets to Visual Studio projects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "tools/gn/visual_studio_writer.h" 5 #include "tools/gn/visual_studio_writer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 std::string GetConfigurationType(const Target* target, Err* err) { 118 std::string GetConfigurationType(const Target* target, Err* err) {
119 switch (target->output_type()) { 119 switch (target->output_type()) {
120 case Target::EXECUTABLE: 120 case Target::EXECUTABLE:
121 return "Application"; 121 return "Application";
122 case Target::SHARED_LIBRARY: 122 case Target::SHARED_LIBRARY:
123 case Target::LOADABLE_MODULE: 123 case Target::LOADABLE_MODULE:
124 return "DynamicLibrary"; 124 return "DynamicLibrary";
125 case Target::STATIC_LIBRARY: 125 case Target::STATIC_LIBRARY:
126 case Target::SOURCE_SET: 126 case Target::SOURCE_SET:
127 return "StaticLibrary"; 127 return "StaticLibrary";
128 case Target::GROUP:
129 return "Utility";
128 130
129 default: 131 default:
130 *err = Err(Location(), 132 *err = Err(Location(),
131 "Visual Studio doesn't support '" + target->label().name() + 133 "Visual Studio doesn't support '" + target->label().name() +
132 "' target output type: " + 134 "' target output type: " +
133 Target::GetStringForOutputType(target->output_type())); 135 Target::GetStringForOutputType(target->output_type()));
134 return std::string(); 136 return std::string();
135 } 137 }
136 } 138 }
137 139
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (target_cpu_value != nullptr && 254 if (target_cpu_value != nullptr &&
253 target_cpu_value->string_value() == "x64") 255 target_cpu_value->string_value() == "x64")
254 config_platform = "x64"; 256 config_platform = "x64";
255 } 257 }
256 258
257 VisualStudioWriter writer(build_settings, config_platform, version); 259 VisualStudioWriter writer(build_settings, config_platform, version);
258 writer.projects_.reserve(targets.size()); 260 writer.projects_.reserve(targets.size());
259 writer.folders_.reserve(targets.size()); 261 writer.folders_.reserve(targets.size());
260 262
261 for (const Target* target : targets) { 263 for (const Target* target : targets) {
262 // Skip actions, groups and bundle targets. 264 // Skip actions and bundle targets.
263 if (target->output_type() == Target::GROUP || 265 if (target->output_type() == Target::COPY_FILES ||
264 target->output_type() == Target::COPY_FILES ||
265 target->output_type() == Target::ACTION || 266 target->output_type() == Target::ACTION ||
266 target->output_type() == Target::ACTION_FOREACH || 267 target->output_type() == Target::ACTION_FOREACH ||
267 target->output_type() == Target::BUNDLE_DATA) { 268 target->output_type() == Target::BUNDLE_DATA) {
268 continue; 269 continue;
269 } 270 }
270 271
271 if (!writer.WriteProjectFiles(target, err)) 272 if (!writer.WriteProjectFiles(target, err))
272 return false; 273 return false;
273 } 274 }
274 275
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 418
418 project.SubElement("PropertyGroup", XmlAttributes("Label", "UserMacros")); 419 project.SubElement("PropertyGroup", XmlAttributes("Label", "UserMacros"));
419 420
420 { 421 {
421 scoped_ptr<XmlElementWriter> properties = 422 scoped_ptr<XmlElementWriter> properties =
422 project.SubElement("PropertyGroup"); 423 project.SubElement("PropertyGroup");
423 { 424 {
424 scoped_ptr<XmlElementWriter> out_dir = properties->SubElement("OutDir"); 425 scoped_ptr<XmlElementWriter> out_dir = properties->SubElement("OutDir");
425 path_output.WriteDir(out_dir->StartContent(false), 426 path_output.WriteDir(out_dir->StartContent(false),
426 build_settings_->build_dir(), 427 build_settings_->build_dir(),
427 PathOutput::DIR_INCLUDE_LAST_SLASH); 428 PathOutput::DIR_NO_LAST_SLASH);
428 } 429 }
429 properties->SubElement("TargetName")->Text("$(ProjectName)"); 430 properties->SubElement("TargetName")->Text("$(ProjectName)");
430 properties->SubElement("TargetPath") 431 if (target->output_type() != Target::GROUP) {
431 ->Text("$(OutDir)\\$(ProjectName)$(TargetExt)"); 432 properties->SubElement("TargetPath")
433 ->Text("$(OutDir)\\$(ProjectName)$(TargetExt)");
434 }
432 } 435 }
433 436
434 { 437 {
435 scoped_ptr<XmlElementWriter> item_definitions = 438 scoped_ptr<XmlElementWriter> item_definitions =
436 project.SubElement("ItemDefinitionGroup"); 439 project.SubElement("ItemDefinitionGroup");
437 { 440 {
438 scoped_ptr<XmlElementWriter> cl_compile = 441 scoped_ptr<XmlElementWriter> cl_compile =
439 item_definitions->SubElement("ClCompile"); 442 item_definitions->SubElement("ClCompile");
440 { 443 {
441 scoped_ptr<XmlElementWriter> include_dirs = 444 scoped_ptr<XmlElementWriter> include_dirs =
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 794 }
792 } 795 }
793 796
794 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) { 797 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) {
795 std::ostringstream ninja_target_out; 798 std::ostringstream ninja_target_out;
796 DCHECK(!target->dependency_output_file().value().empty()); 799 DCHECK(!target->dependency_output_file().value().empty());
797 ninja_path_output_.WriteFile(ninja_target_out, 800 ninja_path_output_.WriteFile(ninja_target_out,
798 target->dependency_output_file()); 801 target->dependency_output_file());
799 return ninja_target_out.str(); 802 return ninja_target_out.str();
800 } 803 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698