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" ] |
+ } |
+} |