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

Unified Diff: tools/gn/config_values_generator.cc

Issue 1207903002: Windows precompiled header support in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Scott's grammar nits Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/config_values_generator.h ('k') | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/config_values_generator.cc
diff --git a/tools/gn/config_values_generator.cc b/tools/gn/config_values_generator.cc
index f66ddfd688199e6c35e01abfd1cb23f84720d69e..7eb7bc5cd9b0b213bd89d53556dc7b92e35f12ab 100644
--- a/tools/gn/config_values_generator.cc
+++ b/tools/gn/config_values_generator.cc
@@ -4,6 +4,7 @@
#include "tools/gn/config_values_generator.h"
+#include "base/strings/string_util.h"
#include "tools/gn/config_values.h"
#include "tools/gn/scope.h"
#include "tools/gn/settings.h"
@@ -81,4 +82,34 @@ void ConfigValuesGenerator::Run() {
#undef FILL_STRING_CONFIG_VALUE
#undef FILL_DIR_CONFIG_VALUE
+
+ // Precompiled headers.
+ const Value* precompiled_header_value =
+ scope_->GetValue(variables::kPrecompiledHeader, true);
+ if (precompiled_header_value) {
+ if (!precompiled_header_value->VerifyTypeIs(Value::STRING, err_))
+ return;
+
+ // Check for common errors. This is a string and not a file.
+ const std::string& pch_string = precompiled_header_value->string_value();
+ if (base::StartsWith(pch_string, "//", base::CompareCase::SENSITIVE)) {
+ *err_ = Err(*precompiled_header_value,
+ "This precompiled_header value is wrong.",
+ "You need to specify a string that the compiler will match against\n"
+ "the #include lines rather than a GN-style file name.\n");
+ return;
+ }
+ config_values_->set_precompiled_header(pch_string);
+ }
+
+ const Value* precompiled_source_value =
+ scope_->GetValue(variables::kPrecompiledSource, true);
+ if (precompiled_source_value) {
+ config_values_->set_precompiled_source(
+ input_dir_.ResolveRelativeFile(
+ *precompiled_source_value, err_,
+ scope_->settings()->build_settings()->root_path_utf8()));
+ if (err_->has_error())
+ return;
+ }
}
« no previous file with comments | « tools/gn/config_values_generator.h ('k') | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698