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

Unified Diff: build/config/BUILD.gn

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 | « no previous file | build/toolchain/win/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/BUILD.gn
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index 9fc86fd2703a36aa877d146a9b158b900e94a577..7c8c45a6978a51e4ed7a4c150a7e063c8d042933 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -396,3 +396,31 @@ config("default_libs") {
libs = [ "dl" ]
}
}
+
+# Add this config to your target to enable precompiled headers.
+#
+# On Windows, precompiled headers are done on a per-target basis. If you have
+# just a couple of files, the time it takes to precompile (~2 seconds) can
+# actually be longer than the time saved. On a Z620, a 100 file target compiles
+# about 2 seconds faster with precompiled headers, with greater savings for
+# larger targets.
+#
+# Recommend precompiled headers for targets with more than 50 .cc files.
+config("precompiled_headers") {
+ # TODO(brettw) enable this when GN support in the binary has been rolled.
+ #if (is_win) {
+ if (false) {
+ # This is a string rather than a file GN knows about. It has to match
+ # exactly what's in the /FI flag below, and what might appear in the source
+ # code in quotes for an #include directive.
+ precompiled_header = "build/precompile.h"
+
+ # This is a file that GN will compile with the above header. It will be
+ # implicitly added to the sources (potentially multiple times, with one
+ # variant for each language used in the target).
+ precompiled_source = "//build/precompile.cc"
+
+ # Force include the header.
+ cflags = [ "/FI$precompiled_header" ]
+ }
+}
« no previous file with comments | « no previous file | build/toolchain/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698