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

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

Issue 2022733002: gn: Add an 'optimize' config for components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/nacl/config.gni") 8 import("//build/config/nacl/config.gni")
9 import("//build/toolchain/cc_wrapper.gni") 9 import("//build/toolchain/cc_wrapper.gni")
10 import("//build/toolchain/toolchain.gni") 10 import("//build/toolchain/toolchain.gni")
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 1301
1302 # Don't use gc-sections since it can cause links to succeed when they 1302 # Don't use gc-sections since it can cause links to succeed when they
1303 # actually shouldn't. http://crbug.com/159847 1303 # actually shouldn't. http://crbug.com/159847
1304 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ] 1304 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ]
1305 } else { 1305 } else {
1306 cflags = [ "-O0" ] 1306 cflags = [ "-O0" ]
1307 ldflags = [] 1307 ldflags = []
1308 } 1308 }
1309 } 1309 }
1310 1310
1311 # Turns up the optimization level. On Windows, this implies whole program 1311 # Internal common config used by optimize_max and optimize_component.
1312 # optimization and link-time code generation which is very expensive and should 1312 config("common_optimize_max") {
Michael Achenbach 2016/05/30 11:38:07 Is there a better way to share a common config wit
Dirk Pranke 2016/05/31 19:46:18 Not really, but it's not something we tend to worr
1313 # be used sparingly.
1314 config("optimize_max") {
1315 if (is_nacl_irt) { 1313 if (is_nacl_irt) {
1316 # The NaCl IRT is a special case and always wants its own config. 1314 # The NaCl IRT is a special case and always wants its own config.
1317 # Various components do: 1315 # Various components do:
1318 # if (!is_debug) { 1316 # if (!is_debug) {
1319 # configs -= [ "//build/config/compiler:default_optimization" ] 1317 # configs -= [ "//build/config/compiler:default_optimization" ]
1320 # configs += [ "//build/config/compiler:optimize_max" ] 1318 # configs += [ "//build/config/compiler:optimize_max" ]
1321 # } 1319 # }
1322 # So this config has to have the selection logic just like 1320 # So this config has to have the selection logic just like
1323 # "default_optimization", below. 1321 # "default_optimization", below.
1324 configs = [ "//build/config/nacl:irt_optimize" ] 1322 configs = [ "//build/config/nacl:irt_optimize" ]
1325 } else { 1323 } else {
1326 ldflags = common_optimize_on_ldflags 1324 ldflags = common_optimize_on_ldflags
1327 if (is_win) { 1325 if (is_win) {
1328 # Favor speed over size, /O2 must be before the common flags. The GYP 1326 # Favor speed over size, /O2 must be before the common flags. The GYP
1329 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. 1327 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2.
1330 cflags = [ "/O2" ] + common_optimize_on_cflags 1328 cflags = [ "/O2" ] + common_optimize_on_cflags
1331 1329
1332 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 1330 # TODO(thakis): Remove is_clang here, https://crbug.com/598772
1333 if (is_official_build && !is_clang) { 1331 if (is_official_build && !is_clang) {
1334 cflags += [ 1332 cflags += [
1335 "/GL", # Whole program optimization. 1333 "/GL", # Whole program optimization.
1336 1334
1337 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. 1335 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
1338 # Probably anything that this would catch that wouldn't be caught in a 1336 # Probably anything that this would catch that wouldn't be caught in a
1339 # normal build isn't going to actually be a bug, so the incremental 1337 # normal build isn't going to actually be a bug, so the incremental
1340 # value of C4702 for PGO builds is likely very small. 1338 # value of C4702 for PGO builds is likely very small.
1341 "/wd4702", 1339 "/wd4702",
1342 ] 1340 ]
1343 } 1341 }
1344 } else { 1342 }
1343 }
1344 }
1345
1346 # Turns up the optimization level. On Windows, this implies whole program
1347 # optimization and link-time code generation which is very expensive and should
1348 # be used sparingly.
1349 config("optimize_max") {
1350 configs = [ ":common_optimize_max" ]
Michael Achenbach 2016/05/30 11:38:07 Does the line: configs -= ["optimize_max"] also re
Dirk Pranke 2016/05/31 19:46:18 Yes, I think so.
1351 if (!is_nacl_irt) {
1352 if (!is_win) {
1345 cflags = [ "-O2" ] + common_optimize_on_cflags 1353 cflags = [ "-O2" ] + common_optimize_on_cflags
1346 } 1354 }
1347 } 1355 }
1348 } 1356 }
1349 1357
1358 # Some components like v8 use higher optimization levels on linux and mac.
1359 config("optimize_component") {
Michael Achenbach 2016/05/30 11:38:07 Named this optimize_component as I don't like opti
1360 configs = [ ":common_optimize_max" ]
1361 if (!is_nacl_irt) {
1362 if (!is_win) {
1363 cflags = [ "-O3" ] + common_optimize_on_cflags
1364 }
1365 }
1366 }
1367
1350 # The default optimization applied to all targets. This will be equivalent to 1368 # The default optimization applied to all targets. This will be equivalent to
1351 # either "optimize" or "no_optimize", depending on the build flags. 1369 # either "optimize" or "no_optimize", depending on the build flags.
1352 config("default_optimization") { 1370 config("default_optimization") {
1353 if (is_nacl_irt) { 1371 if (is_nacl_irt) {
1354 # The NaCl IRT is a special case and always wants its own config. 1372 # The NaCl IRT is a special case and always wants its own config.
1355 # It gets optimized the same way regardless of the type of build. 1373 # It gets optimized the same way regardless of the type of build.
1356 configs = [ "//build/config/nacl:irt_optimize" ] 1374 configs = [ "//build/config/nacl:irt_optimize" ]
1357 } else if (is_debug) { 1375 } else if (is_debug) {
1358 configs = [ ":no_optimize" ] 1376 configs = [ ":no_optimize" ]
1359 } else { 1377 } else {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1467
1450 if (is_ios || is_mac) { 1468 if (is_ios || is_mac) {
1451 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1469 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1452 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1470 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1453 config("enable_arc") { 1471 config("enable_arc") {
1454 common_flags = [ "-fobjc-arc" ] 1472 common_flags = [ "-fobjc-arc" ]
1455 cflags_objc = common_flags 1473 cflags_objc = common_flags
1456 cflags_objcc = common_flags 1474 cflags_objcc = common_flags
1457 } 1475 }
1458 } 1476 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698