| # Copyright 2018 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| if (is_debug) { |
| default_optimize = "debug" |
| } else { |
| # TODO(phosek): consider using "size" in release mode to reduce size. |
| default_optimize = "speed" |
| } |
| |
| # NOTE: Keep in sync with //build/config/zircon/levels.gni |
| # TODO: Unify the default value between the two files. |
| declare_args() { |
| # * `none`: really unoptimized, usually only build-tested and not run |
| # * `debug`: "optimized for debugging", light enough to avoid confusion |
| # * `default`: default optimization level |
| # * `size`: optimized for space rather than purely for speed |
| # * `speed`: optimized purely for speed |
| # * `sanitizer`: optimized for sanitizers (ASan, etc.) |
| # * `profile`: optimized for coverage/profile data collection |
| # * `coverage`: optimized for coverage data collection |
| optimize = default_optimize |
| } |
| |
| _optimize_valid = [ |
| "none", |
| "debug", |
| "default", |
| "size", |
| "speed", |
| "sanitizer", |
| "profile", |
| "coverage", |
| ] |
| |
| assert(_optimize_valid + [ optimize ] - [ optimize ] != _optimize_valid, |
| "`optimize=\"...\"` must be one of $_optimize_valid") |
| |
| declare_args() { |
| # Controls whether to use the ML inliner in Clang to reduce size. Note that |
| # the option only takes effect when `optimize` is set to `"size"`. |
| clang_ml_inliner = false |
| } |
| |
| if (clang_ml_inliner) { |
| assert(optimize == "size", "clang_ml_inliner requires `optimize = \"size\"`") |
| } |
| |
| # NOTE: Keep in sync with //build/config/zircon/levels.gni |
| declare_args() { |
| # * `none` means no debugging information |
| # * `backtrace` means sufficient debugging information to symbolize backtraces |
| # * `debug` means debugging information suited for debugging |
| debuginfo = "debug" |
| } |
| |
| _debuginfo_valid = [ |
| "none", |
| "backtrace", |
| "debug", |
| ] |
| |
| assert(_debuginfo_valid + [ debuginfo ] - [ debuginfo ] != _debuginfo_valid, |
| "`debuginfo=\"...\"` must be one of $_debuginfo_valid") |
| |
| declare_args() { |
| # Explicitly specify DWARF version used. |
| dwarf_version = 5 |
| } |
| |
| assert(dwarf_version >= 2 && dwarf_version <= 5, |
| "`dwarf_version=\"...\"` must be between 2 and 5") |