Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: build/config/BUILDCONFIG.gn

Issue 946243002: Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix git cl upload to include ots Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/BUILD.gn ('k') | build/config/allocator.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # ============================================================================= 5 # =============================================================================
6 # BUILD FLAGS 6 # BUILD FLAGS
7 # ============================================================================= 7 # =============================================================================
8 # 8 #
9 # This block lists input arguments to the build, along with their default 9 # This block lists input arguments to the build, along with their default
10 # values. GN requires listing them explicitly so it can validate input and have 10 # values. GN requires listing them explicitly so it can validate input and have
11 # a central place to manage the build flags. 11 # a central place to manage the build flags.
12 # 12 #
13 # If a value is specified on the command line, it will overwrite the defaults 13 # If a value is specified on the command line, it will overwrite the defaults
14 # given here, otherwise the default will be injected into the root scope. 14 # given here, otherwise the default will be injected into the root scope.
15 # 15 #
16 # KEEP IN ALPHABETICAL ORDER and write a good description for everything. 16 # KEEP IN ALPHABETICAL ORDER and write a good description for everything.
17 # Use "is_*" names for intrinsic platform descriptions and build modes, and 17 # Use "is_*" names for intrinsic platform descriptions and build modes, and
18 # "use_*" names for optional features libraries, and configurations. 18 # "use_*" names for optional features libraries, and configurations.
19
20 # TODO(dpranke): The os and cpu_arch variables exist for backwards
21 # compatibility and should be deleted once all of the build files and
22 # bots have been updated to use current_cpu/target_cpu and
23 # current_os/target_os instead.
24
25 if (target_os == "") {
26 if (defined(os)) {
27 # If os is defined, it was set in an args file and needs to be
28 # used for backwards-compatibility.
29 target_os = os
30 } else {
31 target_os = host_os
32 }
33 }
34
35 if (target_cpu == "") {
36 if (defined(cpu_arch)) {
37 # If cpu_arch is defined, it was set in an args file and needs to be
38 # used for backwards-compatibility.
39 target_cpu = cpu_arch
40 } else if (target_os == "android") {
41 # If we're building for Android, we should assume that we want to
42 # build for ARM by default, not the host_cpu (which is likely x64).
43 # This allows us to not have to specify both target_os and target_cpu
44 # on the command line.
45 target_cpu = "arm"
46 } else {
47 target_cpu = host_cpu
48 }
49 }
50
51 if (current_cpu == "") {
52 current_cpu = target_cpu
53 }
54 if (current_os == "") {
55 current_os = target_os
56 }
57
19 declare_args() { 58 declare_args() {
59 # TODO(dpranke): These values are here for backwards compatibility and
60 # should be deleted when all of the builders and configs have been updated.
61 cpu_arch = target_cpu
62 os = target_os
63 build_cpu_arch = host_cpu
64 build_os = host_os
65
20 # How many symbols to include in the build. This affects the performance of 66 # How many symbols to include in the build. This affects the performance of
21 # the build since the symbols are large and dealing with them is slow. 67 # the build since the symbols are large and dealing with them is slow.
22 # 2 means regular build with symbols. 68 # 2 means regular build with symbols.
23 # 1 means minimal symbols, usually enough for backtraces only. 69 # 1 means minimal symbols, usually enough for backtraces only.
24 # 0 means no symbols. 70 # 0 means no symbols.
25 # -1 means auto-set (off in release, regular in debug). 71 # -1 means auto-set (off in release, regular in debug).
26 symbol_level = -1 72 symbol_level = -1
27 73
28 # Component build. 74 # Component build.
29 is_component_build = false 75 is_component_build = false
30 76
31 # Debug build. 77 # Debug build.
32 is_debug = true 78 is_debug = true
33 79
34 # Whether we're a traditional desktop unix. 80 # Whether we're a traditional desktop unix.
35 is_desktop_linux = os == "linux" && os != "chromeos" 81 is_desktop_linux = current_os == "linux" && current_os != "chromeos"
36 82
37 # Set to true when compiling with the Clang compiler. Typically this is used 83 # Set to true when compiling with the Clang compiler. Typically this is used
38 # to configure warnings. 84 # to configure warnings.
39 is_clang = os == "mac" || os == "ios" || os == "linux" || os == "chromeos" 85 is_clang = current_os == "mac" || current_os == "ios" ||
86 current_os == "linux" || current_os == "chromeos"
40 87
41 # Selects the desired build flavor. Official builds get additional 88 # Selects the desired build flavor. Official builds get additional
42 # processing to prepare for release. Normally you will want to develop and 89 # processing to prepare for release. Normally you will want to develop and
43 # test with this flag off. 90 # test with this flag off.
44 is_official_build = false 91 is_official_build = false
45 92
46 # Select the desired branding flavor. False means normal Chromium branding, 93 # Select the desired branding flavor. False means normal Chromium branding,
47 # true means official Google Chrome branding (requires extra Google-internal 94 # true means official Google Chrome branding (requires extra Google-internal
48 # resources). 95 # resources).
49 is_chrome_branded = false 96 is_chrome_branded = false
50 97
51 # Compile for Address Sanitizer to find memory bugs. 98 # Compile for Address Sanitizer to find memory bugs.
52 is_asan = false 99 is_asan = false
53 100
54 # Compile for Leak Sanitizer to find leaks. 101 # Compile for Leak Sanitizer to find leaks.
55 is_lsan = false 102 is_lsan = false
56 103
57 # Compile for Memory Sanitizer to find uninitialized reads. 104 # Compile for Memory Sanitizer to find uninitialized reads.
58 is_msan = false 105 is_msan = false
59 106
60 # Compile for Thread Sanitizer to find threading bugs. 107 # Compile for Thread Sanitizer to find threading bugs.
61 is_tsan = false 108 is_tsan = false
62 109
63 if (os == "chromeos") { 110 if (current_os == "chromeos") {
64 # Allows the target toolchain to be injected as arguments. This is needed 111 # Allows the target toolchain to be injected as arguments. This is needed
65 # to support the CrOS build system which supports per-build-configuration 112 # to support the CrOS build system which supports per-build-configuration
66 # toolchains. 113 # toolchains.
67 cros_use_custom_toolchain = false 114 cros_use_custom_toolchain = false
68 } 115 }
69 116
70 # TODO(cjhopman): Make target_arch work for all platforms.
71
72 # Architecture of the target device. For Android builds, this will be equal to
73 # the cpu_arch of the default toolchain. When checking the CPU architecture
74 # for source files and build dependencies you should almost alway use cpu_arch
75 # instead. cpu_arch is the architecture of the current toolchain and allows
76 # cross-compiles (compiling the same target for multiple toolchains in the
77 # same build) to work.
78 target_arch = "arm"
79
80 # TODO(brettw) remove this flag (and therefore enable linking all targets) on 117 # TODO(brettw) remove this flag (and therefore enable linking all targets) on
81 # Windows when we have sufficient bot capacity. In the meantime, you can 118 # Windows when we have sufficient bot capacity. In the meantime, you can
82 # enable linking for local compiles. 119 # enable linking for local compiles.
83 link_chrome_on_windows = true 120 link_chrome_on_windows = true
84 } 121 }
85 122
123 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed.
124 assert(current_cpu == cpu_arch)
125 assert(current_os == os)
126
86 # ============================================================================= 127 # =============================================================================
87 # OS DEFINITIONS 128 # OS DEFINITIONS
88 # ============================================================================= 129 # =============================================================================
89 # 130 #
90 # We set these various is_FOO booleans for convenience in writing OS-based 131 # We set these various is_FOO booleans for convenience in writing OS-based
91 # conditions. 132 # conditions.
92 # 133 #
93 # - is_android, is_chromeos, is_ios, and is_win should be obvious. 134 # - is_android, is_chromeos, is_ios, and is_win should be obvious.
94 # - is_mac is set only for desktop Mac. It is not set on iOS. 135 # - is_mac is set only for desktop Mac. It is not set on iOS.
95 # - is_posix is true for mac and any Unix-like system (basically everything 136 # - is_posix is true for mac and any Unix-like system (basically everything
96 # except Windows). 137 # except Windows).
97 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is 138 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is
98 # generally too different despite being based on the Linux kernel). 139 # generally too different despite being based on the Linux kernel).
99 # 140 #
100 # Do not add more is_* variants here for random lesser-used Unix systems like 141 # Do not add more is_* variants here for random lesser-used Unix systems like
101 # aix or one of the BSDs. If you need to check these, just check the os value 142 # aix or one of the BSDs. If you need to check these, just check the
102 # directly. 143 # current_os value directly.
103 144
104 if (os == "win") { 145 if (current_os == "win") {
105 is_android = false 146 is_android = false
106 is_chromeos = false 147 is_chromeos = false
107 is_ios = false 148 is_ios = false
108 is_linux = false 149 is_linux = false
109 is_mac = false 150 is_mac = false
110 is_nacl = false 151 is_nacl = false
111 is_posix = false 152 is_posix = false
112 is_win = true 153 is_win = true
113 } else if (os == "mac") { 154 } else if (current_os == "mac") {
114 is_android = false 155 is_android = false
115 is_chromeos = false 156 is_chromeos = false
116 is_ios = false 157 is_ios = false
117 is_linux = false 158 is_linux = false
118 is_mac = true 159 is_mac = true
119 is_nacl = false 160 is_nacl = false
120 is_posix = true 161 is_posix = true
121 is_win = false 162 is_win = false
122 } else if (os == "android") { 163 } else if (current_os == "android") {
123 is_android = true 164 is_android = true
124 is_chromeos = false 165 is_chromeos = false
125 is_ios = false 166 is_ios = false
126 is_linux = false 167 is_linux = false
127 is_mac = false 168 is_mac = false
128 is_nacl = false 169 is_nacl = false
129 is_posix = true 170 is_posix = true
130 is_win = false 171 is_win = false
131 } else if (os == "chromeos") { 172 } else if (current_os == "chromeos") {
132 is_android = false 173 is_android = false
133 is_chromeos = true 174 is_chromeos = true
134 is_ios = false 175 is_ios = false
135 is_linux = true 176 is_linux = true
136 is_mac = false 177 is_mac = false
137 is_nacl = false 178 is_nacl = false
138 is_posix = true 179 is_posix = true
139 is_win = false 180 is_win = false
140 } else if (os == "nacl") { 181 } else if (current_os == "nacl") {
141 # os == "nacl" will be passed by the nacl toolchain definition. It is not 182 # current_os == "nacl" will be passed by the nacl toolchain definition.
142 # set by default or on the command line. We treat is as a Posix variant. 183 # It is not set by default or on the command line. We treat is as a
184 # Posix variant.
143 is_android = false 185 is_android = false
144 is_chromeos = false 186 is_chromeos = false
145 is_ios = false 187 is_ios = false
146 is_linux = false 188 is_linux = false
147 is_mac = false 189 is_mac = false
148 is_nacl = true 190 is_nacl = true
149 is_posix = true 191 is_posix = true
150 is_win = false 192 is_win = false
151 } else if (os == "ios") { 193 } else if (current_os == "ios") {
152 is_android = false 194 is_android = false
153 is_chromeos = false 195 is_chromeos = false
154 is_ios = true 196 is_ios = true
155 is_linux = false 197 is_linux = false
156 is_mac = false 198 is_mac = false
157 is_nacl = false 199 is_nacl = false
158 is_posix = true 200 is_posix = true
159 is_win = false 201 is_win = false
160 } else if (os == "linux") { 202 } else if (current_os == "linux") {
161 is_android = false 203 is_android = false
162 is_chromeos = false 204 is_chromeos = false
163 is_ios = false 205 is_ios = false
164 is_linux = true 206 is_linux = true
165 is_mac = false 207 is_mac = false
166 is_nacl = false 208 is_nacl = false
167 is_posix = true 209 is_posix = true
168 is_win = false 210 is_win = false
169 } 211 }
170 212
171 # ============================================================================= 213 # =============================================================================
172 # CPU ARCHITECTURE
173 # =============================================================================
174
175 if (is_android) {
176 # TODO(cjhopman): enable this assert once bots are updated to not set
177 # cpu_arch.
178 #assert(cpu_arch == build_cpu_arch, "Android device target architecture should
179 # be set with 'target_arch', not 'cpu_arch'")
180 cpu_arch = target_arch
181 }
182
183 # =============================================================================
184 # SOURCES FILTERS 214 # SOURCES FILTERS
185 # ============================================================================= 215 # =============================================================================
186 # 216 #
187 # These patterns filter out platform-specific files when assigning to the 217 # These patterns filter out platform-specific files when assigning to the
188 # sources variable. The magic variable |sources_assignment_filter| is applied 218 # sources variable. The magic variable |sources_assignment_filter| is applied
189 # to each assignment or appending to the sources variable and matches are 219 # to each assignment or appending to the sources variable and matches are
190 # automatcally removed. 220 # automatcally removed.
191 # 221 #
192 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path 222 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path
193 # boundary = end of string or slash) are supported, and the entire string 223 # boundary = end of string or slash) are supported, and the entire string
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 configs = _native_compiler_configs 464 configs = _native_compiler_configs
435 } 465 }
436 466
437 # Shared library defaults (also for components in component mode). 467 # Shared library defaults (also for components in component mode).
438 _shared_library_configs = 468 _shared_library_configs =
439 _native_compiler_configs + [ "//build/config:default_libs" ] 469 _native_compiler_configs + [ "//build/config:default_libs" ]
440 if (is_win) { 470 if (is_win) {
441 _shared_library_configs += _windows_linker_configs 471 _shared_library_configs += _windows_linker_configs
442 } else if (is_mac) { 472 } else if (is_mac) {
443 _shared_library_configs += [ "//build/config/mac:mac_dynamic_flags" ] 473 _shared_library_configs += [ "//build/config/mac:mac_dynamic_flags" ]
474 } else if (is_android) {
475 # Strip native JNI exports from shared libraries by default. Binaries that
476 # want this can remove this config.
477 _shared_library_configs +=
478 [ "//build/config/android:hide_native_jni_exports" ]
444 } 479 }
445 set_defaults("shared_library") { 480 set_defaults("shared_library") {
446 configs = _shared_library_configs 481 configs = _shared_library_configs
447 } 482 }
448 if (is_component_build) { 483 if (is_component_build) {
449 set_defaults("component") { 484 set_defaults("component") {
450 configs = _shared_library_configs 485 configs = _shared_library_configs
451 } 486 }
452 } 487 }
453 488
(...skipping 20 matching lines...) Expand all
474 # TOOLCHAIN SETUP 509 # TOOLCHAIN SETUP
475 # ============================================================================== 510 # ==============================================================================
476 # 511 #
477 # Here we set the default toolchain, as well as the variable host_toolchain 512 # Here we set the default toolchain, as well as the variable host_toolchain
478 # which will identify the toolchain corresponding to the local system when 513 # which will identify the toolchain corresponding to the local system when
479 # doing cross-compiles. When not cross-compiling, this will be the same as the 514 # doing cross-compiles. When not cross-compiling, this will be the same as the
480 # default toolchain. 515 # default toolchain.
481 516
482 if (is_win) { 517 if (is_win) {
483 # On windows we use the same toolchain for host and target by default. 518 # On windows we use the same toolchain for host and target by default.
484 # TODO(dpranke): rename the toolchains to x64 and x86 to match cpu_arch. 519 # TODO(dpranke): rename the toolchains to x64 and x86 to match current_cpu.
485 if (cpu_arch == "x64") { 520 if (current_cpu == "x64") {
486 host_toolchain = "//build/toolchain/win:64" 521 host_toolchain = "//build/toolchain/win:64"
487 } else if (cpu_arch == "x86") { 522 } else if (current_cpu == "x86") {
488 host_toolchain = "//build/toolchain/win:32" 523 host_toolchain = "//build/toolchain/win:32"
489 } 524 }
490 set_default_toolchain("$host_toolchain") 525 set_default_toolchain("$host_toolchain")
491 } else if (is_android) { 526 } else if (is_android) {
492 # Use clang for the x86/64 Linux host builds. 527 # Use clang for the x86/64 Linux host builds.
493 if (build_cpu_arch == "x86" || build_cpu_arch == "x64") { 528 if (host_cpu == "x86" || host_cpu == "x64") {
494 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" 529 host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
495 } else { 530 } else {
496 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" 531 host_toolchain = "//build/toolchain/linux:$host_cpu"
497 } 532 }
498 set_default_toolchain("//build/toolchain/android:$cpu_arch") 533 set_default_toolchain("//build/toolchain/android:$current_cpu")
499 } else if (is_linux) { 534 } else if (is_linux) {
500 if (is_clang) { 535 if (is_clang) {
501 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" 536 host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
502 set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch") 537 set_default_toolchain("//build/toolchain/linux:clang_$current_cpu")
503 } else { 538 } else {
504 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" 539 host_toolchain = "//build/toolchain/linux:$host_cpu"
505 set_default_toolchain("//build/toolchain/linux:$cpu_arch") 540 set_default_toolchain("//build/toolchain/linux:$current_cpu")
506 } 541 }
507 if (is_chromeos && cros_use_custom_toolchain) { 542 if (is_chromeos && cros_use_custom_toolchain) {
508 set_default_toolchain("//build/toolchain/cros:target") 543 set_default_toolchain("//build/toolchain/cros:target")
509 } 544 }
510 } else if (is_mac) { 545 } else if (is_mac) {
511 host_toolchain = "//build/toolchain/mac:clang" 546 host_toolchain = "//build/toolchain/mac:clang"
512 set_default_toolchain(host_toolchain) 547 set_default_toolchain(host_toolchain)
513 } else if (is_ios) { 548 } else if (is_ios) {
514 host_toolchain = "//build/toolchain/mac:host_clang" 549 host_toolchain = "//build/toolchain/mac:host_clang"
515 set_default_toolchain("//build/toolchain/mac:clang") 550 set_default_toolchain("//build/toolchain/mac:clang")
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 750 }
716 if (defined(invoker.testonly)) { 751 if (defined(invoker.testonly)) {
717 testonly = invoker.testonly 752 testonly = invoker.testonly
718 } 753 }
719 if (defined(invoker.visibility)) { 754 if (defined(invoker.visibility)) {
720 visibility = invoker.visibility 755 visibility = invoker.visibility
721 } 756 }
722 } 757 }
723 } 758 }
724 } 759 }
OLDNEW
« no previous file with comments | « build/config/BUILD.gn ('k') | build/config/allocator.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698