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

Unified Diff: build/config/compiler/BUILD.gn

Issue 138903002: Add a config for max optimizations in the GN build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index cc95d62fee6ad76d2799a67e837c52ed3f262916..e82dd50f9eaf13bc657299c1134b0eca96f3066d 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -581,13 +581,26 @@ config("default_warnings") {
}
# Optimization -----------------------------------------------------------------
+#
+# Note that BUILDCONFIG.gn sets up a variable "default_optimization_config"
+# which it will assign to the config it implicitly applies to every target. If
+# you want to override the optimization level for your target, remove this
+# config (which will expand differently for debug or release builds), and then
+# add back the one you want to override it with:
+#
+# configs -= default_optimization_config
+# configs += [ "//build/config/compiler/optimize_max" ]
+# Default "optimization on" config. On Windows, this favors size over speed.
+#
+# IF YOU CHANGE THIS also consider whether optimize_max should be updated.
config("optimize") {
if (is_win) {
cflags = [
"/O2",
"/Ob2", # Both explicit and auto inlining.
"/Oy-", # Disable omitting frame pointers, must be after /O2.
+ "/Os", # Favor size over speed.
]
} else {
if (is_ios) {
@@ -598,6 +611,7 @@ config("optimize") {
}
}
+# Turn off optimizations.
config("no_optimize") {
if (is_win) {
cflags = [
@@ -610,6 +624,27 @@ config("no_optimize") {
}
}
+# On Windows, turns up the optimization level. This implies whole program
+# optimization and link-time code generation which is very expensive and should
+# be used sparingly. For non-Windows, this is the same as "optimize".
+config("optimize_max") {
+ if (is_win) {
+ cflags = [
+ "/O2",
+ "/Ob2", # Both explicit and auto inlining.
+ "/Oy-", # Disable omitting frame pointers, must be after /O2.
+ "/Ot", # Favor speed over size.
+ "/GL", # Whole program optimization.
+ ]
+ } else {
+ if (is_ios) {
+ cflags = [ "-Os" ]
+ } else {
+ cflags = [ "-O2" ]
+ }
+ }
+}
+
# Symbols ----------------------------------------------------------------------
# TODO(brettw) Since this sets ldflags on Windows which is inherited across
« 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