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

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

Issue 1183613006: 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 "/GF", # Enable string pooling.
scottmg 2015/06/16 20:07:48 looks like this is on by default for O1 and O2 too
brettw 2015/06/16 21:02:28 I'll remove it.
1099 "/Os", # favor size over speed.
1100 ] 1100 ]
1101 if (!is_asan) { 1101 if (!is_asan) {
1102 common_optimize_on_cflags += [ 1102 common_optimize_on_cflags += [
1103 # Put data in separate COMDATs. This allows the linker 1103 # Put data in separate COMDATs. This allows the linker
1104 # to put bit-identical constants at the same address even if 1104 # to put bit-identical constants at the same address even if
1105 # they're unrelated constants, which saves binary size. 1105 # they're unrelated constants, which saves binary size.
1106 # This optimization can't be used when ASan is enabled because 1106 # This optimization can't be used when ASan is enabled because
1107 # it is not compatible with the ASan ODR checker. 1107 # it is not compatible with the ASan ODR checker.
1108 "/Gw", 1108 "/Gw",
1109 ] 1109 ]
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 # Functions interposed by the sanitizers can make ld think 1155 # Functions interposed by the sanitizers can make ld think
1156 # that some libraries aren't needed when they actually are, 1156 # that some libraries aren't needed when they actually are,
1157 # http://crbug.com/234010. As workaround, disable --as-needed. 1157 # http://crbug.com/234010. As workaround, disable --as-needed.
1158 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] 1158 common_optimize_on_ldflags += [ "-Wl,--as-needed" ]
1159 } 1159 }
1160 } 1160 }
1161 } 1161 }
1162 1162
1163 # Default "optimization on" config. On Windows, this favors size over speed. 1163 # Default "optimization on" config. On Windows, this favors size over speed.
1164 config("optimize") { 1164 config("optimize") {
1165 cflags = common_optimize_on_cflags 1165 if (is_win) {
1166 # Favor size over speed, /O1 must be before the common flags. The GYP
1167 # build also specifies /Os but this is implied by /O1.
1168 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
1169 } else if (is_android || is_ios) {
1170 cflags += [ "-Os" ] + common_optimize_on_cflags # Favor size over speed.
1171 } else {
1172 cflags += [ "-O2" ] + common_optimize_on_cflags
1173 }
1166 ldflags = common_optimize_on_ldflags 1174 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 } 1175 }
1175 1176
1176 # Turn off optimizations. 1177 # Turn off optimizations.
1177 config("no_optimize") { 1178 config("no_optimize") {
1178 if (is_win) { 1179 if (is_win) {
1179 cflags = [ 1180 cflags = [
1180 "/Od", # Disable optimization. 1181 "/Od", # Disable optimization.
1181 "/Ob0", # Disable all inlining (on by default). 1182 "/Ob0", # Disable all inlining (on by default).
1182 "/RTC1", # Runtime checks for stack frame and uninitialized variables. 1183 "/RTC1", # Runtime checks for stack frame and uninitialized variables.
1183 ] 1184 ]
(...skipping 11 matching lines...) Expand all
1195 ldflags = common_optimize_on_ldflags 1196 ldflags = common_optimize_on_ldflags
1196 } else { 1197 } else {
1197 cflags = [ "-O0" ] 1198 cflags = [ "-O0" ]
1198 } 1199 }
1199 } 1200 }
1200 1201
1201 # Turns up the optimization level. On Windows, this implies whole program 1202 # Turns up the optimization level. On Windows, this implies whole program
1202 # optimization and link-time code generation which is very expensive and should 1203 # optimization and link-time code generation which is very expensive and should
1203 # be used sparingly. 1204 # be used sparingly.
1204 config("optimize_max") { 1205 config("optimize_max") {
1205 cflags = common_optimize_on_cflags
1206 ldflags = common_optimize_on_ldflags 1206 ldflags = common_optimize_on_ldflags
1207 if (is_win) { 1207 if (is_win) {
1208 cflags -= [ "/Os" ] 1208 # Favor speed over size, /O2 must be before the common flags. The GYP
1209 cflags += [ "/Ot" ] # Favor speed over size. 1209 # build also specifies /O2 and /Oi but these are implied by /O2.
1210 cflags = [ "/O2" ] + common_optimize_on_cflags
1210 if (is_official_build && !is_clang) { 1211 if (is_official_build && !is_clang) {
1211 # TODO(GYP): TODO(dpranke): Should these only be on in an official 1212 # 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 1213 # build, or on all the time? For now we'll require official build so
1213 # that the compile is clean. 1214 # that the compile is clean.
1214 # TODO(hans): Remove Clang special-case when it rolls past r239656. 1215 # TODO(hans): Remove Clang special-case when it rolls past r239656.
1215 cflags += [ 1216 cflags += [
1216 "/GL", # Whole program optimization. 1217 "/GL", # Whole program optimization.
1217 1218
1218 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. 1219 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
1219 # Probably anything that this would catch that wouldn't be caught in a 1220 # Probably anything that this would catch that wouldn't be caught in a
1220 # normal build isn't going to actually be a bug, so the incremental 1221 # normal build isn't going to actually be a bug, so the incremental
1221 # value of C4702 for PGO builds is likely very small. 1222 # value of C4702 for PGO builds is likely very small.
1222 "/wd4702", 1223 "/wd4702",
1223 ] 1224 ]
1224 ldflags += [ "/LTCG" ] 1225 ldflags += [ "/LTCG" ]
1225 } 1226 }
1226 } else { 1227 } else {
1227 cflags += [ "-O2" ] 1228 cflags = [ "-O2" ] + common_optimize_on_cflags
1228 } 1229 }
1229 } 1230 }
1230 1231
1231 # Symbols ---------------------------------------------------------------------- 1232 # Symbols ----------------------------------------------------------------------
1232 1233
1233 config("symbols") { 1234 config("symbols") {
1234 if (is_win) { 1235 if (is_win) {
1235 import("//build/toolchain/goma.gni") 1236 import("//build/toolchain/goma.gni")
1236 if (use_goma) { 1237 if (use_goma) {
1237 cflags = [ "/Z7" ] # No PDB file 1238 cflags = [ "/Z7" ] # No PDB file
(...skipping 19 matching lines...) Expand all
1257 cflags += [ "-gsplit-dwarf" ] 1258 cflags += [ "-gsplit-dwarf" ]
1258 } 1259 }
1259 } 1260 }
1260 } 1261 }
1261 1262
1262 config("no_symbols") { 1263 config("no_symbols") {
1263 if (!is_win) { 1264 if (!is_win) {
1264 cflags = [ "-g0" ] 1265 cflags = [ "-g0" ]
1265 } 1266 }
1266 } 1267 }
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