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

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

Issue 1184953004: Revert of Revert of Sync Windows build flags between GYP and GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « base/BUILD.gn ('k') | build/config/win/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 if (current_cpu == "arm") { 7 if (current_cpu == "arm") {
8 import("//build/config/arm.gni") 8 import("//build/config/arm.gni")
9 } 9 }
10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 # Note that BUILDCONFIG.gn sets up a variable "default_optimization_config" 1084 # Note that BUILDCONFIG.gn sets up a variable "default_optimization_config"
1085 # which it will assign to the config it implicitly applies to every target. If 1085 # which it will assign to the config it implicitly applies to every target. If
1086 # you want to override the optimization level for your target, remove this 1086 # you want to override the optimization level for your target, remove this
1087 # config (which will expand differently for debug or release builds), and then 1087 # config (which will expand differently for debug or release builds), and then
1088 # add back the one you want to override it with: 1088 # add back the one you want to override it with:
1089 # 1089 #
1090 # configs -= default_optimization_config 1090 # configs -= default_optimization_config
1091 # configs += [ "//build/config/compiler/optimize_max" ] 1091 # configs += [ "//build/config/compiler/optimize_max" ]
1092 1092
1093 # Shared settings for both "optimize" and "optimize_max" configs. 1093 # Shared settings for both "optimize" and "optimize_max" configs.
1094 # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
1094 if (is_win) { 1095 if (is_win) {
1095 common_optimize_on_cflags = [ 1096 common_optimize_on_cflags = [
1096 "/O2", 1097 "/Ob2", # Both explicit and auto inlining.
1097 "/Ob2", # both explicit and auto inlining. 1098 "/Oy-", # Disable omitting frame pointers, must be after /O2.
1098 "/Oy-", # disable omitting frame pointers, must be after /o2.
1099 "/Os", # favor size over speed.
1100 ] 1099 ]
1101 if (!is_asan) { 1100 if (!is_asan) {
1102 common_optimize_on_cflags += [ 1101 common_optimize_on_cflags += [
1103 # Put data in separate COMDATs. This allows the linker 1102 # Put data in separate COMDATs. This allows the linker
1104 # to put bit-identical constants at the same address even if 1103 # to put bit-identical constants at the same address even if
1105 # they're unrelated constants, which saves binary size. 1104 # they're unrelated constants, which saves binary size.
1106 # This optimization can't be used when ASan is enabled because 1105 # This optimization can't be used when ASan is enabled because
1107 # it is not compatible with the ASan ODR checker. 1106 # it is not compatible with the ASan ODR checker.
1108 "/Gw", 1107 "/Gw",
1109 ] 1108 ]
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 # Functions interposed by the sanitizers can make ld think 1154 # Functions interposed by the sanitizers can make ld think
1156 # that some libraries aren't needed when they actually are, 1155 # that some libraries aren't needed when they actually are,
1157 # http://crbug.com/234010. As workaround, disable --as-needed. 1156 # http://crbug.com/234010. As workaround, disable --as-needed.
1158 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] 1157 common_optimize_on_ldflags += [ "-Wl,--as-needed" ]
1159 } 1158 }
1160 } 1159 }
1161 } 1160 }
1162 1161
1163 # Default "optimization on" config. On Windows, this favors size over speed. 1162 # Default "optimization on" config. On Windows, this favors size over speed.
1164 config("optimize") { 1163 config("optimize") {
1165 cflags = common_optimize_on_cflags 1164 if (is_win) {
1165 # Favor size over speed, /O1 must be before the common flags. The GYP
1166 # build also specifies /Os and /GF but these are implied by /O1.
1167 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
1168 } else if (is_android || is_ios) {
1169 cflags = [ "-Os" ] + common_optimize_on_cflags # Favor size over speed.
1170 } else {
1171 cflags = [ "-O2" ] + common_optimize_on_cflags
1172 }
1166 ldflags = common_optimize_on_ldflags 1173 ldflags = common_optimize_on_ldflags
1167 if (is_win) {
1168 cflags += [ "/Os" ] # favor size over speed.
1169 } else if (is_android || is_ios) {
1170 cflags += [ "-Os" ] # Favor size over speed.
1171 } else {
1172 cflags += [ "-O2" ]
1173 }
1174 } 1174 }
1175 1175
1176 # Turn off optimizations. 1176 # Turn off optimizations.
1177 config("no_optimize") { 1177 config("no_optimize") {
1178 if (is_win) { 1178 if (is_win) {
1179 cflags = [ 1179 cflags = [
1180 "/Od", # Disable optimization. 1180 "/Od", # Disable optimization.
1181 "/Ob0", # Disable all inlining (on by default). 1181 "/Ob0", # Disable all inlining (on by default).
1182 "/RTC1", # Runtime checks for stack frame and uninitialized variables. 1182 "/RTC1", # Runtime checks for stack frame and uninitialized variables.
1183 ] 1183 ]
(...skipping 11 matching lines...) Expand all
1195 ldflags = common_optimize_on_ldflags 1195 ldflags = common_optimize_on_ldflags
1196 } else { 1196 } else {
1197 cflags = [ "-O0" ] 1197 cflags = [ "-O0" ]
1198 } 1198 }
1199 } 1199 }
1200 1200
1201 # Turns up the optimization level. On Windows, this implies whole program 1201 # Turns up the optimization level. On Windows, this implies whole program
1202 # optimization and link-time code generation which is very expensive and should 1202 # optimization and link-time code generation which is very expensive and should
1203 # be used sparingly. 1203 # be used sparingly.
1204 config("optimize_max") { 1204 config("optimize_max") {
1205 cflags = common_optimize_on_cflags
1206 ldflags = common_optimize_on_ldflags 1205 ldflags = common_optimize_on_ldflags
1207 if (is_win) { 1206 if (is_win) {
1208 cflags -= [ "/Os" ] 1207 # Favor speed over size, /O2 must be before the common flags. The GYP
1209 cflags += [ "/Ot" ] # Favor speed over size. 1208 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2.
1209 cflags = [ "/O2" ] + common_optimize_on_cflags
1210 if (is_official_build) { 1210 if (is_official_build) {
1211 # TODO(GYP): TODO(dpranke): Should these only be on in an official 1211 # TODO(GYP): TODO(dpranke): Should these only be on in an official
1212 # build, or on all the time? For now we'll require official build so 1212 # build, or on all the time? For now we'll require official build so
1213 # that the compile is clean. 1213 # that the compile is clean.
1214 cflags += [ 1214 cflags += [
1215 "/GL", # Whole program optimization. 1215 "/GL", # Whole program optimization.
1216 1216
1217 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. 1217 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
1218 # Probably anything that this would catch that wouldn't be caught in a 1218 # Probably anything that this would catch that wouldn't be caught in a
1219 # normal build isn't going to actually be a bug, so the incremental 1219 # normal build isn't going to actually be a bug, so the incremental
1220 # value of C4702 for PGO builds is likely very small. 1220 # value of C4702 for PGO builds is likely very small.
1221 "/wd4702", 1221 "/wd4702",
1222 ] 1222 ]
1223 ldflags += [ "/LTCG" ] 1223 ldflags += [ "/LTCG" ]
1224 } 1224 }
1225 } else { 1225 } else {
1226 cflags += [ "-O2" ] 1226 cflags = [ "-O2" ] + common_optimize_on_cflags
1227 } 1227 }
1228 } 1228 }
1229 1229
1230 # Symbols ---------------------------------------------------------------------- 1230 # Symbols ----------------------------------------------------------------------
1231 1231
1232 config("symbols") { 1232 config("symbols") {
1233 if (is_win) { 1233 if (is_win) {
1234 import("//build/toolchain/goma.gni") 1234 import("//build/toolchain/goma.gni")
1235 if (use_goma) { 1235 if (use_goma) {
1236 cflags = [ "/Z7" ] # No PDB file 1236 cflags = [ "/Z7" ] # No PDB file
(...skipping 19 matching lines...) Expand all
1256 cflags += [ "-gsplit-dwarf" ] 1256 cflags += [ "-gsplit-dwarf" ]
1257 } 1257 }
1258 } 1258 }
1259 } 1259 }
1260 1260
1261 config("no_symbols") { 1261 config("no_symbols") {
1262 if (!is_win) { 1262 if (!is_win) {
1263 cflags = [ "-g0" ] 1263 cflags = [ "-g0" ]
1264 } 1264 }
1265 } 1265 }
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | build/config/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698