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

Unified Diff: tools/gn/ninja_binary_target_writer.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patch set Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: tools/gn/ninja_binary_target_writer.cc
diff --git a/tools/gn/ninja_binary_target_writer.cc b/tools/gn/ninja_binary_target_writer.cc
index b341639b5d433964712093f72b0a519f0c14e290..16cc320446a22ee392d4e1ab559d8617d08b538f 100644
--- a/tools/gn/ninja_binary_target_writer.cc
+++ b/tools/gn/ninja_binary_target_writer.cc
@@ -102,8 +102,10 @@ void NinjaBinaryTargetWriter::WriteCompilerVars() {
// Include directories.
if (subst.used[SUBSTITUTION_INCLUDE_DIRS]) {
out_ << kSubstitutionNinjaNames[SUBSTITUTION_INCLUDE_DIRS] << " =";
- PathOutput include_path_output(path_output_.current_dir(),
- ESCAPE_NINJA_COMMAND);
+ PathOutput include_path_output(
+ path_output_.current_dir(),
+ settings_->build_settings()->root_path_utf8(),
+ ESCAPE_NINJA_COMMAND);
RecursiveTargetConfigToStream<SourceDir>(
target_, &ConfigValues::include_dirs,
IncludeWriter(include_path_output), out_);
@@ -150,6 +152,7 @@ void NinjaBinaryTargetWriter::WriteSources(
if (tool_type != Toolchain::TYPE_NONE) {
out_ << "build";
path_output_.WriteFiles(out_, tool_outputs);
+
out_ << ": " << rule_prefix << Toolchain::ToolTypeToName(tool_type);
out_ << " ";
path_output_.WriteFile(out_, source);
@@ -288,6 +291,7 @@ void NinjaBinaryTargetWriter::WriteLinkerFlags() {
// Since we're passing these on the command line to the linker and not
// to Ninja, we need to do shell escaping.
PathOutput lib_path_output(path_output_.current_dir(),
+ settings_->build_settings()->root_path_utf8(),
ESCAPE_NINJA_COMMAND);
for (size_t i = 0; i < all_lib_dirs.size(); i++) {
out_ << " " << tool_->lib_dir_switch();

Powered by Google App Engine
This is Rietveld 408576698