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