| OLD | NEW |
| 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/chromecast_build.gni") | 7 import("//build/config/chromecast_build.gni") |
| 8 import("//build/config/compiler/compiler.gni") | 8 import("//build/config/compiler/compiler.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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 ] | 1434 ] |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 # Favor size over speed, /O1 must be before the common flags. The GYP | 1437 # Favor size over speed, /O1 must be before the common flags. The GYP |
| 1438 # build also specifies /Os and /GF but these are implied by /O1. | 1438 # build also specifies /Os and /GF but these are implied by /O1. |
| 1439 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] | 1439 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] |
| 1440 } else if (optimize_for_size && !is_nacl) { | 1440 } else if (optimize_for_size && !is_nacl) { |
| 1441 # Favor size over speed. | 1441 # Favor size over speed. |
| 1442 # TODO(crbug.com/718650): Fix -Os in PNaCl compiler and remove the is_nacl | 1442 # TODO(crbug.com/718650): Fix -Os in PNaCl compiler and remove the is_nacl |
| 1443 # guard above. | 1443 # guard above. |
| 1444 if (is_clang) { | 1444 cflags = [ "-Os" ] + common_optimize_on_cflags |
| 1445 cflags = [ "-Oz" ] + common_optimize_on_cflags | |
| 1446 } else { | |
| 1447 cflags = [ "-Os" ] + common_optimize_on_cflags | |
| 1448 } | |
| 1449 } else { | 1445 } else { |
| 1450 cflags = [ "-O2" ] + common_optimize_on_cflags | 1446 cflags = [ "-O2" ] + common_optimize_on_cflags |
| 1451 } | 1447 } |
| 1452 ldflags = common_optimize_on_ldflags | 1448 ldflags = common_optimize_on_ldflags |
| 1453 } | 1449 } |
| 1454 | 1450 |
| 1455 # Same config as 'optimize' but without the WPO flag. | 1451 # Same config as 'optimize' but without the WPO flag. |
| 1456 config("optimize_no_wpo") { | 1452 config("optimize_no_wpo") { |
| 1457 if (is_win) { | 1453 if (is_win) { |
| 1458 # Favor size over speed, /O1 must be before the common flags. The GYP | 1454 # Favor size over speed, /O1 must be before the common flags. The GYP |
| 1459 # build also specifies /Os and /GF but these are implied by /O1. | 1455 # build also specifies /Os and /GF but these are implied by /O1. |
| 1460 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] | 1456 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] |
| 1461 } else if (optimize_for_size && !is_nacl) { | 1457 } else if (optimize_for_size && !is_nacl) { |
| 1462 # Favor size over speed. | 1458 # Favor size over speed. |
| 1463 # TODO(crbug.com/718650): Fix -Os in PNaCl compiler and remove the is_nacl | 1459 # TODO(crbug.com/718650): Fix -Os in PNaCl compiler and remove the is_nacl |
| 1464 # guard above. | 1460 # guard above. |
| 1465 if (is_clang) { | 1461 cflags = [ "-Os" ] + common_optimize_on_cflags |
| 1466 cflags = [ "-Oz" ] + common_optimize_on_cflags | |
| 1467 } else { | |
| 1468 cflags = [ "-Os" ] + common_optimize_on_cflags | |
| 1469 } | |
| 1470 } else if (optimize_for_fuzzing) { | 1462 } else if (optimize_for_fuzzing) { |
| 1471 cflags = [ "-O1" ] + common_optimize_on_cflags | 1463 cflags = [ "-O1" ] + common_optimize_on_cflags |
| 1472 } else { | 1464 } else { |
| 1473 cflags = [ "-O2" ] + common_optimize_on_cflags | 1465 cflags = [ "-O2" ] + common_optimize_on_cflags |
| 1474 } | 1466 } |
| 1475 ldflags = common_optimize_on_ldflags | 1467 ldflags = common_optimize_on_ldflags |
| 1476 } | 1468 } |
| 1477 | 1469 |
| 1478 # Turn off optimizations. | 1470 # Turn off optimizations. |
| 1479 config("no_optimize") { | 1471 config("no_optimize") { |
| 1480 if (is_win) { | 1472 if (is_win) { |
| 1481 cflags = [ | 1473 cflags = [ |
| 1482 "/Od", # Disable optimization. | 1474 "/Od", # Disable optimization. |
| 1483 "/Ob0", # Disable all inlining (on by default). | 1475 "/Ob0", # Disable all inlining (on by default). |
| 1484 "/GF", # Enable string pooling (off by default). | 1476 "/GF", # Enable string pooling (off by default). |
| 1485 ] | 1477 ] |
| 1486 } else if (is_android && !android_full_debug) { | 1478 } else if (is_android && !android_full_debug) { |
| 1487 # On Android we kind of optimize some things that don't affect debugging | 1479 # On Android we kind of optimize some things that don't affect debugging |
| 1488 # much even when optimization is disabled to get the binary size down. | 1480 # much even when optimization is disabled to get the binary size down. |
| 1489 if (is_clang) { | 1481 cflags = [ "-Os" ] |
| 1490 cflags = [ "-Oz" ] + common_optimize_on_cflags | |
| 1491 } else { | |
| 1492 cflags = [ "-Os" ] + common_optimize_on_cflags | |
| 1493 } | |
| 1494 } else { | 1482 } else { |
| 1495 cflags = [ "-O0" ] | 1483 cflags = [ "-O0" ] |
| 1496 ldflags = [] | 1484 ldflags = [] |
| 1497 } | 1485 } |
| 1498 } | 1486 } |
| 1499 | 1487 |
| 1500 # Turns up the optimization level. On Windows, this implies whole program | 1488 # Turns up the optimization level. On Windows, this implies whole program |
| 1501 # optimization and link-time code generation which is very expensive and should | 1489 # optimization and link-time code generation which is very expensive and should |
| 1502 # be used sparingly. | 1490 # be used sparingly. |
| 1503 config("optimize_max") { | 1491 config("optimize_max") { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 | 1740 |
| 1753 if (is_ios || is_mac) { | 1741 if (is_ios || is_mac) { |
| 1754 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1742 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1755 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1743 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1756 config("enable_arc") { | 1744 config("enable_arc") { |
| 1757 common_flags = [ "-fobjc-arc" ] | 1745 common_flags = [ "-fobjc-arc" ] |
| 1758 cflags_objc = common_flags | 1746 cflags_objc = common_flags |
| 1759 cflags_objcc = common_flags | 1747 cflags_objcc = common_flags |
| 1760 } | 1748 } |
| 1761 } | 1749 } |
| OLD | NEW |