-
Notifications
You must be signed in to change notification settings - Fork 489
/
Copy pathBUILDCONFIG.gn
108 lines (92 loc) · 4.16 KB
/
BUILDCONFIG.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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 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
# 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",
]