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

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

Issue 2198433004: Make get_label_info take into account the toolchain for target_gen_dir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused static function Created 4 years, 4 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 | « tools/gn/target.cc ('k') | 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 <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 if (!target->settings()->is_default()) { 330 if (!target->settings()->is_default()) {
331 project_name += "_" + target->toolchain()->label().name(); 331 project_name += "_" + target->toolchain()->label().name();
332 const Value* value = 332 const Value* value =
333 target->settings()->base_config()->GetValue(variables::kCurrentCpu); 333 target->settings()->base_config()->GetValue(variables::kCurrentCpu);
334 if (value != nullptr && value->string_value() == "x64") 334 if (value != nullptr && value->string_value() == "x64")
335 project_config_platform = "x64"; 335 project_config_platform = "x64";
336 else 336 else
337 project_config_platform = "Win32"; 337 project_config_platform = "Win32";
338 } 338 }
339 339
340 SourceFile target_file = GetTargetOutputDir(target).ResolveRelativeFile( 340 SourceFile target_file =
341 Value(nullptr, project_name + ".vcxproj"), err); 341 GetBuildDirForTargetAsSourceDir(target, BuildDirType::OBJ)
342 .ResolveRelativeFile(Value(nullptr, project_name + ".vcxproj"), err);
342 if (target_file.is_null()) 343 if (target_file.is_null())
343 return false; 344 return false;
344 345
345 base::FilePath vcxproj_path = build_settings_->GetFullPath(target_file); 346 base::FilePath vcxproj_path = build_settings_->GetFullPath(target_file);
346 std::string vcxproj_path_str = FilePathToUTF8(vcxproj_path); 347 std::string vcxproj_path_str = FilePathToUTF8(vcxproj_path);
347 348
348 projects_.emplace_back(new SolutionProject( 349 projects_.emplace_back(new SolutionProject(
349 project_name, vcxproj_path_str, 350 project_name, vcxproj_path_str,
350 MakeGuid(vcxproj_path_str, kGuidSeedProject), 351 MakeGuid(vcxproj_path_str, kGuidSeedProject),
351 FilePathToUTF8(build_settings_->GetFullPath(target->label().dir())), 352 FilePathToUTF8(build_settings_->GetFullPath(target->label().dir())),
(...skipping 18 matching lines...) Expand all
370 WriteFiltersFileContents(filters_string_out, target, source_types); 371 WriteFiltersFileContents(filters_string_out, target, source_types);
371 return WriteFileIfChanged(filters_path, filters_string_out.str(), err); 372 return WriteFileIfChanged(filters_path, filters_string_out.str(), err);
372 } 373 }
373 374
374 bool VisualStudioWriter::WriteProjectFileContents( 375 bool VisualStudioWriter::WriteProjectFileContents(
375 std::ostream& out, 376 std::ostream& out,
376 const SolutionProject& solution_project, 377 const SolutionProject& solution_project,
377 const Target* target, 378 const Target* target,
378 SourceFileCompileTypePairs* source_types, 379 SourceFileCompileTypePairs* source_types,
379 Err* err) { 380 Err* err) {
380 PathOutput path_output(GetTargetOutputDir(target), 381 PathOutput path_output(
381 build_settings_->root_path_utf8(), 382 GetBuildDirForTargetAsSourceDir(target, BuildDirType::OBJ),
382 EscapingMode::ESCAPE_NONE); 383 build_settings_->root_path_utf8(), EscapingMode::ESCAPE_NONE);
383 384
384 out << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl; 385 out << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
385 XmlElementWriter project( 386 XmlElementWriter project(
386 out, "Project", 387 out, "Project",
387 XmlAttributes("DefaultTargets", "Build") 388 XmlAttributes("DefaultTargets", "Build")
388 .add("ToolsVersion", project_version_) 389 .add("ToolsVersion", project_version_)
389 .add("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")); 390 .add("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"));
390 391
391 { 392 {
392 std::unique_ptr<XmlElementWriter> configurations = project.SubElement( 393 std::unique_ptr<XmlElementWriter> configurations = project.SubElement(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 std::ostringstream files_out; 606 std::ostringstream files_out;
606 607
607 { 608 {
608 std::unique_ptr<XmlElementWriter> filters_group = 609 std::unique_ptr<XmlElementWriter> filters_group =
609 project.SubElement("ItemGroup"); 610 project.SubElement("ItemGroup");
610 XmlElementWriter files_group(files_out, "ItemGroup", XmlAttributes(), 2); 611 XmlElementWriter files_group(files_out, "ItemGroup", XmlAttributes(), 2);
611 612
612 // File paths are relative to vcxproj files which are generated to out dirs. 613 // File paths are relative to vcxproj files which are generated to out dirs.
613 // Filters tree structure need to reflect source directories and be relative 614 // Filters tree structure need to reflect source directories and be relative
614 // to target file. We need two path outputs then. 615 // to target file. We need two path outputs then.
615 PathOutput file_path_output(GetTargetOutputDir(target), 616 PathOutput file_path_output(
616 build_settings_->root_path_utf8(), 617 GetBuildDirForTargetAsSourceDir(target, BuildDirType::OBJ),
617 EscapingMode::ESCAPE_NONE); 618 build_settings_->root_path_utf8(), EscapingMode::ESCAPE_NONE);
618 PathOutput filter_path_output(target->label().dir(), 619 PathOutput filter_path_output(target->label().dir(),
619 build_settings_->root_path_utf8(), 620 build_settings_->root_path_utf8(),
620 EscapingMode::ESCAPE_NONE); 621 EscapingMode::ESCAPE_NONE);
621 622
622 std::set<std::string> processed_filters; 623 std::set<std::string> processed_filters;
623 624
624 for (const auto& file_and_type : source_types) { 625 for (const auto& file_and_type : source_types) {
625 std::unique_ptr<XmlElementWriter> cl_item = files_group.SubElement( 626 std::unique_ptr<XmlElementWriter> cl_item = files_group.SubElement(
626 file_and_type.compile_type, "Include", 627 file_and_type.compile_type, "Include",
627 SourceFileWriter(file_path_output, *file_and_type.file)); 628 SourceFileWriter(file_path_output, *file_and_type.file));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 833 }
833 } 834 }
834 835
835 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) { 836 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) {
836 std::ostringstream ninja_target_out; 837 std::ostringstream ninja_target_out;
837 DCHECK(!target->dependency_output_file().value().empty()); 838 DCHECK(!target->dependency_output_file().value().empty());
838 ninja_path_output_.WriteFile(ninja_target_out, 839 ninja_path_output_.WriteFile(ninja_target_out,
839 target->dependency_output_file()); 840 target->dependency_output_file());
840 return ninja_target_out.str(); 841 return ninja_target_out.str();
841 } 842 }
OLDNEW
« no previous file with comments | « tools/gn/target.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698