blob: cee7a957fbbb2eb5cb4eac61b1b4082d80045b76 [file] [log] [blame]
# Copyright (c) 2019 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.
# =============================================================================
# WHAT IS THIS FILE?
# =============================================================================
#
# This is the master GN build configuration. This file is loaded after the
# build args (args.gn) for the build directory and after the toplevel ".gn"
# file (which points to this file as the build configuration).
#
# This particular version of BUILDCONFIG.gn is derived from the original
# at //build/config/BUILDCONFIG.gn, but does not include many of the toolchain
# settings that are relevant for compiling C++.
# =============================================================================
# BUILD FLAGS
# =============================================================================
declare_args() {
# Set to enable the official build level of optimization. This has nothing
# to do with branding, but enables an additional level of optimization above
# release (!is_debug). This might be better expressed as a tri-state
# (debug, release, official) but for historical reasons there are two
# separate flags.
is_official_build = false
# Whether we're a traditional desktop unix.
is_desktop_linux = current_os == "linux"
# Set to true when compiling with the Clang compiler.
is_clang = true
# Allows the path to a custom target toolchain to be injected as a single
# argument, and set as the default toolchain.
custom_toolchain = ""
# This should not normally be set as a build argument. It's here so that
# every toolchain can pass through the "global" value via toolchain_args().
host_toolchain = ""
# DON'T ADD MORE FLAGS HERE. Read the comment above.
}
declare_args() {
# Debug build. Enabling official builds automatically sets is_debug to false.
is_debug = !is_official_build
}
# ==============================================================================
# TOOLCHAIN SETUP
# ==============================================================================
#
# We don't actually compile anything, so taking the Linux X64 toolchain suffices.
set_default_toolchain("//build/toolchain/linux:x64")
# =============================================================================
# OS DEFINITIONS
# =============================================================================
#
# We set these various is_FOO booleans for convenience in writing OS-based
# conditions.
#
# - is_android, is_chromeos, is_ios, and is_win should be obvious.
# - is_mac is set only for desktop Mac. It is not set on iOS.
# - is_posix is true for mac and any Unix-like system (basically everything
# except Windows).
# - is_linux is true for desktop Linux and ChromeOS, but not Android (which is
# generally too different despite being based on the Linux kernel).
#
# Do not add more is_* variants here for random lesser-used Unix systems like
# aix or one of the BSDs. If you need to check these, just check the
# current_os value directly.
is_android = current_os == "android"
is_chromeos = current_os == "chromeos"
is_fuchsia = current_os == "fuchsia"
is_ios = current_os == "ios"
is_linux = current_os == "chromeos" || current_os == "linux"
is_mac = current_os == "mac"
is_nacl = current_os == "nacl"
is_win = current_os == "win" || current_os == "winuwp"
is_posix = !is_win && !is_fuchsia