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

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

Issue 1881193002: Add GN arg to optimize for size (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Move comment Created 4 years, 8 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 | no next file » | 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/config/nacl/config.gni")
9 import("//build/toolchain/cc_wrapper.gni") 9 import("//build/toolchain/cc_wrapper.gni")
10 import("//build/toolchain/toolchain.gni") 10 import("//build/toolchain/toolchain.gni")
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 msvs_xtree_patched = false 73 msvs_xtree_patched = false
74 } 74 }
75 75
76 # Omit unwind support in official builds to save space. 76 # Omit unwind support in official builds to save space.
77 # We can use breakpad for these builds. 77 # We can use breakpad for these builds.
78 exclude_unwind_tables = is_chrome_branded && is_official_build 78 exclude_unwind_tables = is_chrome_branded && is_official_build
79 79
80 # If true, gold linker will save symbol table inside object files. 80 # If true, gold linker will save symbol table inside object files.
81 # This speeds up gdb startup by 60% 81 # This speeds up gdb startup by 60%
82 gdb_index = false 82 gdb_index = false
83
84 # If true, optimize for size. Does not affect windows builds.
85 # Linux & Mac favor speed over size.
86 # TODO(brettw) it's weird that Mac and desktop Linux are different. We should
87 # explore favoring size over speed in this case as well.
88 optimize_for_size = is_android || is_ios
83 } 89 }
84 90
85 # Apply the default logic for these values if they were not set explicitly. 91 # Apply the default logic for these values if they were not set explicitly.
86 if (gold_path == false) { 92 if (gold_path == false) {
87 if (use_gold) { 93 if (use_gold) {
88 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", 94 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
89 root_build_dir) 95 root_build_dir)
90 } else { 96 } else {
91 gold_path = "" 97 gold_path = ""
92 } 98 }
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 } 1208 }
1203 } 1209 }
1204 } 1210 }
1205 1211
1206 # Default "optimization on" config. 1212 # Default "optimization on" config.
1207 config("optimize") { 1213 config("optimize") {
1208 if (is_win) { 1214 if (is_win) {
1209 # Favor size over speed, /O1 must be before the common flags. The GYP 1215 # Favor size over speed, /O1 must be before the common flags. The GYP
1210 # build also specifies /Os and /GF but these are implied by /O1. 1216 # build also specifies /Os and /GF but these are implied by /O1.
1211 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] 1217 cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
1212 } else if (is_android || is_ios) { 1218 } else if (optimize_for_size) {
1213 # Favor size over speed. 1219 # Favor size over speed.
1214 cflags = [ "-Os" ] + common_optimize_on_cflags 1220 cflags = [ "-Os" ] + common_optimize_on_cflags
1215 } else { 1221 } else {
1216 # Linux & Mac favor speed over size.
1217 # TODO(brettw) it's weird that Mac and desktop Linux are different. We shoul d
1218 # explore favoring size over speed in this case as well.
1219 cflags = [ "-O2" ] + common_optimize_on_cflags 1222 cflags = [ "-O2" ] + common_optimize_on_cflags
1220 } 1223 }
1221 ldflags = common_optimize_on_ldflags 1224 ldflags = common_optimize_on_ldflags
1222 } 1225 }
1223 1226
1224 # Turn off optimizations. 1227 # Turn off optimizations.
1225 config("no_optimize") { 1228 config("no_optimize") {
1226 if (is_win) { 1229 if (is_win) {
1227 cflags = [ 1230 cflags = [
1228 "/Od", # Disable optimization. 1231 "/Od", # Disable optimization.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1400
1398 if (is_ios || is_mac) { 1401 if (is_ios || is_mac) {
1399 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1402 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1400 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1403 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1401 config("enable_arc") { 1404 config("enable_arc") {
1402 common_flags = [ "-fobjc-arc" ] 1405 common_flags = [ "-fobjc-arc" ]
1403 cflags_objc = common_flags 1406 cflags_objc = common_flags
1404 cflags_objcc = common_flags 1407 cflags_objcc = common_flags
1405 } 1408 }
1406 } 1409 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698