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

Side by Side Diff: build/config/BUILD.gn

Issue 2520863002: Enable precompiled headers for Blink on Windows. (Closed)
Patch Set: rebased Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | build/config/pch.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 import("//build/config/allocator.gni") 5 import("//build/config/allocator.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/chromecast_build.gni") 7 import("//build/config/chromecast_build.gni")
8 import("//build/config/crypto.gni") 8 import("//build/config/crypto.gni")
9 import("//build/config/dcheck_always_on.gni") 9 import("//build/config/dcheck_always_on.gni")
10 import("//build/config/features.gni") 10 import("//build/config/features.gni")
11 import("//build/config/pch.gni")
11 import("//build/config/sanitizers/sanitizers.gni") 12 import("//build/config/sanitizers/sanitizers.gni")
12 import("//build/config/ui.gni") 13 import("//build/config/ui.gni")
13 import("//build/toolchain/goma.gni") 14 import("//build/toolchain/goma.gni")
14 15
15 # One common error that happens is that GYP-generated headers within gen/ get 16 # One common error that happens is that GYP-generated headers within gen/ get
16 # included rather than the GN-generated ones within gen/ subdirectories. 17 # included rather than the GN-generated ones within gen/ subdirectories.
17 # TODO(GYP_GONE): Remove once GYP is gone (as well as exec_script exception). 18 # TODO(GYP_GONE): Remove once GYP is gone (as well as exec_script exception).
18 assert( 19 assert(
19 exec_script("//build/dir_exists.py", [ "obj.host" ], "string") == "False", 20 exec_script("//build/dir_exists.py", [ "obj.host" ], "string") == "False",
20 "GYP artifacts detected in $root_build_dir.$0x0A" + 21 "GYP artifacts detected in $root_build_dir.$0x0A" +
21 "You must wipe this directory before building with GN.") 22 "You must wipe this directory before building with GN.")
22 23
23 declare_args() { 24 declare_args() {
24 # When set (the default) enables C++ iterator debugging in debug builds. 25 # When set (the default) enables C++ iterator debugging in debug builds.
25 # Iterator debugging is always off in release builds (technically, this flag 26 # Iterator debugging is always off in release builds (technically, this flag
26 # affects the "debug" config, which is always available but applied by 27 # affects the "debug" config, which is always available but applied by
27 # default only in debug builds). 28 # default only in debug builds).
28 # 29 #
29 # Iterator debugging is generally useful for catching bugs. But it can 30 # Iterator debugging is generally useful for catching bugs. But it can
30 # introduce extra locking to check the state of an iterator against the state 31 # introduce extra locking to check the state of an iterator against the state
31 # of the current object. For iterator- and thread-heavy code, this can 32 # of the current object. For iterator- and thread-heavy code, this can
32 # significantly slow execution. 33 # significantly slow execution.
33 enable_iterator_debugging = true 34 enable_iterator_debugging = true
34
35 # Normally we try to decide whether to use precompiled headers or
36 # not based on the other build arguments, but in some cases it is
37 # easiest to force them off explicitly.
38 disable_precompiled_headers = false
39 } 35 }
40 36
41 # ============================================== 37 # ==============================================
42 # PLEASE DO NOT ADD MORE THINGS TO THIS LIST 38 # PLEASE DO NOT ADD MORE THINGS TO THIS LIST
43 # ============================================== 39 # ==============================================
44 # 40 #
45 # Legacy feature defines applied to all targets. 41 # Legacy feature defines applied to all targets.
46 # 42 #
47 # These are applied to every single compile in the build and most of them are 43 # These are applied to every single compile in the build and most of them are
48 # only relevant to a few files. This bloats command lines and causes 44 # only relevant to a few files. This bloats command lines and causes
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 377
382 # Add this config to your target to enable precompiled headers. 378 # Add this config to your target to enable precompiled headers.
383 # 379 #
384 # Precompiled headers are done on a per-target basis. If you have just a couple 380 # Precompiled headers are done on a per-target basis. If you have just a couple
385 # of files, the time it takes to precompile (~2 seconds) can actually be longer 381 # of files, the time it takes to precompile (~2 seconds) can actually be longer
386 # than the time saved. On a Z620, a 100 file target compiles about 2 seconds 382 # than the time saved. On a Z620, a 100 file target compiles about 2 seconds
387 # faster with precompiled headers, with greater savings for larger targets. 383 # faster with precompiled headers, with greater savings for larger targets.
388 # 384 #
389 # Recommend precompiled headers for targets with more than 50 .cc files. 385 # Recommend precompiled headers for targets with more than 50 .cc files.
390 config("precompiled_headers") { 386 config("precompiled_headers") {
391 if (!is_official_build && !use_goma && !disable_precompiled_headers) { 387 if (enable_precompiled_headers) {
392 if (is_win) { 388 if (is_win) {
393 # This is a string rather than a file GN knows about. It has to match 389 # This is a string rather than a file GN knows about. It has to match
394 # exactly what's in the /FI flag below, and what might appear in the 390 # exactly what's in the /FI flag below, and what might appear in the
395 # source code in quotes for an #include directive. 391 # source code in quotes for an #include directive.
396 precompiled_header = "build/precompile.h" 392 precompiled_header = "build/precompile.h"
397 393
398 # This is a file that GN will compile with the above header. It will be 394 # This is a file that GN will compile with the above header. It will be
399 # implicitly added to the sources (potentially multiple times, with one 395 # implicitly added to the sources (potentially multiple times, with one
400 # variant for each language used in the target). 396 # variant for each language used in the target).
401 precompiled_source = "//build/precompile.cc" 397 precompiled_source = "//build/precompile.cc"
402 398
403 # Force include the header. 399 # Force include the header.
404 cflags = [ "/FI$precompiled_header" ] 400 cflags = [ "/FI$precompiled_header" ]
405 401
406 # Disable warning for "this file was empty after preprocessing". This 402 # Disable warning for "this file was empty after preprocessing". This
407 # error is generated only in C mode for ANSI compatibility. It conflicts 403 # error is generated only in C mode for ANSI compatibility. It conflicts
408 # with precompiled headers since the source file that's "compiled" for 404 # with precompiled headers since the source file that's "compiled" for
409 # making the precompiled header is empty. 405 # making the precompiled header is empty.
410 # 406 #
411 # This error doesn't happen every time. In VS2013, it seems if the .pch 407 # This error doesn't happen every time. In VS2013, it seems if the .pch
412 # file doesn't exist, no error will be generated (probably MS tested this 408 # file doesn't exist, no error will be generated (probably MS tested this
413 # case but forgot the other one?). To reproduce this error, do a build, 409 # case but forgot the other one?). To reproduce this error, do a build,
414 # then delete the precompile.c.obj file, then build again. 410 # then delete the precompile.c.obj file, then build again.
411 #
412 # TODO(sof): determine VS2015 status and retire the setting from all
413 # precompiled configurations.
415 cflags_c = [ "/wd4206" ] 414 cflags_c = [ "/wd4206" ]
416 } else if (is_mac) { 415 } else if (is_mac) {
417 precompiled_header = "build/precompile.h" 416 precompiled_header = "build/precompile.h"
418 precompiled_source = "//build/precompile.h" 417 precompiled_source = "//build/precompile.h"
419 } 418 }
420 } 419 }
421 } 420 }
OLDNEW
« no previous file with comments | « no previous file | build/config/pch.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698