| 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/config/nacl/config.gni") | |
| 10 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
| 11 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
| 12 import("//build_overrides/build.gni") | 11 import("//build_overrides/build.gni") |
| 13 | 12 |
| 14 if (current_cpu == "arm" || current_cpu == "arm64") { | 13 if (current_cpu == "arm" || current_cpu == "arm64") { |
| 15 import("//build/config/arm.gni") | 14 import("//build/config/arm.gni") |
| 16 } | 15 } |
| 17 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 16 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
| 18 import("//build/config/mips.gni") | 17 import("//build/config/mips.gni") |
| 19 } | 18 } |
| 20 if (is_mac) { | 19 if (is_mac) { |
| 21 import("//build/config/mac/symbols.gni") | 20 import("//build/config/mac/symbols.gni") |
| 22 } | 21 } |
| 23 if (is_ios) { | 22 if (is_ios) { |
| 24 import("//build/config/ios/ios_sdk.gni") | 23 import("//build/config/ios/ios_sdk.gni") |
| 25 } | 24 } |
| 25 if (is_nacl) { |
| 26 # To keep NaCl variables out of builds that don't include NaCl, all |
| 27 # variables defined in nacl/config.gni referenced here should be protected by |
| 28 # is_nacl conditions. |
| 29 import("//build/config/nacl/config.gni") |
| 30 } |
| 26 | 31 |
| 27 declare_args() { | 32 declare_args() { |
| 28 # Default to warnings as errors for default workflow, where we catch | 33 # Default to warnings as errors for default workflow, where we catch |
| 29 # warnings with known toolchains. Allow overriding this e.g. for Chromium | 34 # warnings with known toolchains. Allow overriding this e.g. for Chromium |
| 30 # builds on Linux that could use a different version of the compiler. | 35 # builds on Linux that could use a different version of the compiler. |
| 31 # With GCC, warnings in no-Chromium code are always not treated as errors. | 36 # With GCC, warnings in no-Chromium code are always not treated as errors. |
| 32 treat_warnings_as_errors = true | 37 treat_warnings_as_errors = true |
| 33 | 38 |
| 34 # Normally, Android builds are lightly optimized, even for debug builds, to | 39 # Normally, Android builds are lightly optimized, even for debug builds, to |
| 35 # keep binary size down. Setting this flag to true disables such optimization | 40 # keep binary size down. Setting this flag to true disables such optimization |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 } else { | 1492 } else { |
| 1488 cflags = [ "-O0" ] | 1493 cflags = [ "-O0" ] |
| 1489 ldflags = [] | 1494 ldflags = [] |
| 1490 } | 1495 } |
| 1491 } | 1496 } |
| 1492 | 1497 |
| 1493 # Turns up the optimization level. On Windows, this implies whole program | 1498 # Turns up the optimization level. On Windows, this implies whole program |
| 1494 # optimization and link-time code generation which is very expensive and should | 1499 # optimization and link-time code generation which is very expensive and should |
| 1495 # be used sparingly. | 1500 # be used sparingly. |
| 1496 config("optimize_max") { | 1501 config("optimize_max") { |
| 1497 if (is_nacl_irt) { | 1502 if (is_nacl && is_nacl_irt) { |
| 1498 # The NaCl IRT is a special case and always wants its own config. | 1503 # The NaCl IRT is a special case and always wants its own config. |
| 1499 # Various components do: | 1504 # Various components do: |
| 1500 # if (!is_debug) { | 1505 # if (!is_debug) { |
| 1501 # configs -= [ "//build/config/compiler:default_optimization" ] | 1506 # configs -= [ "//build/config/compiler:default_optimization" ] |
| 1502 # configs += [ "//build/config/compiler:optimize_max" ] | 1507 # configs += [ "//build/config/compiler:optimize_max" ] |
| 1503 # } | 1508 # } |
| 1504 # So this config has to have the selection logic just like | 1509 # So this config has to have the selection logic just like |
| 1505 # "default_optimization", below. | 1510 # "default_optimization", below. |
| 1506 configs = [ "//build/config/nacl:irt_optimize" ] | 1511 configs = [ "//build/config/nacl:irt_optimize" ] |
| 1507 } else { | 1512 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1534 } | 1539 } |
| 1535 | 1540 |
| 1536 # This config can be used to override the default settings for per-component | 1541 # This config can be used to override the default settings for per-component |
| 1537 # and whole-program optimization, optimizing the particular target for speed | 1542 # and whole-program optimization, optimizing the particular target for speed |
| 1538 # instead of code size. This config is exactly the same as "optimize_max" | 1543 # instead of code size. This config is exactly the same as "optimize_max" |
| 1539 # except that we use -O3 instead of -O2 on non-win, non-IRT platforms. | 1544 # except that we use -O3 instead of -O2 on non-win, non-IRT platforms. |
| 1540 # | 1545 # |
| 1541 # TODO(crbug.com/621335) - rework how all of these configs are related | 1546 # TODO(crbug.com/621335) - rework how all of these configs are related |
| 1542 # so that we don't need this disclaimer. | 1547 # so that we don't need this disclaimer. |
| 1543 config("optimize_speed") { | 1548 config("optimize_speed") { |
| 1544 if (is_nacl_irt) { | 1549 if (is_nacl && is_nacl_irt) { |
| 1545 # The NaCl IRT is a special case and always wants its own config. | 1550 # The NaCl IRT is a special case and always wants its own config. |
| 1546 # Various components do: | 1551 # Various components do: |
| 1547 # if (!is_debug) { | 1552 # if (!is_debug) { |
| 1548 # configs -= [ "//build/config/compiler:default_optimization" ] | 1553 # configs -= [ "//build/config/compiler:default_optimization" ] |
| 1549 # configs += [ "//build/config/compiler:optimize_max" ] | 1554 # configs += [ "//build/config/compiler:optimize_max" ] |
| 1550 # } | 1555 # } |
| 1551 # So this config has to have the selection logic just like | 1556 # So this config has to have the selection logic just like |
| 1552 # "default_optimization", below. | 1557 # "default_optimization", below. |
| 1553 configs = [ "//build/config/nacl:irt_optimize" ] | 1558 configs = [ "//build/config/nacl:irt_optimize" ] |
| 1554 } else { | 1559 } else { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1580 | 1585 |
| 1581 config("optimize_fuzzing") { | 1586 config("optimize_fuzzing") { |
| 1582 cflags = [ "-O1" ] + common_optimize_on_cflags | 1587 cflags = [ "-O1" ] + common_optimize_on_cflags |
| 1583 ldflags = common_optimize_on_ldflags | 1588 ldflags = common_optimize_on_ldflags |
| 1584 visibility = [ ":default_optimization" ] | 1589 visibility = [ ":default_optimization" ] |
| 1585 } | 1590 } |
| 1586 | 1591 |
| 1587 # The default optimization applied to all targets. This will be equivalent to | 1592 # The default optimization applied to all targets. This will be equivalent to |
| 1588 # either "optimize" or "no_optimize", depending on the build flags. | 1593 # either "optimize" or "no_optimize", depending on the build flags. |
| 1589 config("default_optimization") { | 1594 config("default_optimization") { |
| 1590 if (is_nacl_irt) { | 1595 if (is_nacl && is_nacl_irt) { |
| 1591 # The NaCl IRT is a special case and always wants its own config. | 1596 # The NaCl IRT is a special case and always wants its own config. |
| 1592 # It gets optimized the same way regardless of the type of build. | 1597 # It gets optimized the same way regardless of the type of build. |
| 1593 configs = [ "//build/config/nacl:irt_optimize" ] | 1598 configs = [ "//build/config/nacl:irt_optimize" ] |
| 1594 } else if (is_debug) { | 1599 } else if (is_debug) { |
| 1595 configs = [ ":no_optimize" ] | 1600 configs = [ ":no_optimize" ] |
| 1596 } else if (optimize_for_fuzzing) { | 1601 } else if (optimize_for_fuzzing) { |
| 1597 assert(!is_win, "Fuzzing optimize level not supported on Windows") | 1602 assert(!is_win, "Fuzzing optimize level not supported on Windows") |
| 1598 configs = [ ":optimize_fuzzing" ] | 1603 configs = [ ":optimize_fuzzing" ] |
| 1599 } else { | 1604 } else { |
| 1600 configs = [ ":optimize" ] | 1605 configs = [ ":optimize" ] |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 | 1750 |
| 1746 if (is_ios || is_mac) { | 1751 if (is_ios || is_mac) { |
| 1747 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1752 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1748 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1753 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1749 config("enable_arc") { | 1754 config("enable_arc") { |
| 1750 common_flags = [ "-fobjc-arc" ] | 1755 common_flags = [ "-fobjc-arc" ] |
| 1751 cflags_objc = common_flags | 1756 cflags_objc = common_flags |
| 1752 cflags_objcc = common_flags | 1757 cflags_objcc = common_flags |
| 1753 } | 1758 } |
| 1754 } | 1759 } |
| OLD | NEW |