BUILD.gn 53.70 KiB
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/nacl/config.gni")
import("//build/toolchain/cc_wrapper.gni")
import("//build/toolchain/toolchain.gni")
import("//build_overrides/build.gni")
if (current_cpu == "arm" || current_cpu == "arm64") {
  import("//build/config/arm.gni")
if (current_cpu == "mipsel" || current_cpu == "mips64el") {
  import("//build/config/mips.gni")
if (is_mac) {
  import("//build/config/mac/symbols.gni")
declare_args() {
  # Default to warnings as errors for default workflow, where we catch
  # warnings with known toolchains. Allow overriding this e.g. for Chromium
  # builds on Linux that could use a different version of the compiler.
  # With GCC, warnings in no-Chromium code are always not treated as errors.
  treat_warnings_as_errors = true
  # Normally, Android builds are lightly optimized, even for debug builds, to
  # keep binary size down. Setting this flag to true disables such optimization
  android_full_debug = false
  # Whether to use the binary binutils checked into third_party/binutils.
  # These are not multi-arch so cannot be used except on x86 and x86-64 (the
  # only two architectures that are currently checked in). Turn this off when
  # you are using a custom toolchain and need to control -B in cflags.
  linux_use_bundled_binutils =
      linux_use_bundled_binutils_override && is_linux &&
      (current_cpu == "x64" || current_cpu == "x86")
  binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
                              root_build_dir)
  # Compile in such a way as to make it possible for the profiler to unwind full
  # stack frames. Setting this flag has a large effect on the performance of the
  # generated code than just setting profiling, but gives the profiler more
  # information to analyze.
  # Requires profiling to be set to true.
  enable_full_stack_frames_for_profiling = false
  # When we are going to use gold we need to find it.
  # This is initialized below, after use_gold might have been overridden.
  gold_path = false
  if (is_win) {
    # Whether the VS xtree header has been patched to disable warning 4702. If
    # it has, then we don't need to disable 4702 (unreachable code warning).
    # The patch is preapplied to the internal toolchain and hence all bots.
    msvs_xtree_patched = false
  # Omit unwind support in official builds to save space.
  # We can use breakpad for these builds.
  exclude_unwind_tables = is_chrome_branded && is_official_build
  # If true, gold linker will save symbol table inside object files.
  # This speeds up gdb startup by 60%
  gdb_index = false
  # If true, optimize for size. Does not affect windows builds.
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
# Linux & Mac favor speed over size. # TODO(brettw) it's weird that Mac and desktop Linux are different. We should # explore favoring size over speed in this case as well. optimize_for_size = is_android || is_ios # Enable fatal linker warnings. Building Chromium with certain versions # of binutils can cause linker warning. # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 fatal_linker_warnings = true # AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided # optimization that GCC supports. It used by ChromeOS in their official # builds. To use it, set auto_profile_path to the path to a file containing # the needed gcov profiling data. auto_profile_path = "" # Optimize for coverage guided fuzzing (balance between speed and number of # branches) optimize_for_fuzzing = false # Enable this to turn off the delete-null-pointer-checks optimization in GCC 6+ no_delete_null_pointer_checks = false # Use stdlib=libc++ use_libcxx = is_mac } if (is_clang && !is_nacl) { update_args = [ "--print-revision" ] if (llvm_force_head_revision) { update_args += [ "--llvm-force-head-revision" ] } clang_revision = exec_script("//tools/clang/scripts/update.py", update_args, "trim string") } # Apply the default logic for these values if they were not set explicitly. if (gold_path == false) { if (use_gold) { gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", root_build_dir) } else { gold_path = "" } } if (use_debug_fission == "default") { use_debug_fission = is_debug && !is_win && use_gold && linux_use_bundled_binutils && cc_wrapper == "" } # default_include_dirs --------------------------------------------------------- # # This is a separate config so that third_party code (which would not use the # source root and might have conflicting versions of some headers) can remove # this and specify their own include paths. config("default_include_dirs") { include_dirs = [ root_gen_dir, "//", ] } # compiler --------------------------------------------------------------------- # # Base compiler configuration. # # See also "runtime_library" below for related stuff and a discussion about # where stuff should go. Put warning related stuff in the "warnings" config.