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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 1397953002: GN: Fix NaCl IRT build options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nit Created 5 years, 2 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 | « no previous file | build/config/nacl/BUILD.gn » ('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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/nacl/config.gni")
8 import("//build/toolchain/ccache.gni") 9 import("//build/toolchain/ccache.gni")
9 10
10 if (current_cpu == "arm") { 11 if (current_cpu == "arm") {
11 import("//build/config/arm.gni") 12 import("//build/config/arm.gni")
12 } 13 }
13 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 14 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
14 import("//build/config/mips.gni") 15 import("//build/config/mips.gni")
15 } 16 }
16 if (is_posix) { 17 if (is_posix) {
17 import("//build/config/gcc/gcc_version.gni") 18 import("//build/config/gcc/gcc_version.gni")
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 121
121 # System-specific flags. If your compiler flags apply to one of the 122 # System-specific flags. If your compiler flags apply to one of the
122 # categories here, add it to the associated file to keep this shared config 123 # categories here, add it to the associated file to keep this shared config
123 # smaller. 124 # smaller.
124 if (is_win) { 125 if (is_win) {
125 configs += [ "//build/config/win:compiler" ] 126 configs += [ "//build/config/win:compiler" ]
126 } else if (is_android) { 127 } else if (is_android) {
127 configs += [ "//build/config/android:compiler" ] 128 configs += [ "//build/config/android:compiler" ]
128 } else if (is_linux) { 129 } else if (is_linux) {
129 configs += [ "//build/config/linux:compiler" ] 130 configs += [ "//build/config/linux:compiler" ]
131 } else if (is_nacl) {
132 configs += [ "//build/config/nacl:compiler" ]
130 } else if (is_ios || is_mac) { 133 } else if (is_ios || is_mac) {
131 configs += [ "//build/config/mac:compiler" ] 134 configs += [ "//build/config/mac:compiler" ]
132 } 135 }
133 136
134 # See the definitions below. 137 # See the definitions below.
135 configs += [ 138 configs += [
136 ":compiler_cpu_abi", 139 ":compiler_cpu_abi",
137 ":compiler_codegen", 140 ":compiler_codegen",
138 ] 141 ]
139 142
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 224
222 defines += [ "_FILE_OFFSET_BITS=64" ] 225 defines += [ "_FILE_OFFSET_BITS=64" ]
223 226
224 if (!is_android) { 227 if (!is_android) {
225 defines += [ 228 defines += [
226 "_LARGEFILE_SOURCE", 229 "_LARGEFILE_SOURCE",
227 "_LARGEFILE64_SOURCE", 230 "_LARGEFILE64_SOURCE",
228 ] 231 ]
229 } 232 }
230 233
231 # Omit unwind support in official builds to save space. We can use breakpad 234 if (!is_nacl) {
232 # for these builds. 235 # Omit unwind support in official builds to save space.
233 if (is_chrome_branded && is_official_build) { 236 # We can use breakpad for these builds.
234 cflags += [ 237 if (is_chrome_branded && is_official_build) {
235 "-fno-unwind-tables", 238 cflags += [
236 "-fno-asynchronous-unwind-tables", 239 "-fno-unwind-tables",
237 ] 240 "-fno-asynchronous-unwind-tables",
238 defines += [ "NO_UNWIND_TABLES" ] 241 ]
239 } else { 242 defines += [ "NO_UNWIND_TABLES" ]
240 cflags += [ "-funwind-tables" ] 243 } else {
244 cflags += [ "-funwind-tables" ]
245 }
241 } 246 }
242 } 247 }
243 248
244 # Linux/Android common flags setup. 249 # Linux/Android common flags setup.
245 # --------------------------------- 250 # ---------------------------------
246 if (is_linux || is_android) { 251 if (is_linux || is_android) {
247 cflags += [ 252 cflags += [
248 "-fPIC", 253 "-fPIC",
249 "-pipe", # Use pipes for communicating between sub-processes. Faster. 254 "-pipe", # Use pipes for communicating between sub-processes. Faster.
250 ] 255 ]
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 438 }
434 } 439 }
435 440
436 asmflags = cflags 441 asmflags = cflags
437 } 442 }
438 443
439 # This provides options to tweak code generation that are necessary 444 # This provides options to tweak code generation that are necessary
440 # for particular Chromium code or for working around particular 445 # for particular Chromium code or for working around particular
441 # compiler bugs (or the combination of the two). 446 # compiler bugs (or the combination of the two).
442 config("compiler_codegen") { 447 config("compiler_codegen") {
448 configs = []
443 cflags = [] 449 cflags = []
444 450
445 if (is_posix && !is_mac && !is_ios && !is_nacl) { 451 if (is_nacl) {
452 configs += [ "//build/config/nacl:compiler_codegen" ]
453 } else if (is_posix && !is_mac && !is_ios) {
446 if (current_cpu == "x86") { 454 if (current_cpu == "x86") {
447 if (is_clang) { 455 if (is_clang) {
448 cflags += [ 456 cflags += [
449 # Else building libyuv gives clang's register allocator issues, 457 # Else building libyuv gives clang's register allocator issues,
450 # see llvm.org/PR15798 / crbug.com/233709 458 # see llvm.org/PR15798 / crbug.com/233709
451 "-momit-leaf-frame-pointer", 459 "-momit-leaf-frame-pointer",
452 460
453 # Align the stack on 16-byte boundaries, http://crbug.com/418554. 461 # Align the stack on 16-byte boundaries, http://crbug.com/418554.
454 "-mstack-alignment=16", 462 "-mstack-alignment=16",
455 "-mstackrealign", 463 "-mstackrealign",
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } else { 1056 } else {
1049 cflags = [ "-O0" ] 1057 cflags = [ "-O0" ]
1050 ldflags = [] 1058 ldflags = []
1051 } 1059 }
1052 } 1060 }
1053 1061
1054 # Turns up the optimization level. On Windows, this implies whole program 1062 # Turns up the optimization level. On Windows, this implies whole program
1055 # optimization and link-time code generation which is very expensive and should 1063 # optimization and link-time code generation which is very expensive and should
1056 # be used sparingly. 1064 # be used sparingly.
1057 config("optimize_max") { 1065 config("optimize_max") {
1058 ldflags = common_optimize_on_ldflags 1066 if (is_nacl_irt) {
1059 if (is_win) { 1067 # The NaCl IRT is a special case and always wants its own config.
1060 # Favor speed over size, /O2 must be before the common flags. The GYP 1068 # Various components do:
1061 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. 1069 # if (!is_debug) {
1062 cflags = [ "/O2" ] + common_optimize_on_cflags 1070 # configs -= [ "//build/config/compiler:default_optimization" ]
1063 if (is_official_build) { 1071 # configs += [ "//build/config/compiler:optimize_max" ]
1064 # TODO(GYP): TODO(dpranke): Should these only be on in an official 1072 # }
1065 # build, or on all the time? For now we'll require official build so 1073 # So this config has to have the selection logic just like
1066 # that the compile is clean. 1074 # "default_optimization", below.
1067 cflags += [ 1075 configs = [ "//build/config/nacl:irt_optimize" ]
1068 "/GL", # Whole program optimization. 1076 } else {
1077 ldflags = common_optimize_on_ldflags
1078 if (is_win) {
1079 # Favor speed over size, /O2 must be before the common flags. The GYP
1080 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2.
1081 cflags = [ "/O2" ] + common_optimize_on_cflags
1082 if (is_official_build) {
1083 # TODO(GYP): TODO(dpranke): Should these only be on in an official
1084 # build, or on all the time? For now we'll require official build so
1085 # that the compile is clean.
1086 cflags += [
1087 "/GL", # Whole program optimization.
1069 1088
1070 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. 1089 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
1071 # Probably anything that this would catch that wouldn't be caught in a 1090 # Probably anything that this would catch that wouldn't be caught in a
1072 # normal build isn't going to actually be a bug, so the incremental 1091 # normal build isn't going to actually be a bug, so the incremental
1073 # value of C4702 for PGO builds is likely very small. 1092 # value of C4702 for PGO builds is likely very small.
1074 "/wd4702", 1093 "/wd4702",
1075 ] 1094 ]
1095 }
1096 } else {
1097 cflags = [ "-O2" ] + common_optimize_on_cflags
1076 } 1098 }
1077 } else {
1078 cflags = [ "-O2" ] + common_optimize_on_cflags
1079 } 1099 }
1080 } 1100 }
1081 1101
1082 # The default optimization applied to all targets. This will be equivalent to 1102 # The default optimization applied to all targets. This will be equivalent to
1083 # either "optimize" or "no_optimize", depending on the build flags. 1103 # either "optimize" or "no_optimize", depending on the build flags.
1084 config("default_optimization") { 1104 config("default_optimization") {
1085 if (is_debug) { 1105 if (is_nacl_irt) {
1106 # The NaCl IRT is a special case and always wants its own config.
1107 # It gets optimized the same way regardless of the type of build.
1108 configs = [ "//build/config/nacl:irt_optimize" ]
1109 } else if (is_debug) {
1086 configs = [ ":no_optimize" ] 1110 configs = [ ":no_optimize" ]
1087 } else { 1111 } else {
1088 configs = [ ":optimize" ] 1112 configs = [ ":optimize" ]
1089 } 1113 }
1090 } 1114 }
1091 1115
1092 # Symbols ---------------------------------------------------------------------- 1116 # Symbols ----------------------------------------------------------------------
1093 1117
1094 # The BUILDCONFIG file sets the "default_symbols" config on targets by 1118 # The BUILDCONFIG file sets the "default_symbols" config on targets by
1095 # default. It will be equivalent to one the three specific symbol levels. 1119 # default. It will be equivalent to one the three specific symbol levels.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 if (symbol_level == 0) { 1187 if (symbol_level == 0) {
1164 configs = [ ":no_symbols" ] 1188 configs = [ ":no_symbols" ]
1165 } else if (symbol_level == 1) { 1189 } else if (symbol_level == 1) {
1166 configs = [ ":minimal_symbols" ] 1190 configs = [ ":minimal_symbols" ]
1167 } else if (symbol_level == 2) { 1191 } else if (symbol_level == 2) {
1168 configs = [ ":symbols" ] 1192 configs = [ ":symbols" ]
1169 } else { 1193 } else {
1170 assert(false) 1194 assert(false)
1171 } 1195 }
1172 } 1196 }
OLDNEW
« no previous file with comments | « no previous file | build/config/nacl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698