# Copyright 2019 The Chromium Authors # 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 main 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 # Defined in Chromium and needed here as well is_wasm = 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 } declare_args() { # Component build. Setting to true compiles targets declared as "components" # as shared libraries loaded dynamically. This speeds up development time. # When false, components will be linked statically. # # For more information see # https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md is_component_build = is_debug && current_os != "ios" } # ============================================================================== # 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_apple = is_ios || is_mac is_posix = !is_win && !is_fuchsia # ============================================================================= # Variables # ============================================================================= # # These variables are used by other files in the //build directory and come from # the //build/config/BUILDCONFIG.gn TESTONLY_AND_VISIBILITY = [ "testonly", "visibility", ]