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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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/sysroot.gni") 6 import("//build/config/sysroot.gni")
7 if (cpu_arch == "arm") { 7 if (cpu_arch == "arm") {
8 import("//build/config/arm.gni") 8 import("//build/config/arm.gni")
9 } 9 }
10 10
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 "-Wno-error=c++0x-compat", 574 "-Wno-error=c++0x-compat",
575 # Other things unrelated to -Wextra: 575 # Other things unrelated to -Wextra:
576 "-Wno-non-virtual-dtor", 576 "-Wno-non-virtual-dtor",
577 "-Wno-sign-promo", 577 "-Wno-sign-promo",
578 ] 578 ]
579 } 579 }
580 } 580 }
581 } 581 }
582 582
583 # Optimization ----------------------------------------------------------------- 583 # Optimization -----------------------------------------------------------------
584 #
585 # Note that BUILDCONFIG.gn sets up a variable "default_optimization_config"
586 # which it will assign to the config it implicitly applies to every target. If
587 # you want to override the optimization level for your target, remove this
588 # config (which will expand differently for debug or release builds), and then
589 # add back the one you want to override it with:
590 #
591 # configs -= default_optimization_config
592 # configs += [ "//build/config/compiler/optimize_max" ]
584 593
594 # Default "optimization on" config. On Windows, this favors size over speed.
595 #
596 # IF YOU CHANGE THIS also consider whether optimize_max should be updated.
585 config("optimize") { 597 config("optimize") {
586 if (is_win) { 598 if (is_win) {
587 cflags = [ 599 cflags = [
588 "/O2", 600 "/O2",
589 "/Ob2", # Both explicit and auto inlining. 601 "/Ob2", # Both explicit and auto inlining.
590 "/Oy-", # Disable omitting frame pointers, must be after /O2. 602 "/Oy-", # Disable omitting frame pointers, must be after /O2.
603 "/Os", # Favor size over speed.
591 ] 604 ]
592 } else { 605 } else {
593 if (is_ios) { 606 if (is_ios) {
594 cflags = [ "-Os" ] 607 cflags = [ "-Os" ]
595 } else { 608 } else {
596 cflags = [ "-O2" ] 609 cflags = [ "-O2" ]
597 } 610 }
598 } 611 }
599 } 612 }
600 613
614 # Turn off optimizations.
601 config("no_optimize") { 615 config("no_optimize") {
602 if (is_win) { 616 if (is_win) {
603 cflags = [ 617 cflags = [
604 "/Od", # Disable optimization. 618 "/Od", # Disable optimization.
605 "/Ob0", # Disable all inlining (on by default). 619 "/Ob0", # Disable all inlining (on by default).
606 "/RTC1", # Runtime checks for stack frame and uninitialized variables. 620 "/RTC1", # Runtime checks for stack frame and uninitialized variables.
607 ] 621 ]
608 } else { 622 } else {
609 cflags = [ "-O0" ] 623 cflags = [ "-O0" ]
610 } 624 }
611 } 625 }
612 626
627 # On Windows, turns up the optimization level. This implies whole program
628 # optimization and link-time code generation which is very expensive and should
629 # be used sparingly. For non-Windows, this is the same as "optimize".
630 config("optimize_max") {
631 if (is_win) {
632 cflags = [
633 "/O2",
634 "/Ob2", # Both explicit and auto inlining.
635 "/Oy-", # Disable omitting frame pointers, must be after /O2.
636 "/Ot", # Favor speed over size.
637 "/GL", # Whole program optimization.
638 ]
639 } else {
640 if (is_ios) {
641 cflags = [ "-Os" ]
642 } else {
643 cflags = [ "-O2" ]
644 }
645 }
646 }
647
613 # Symbols ---------------------------------------------------------------------- 648 # Symbols ----------------------------------------------------------------------
614 649
615 # TODO(brettw) Since this sets ldflags on Windows which is inherited across 650 # TODO(brettw) Since this sets ldflags on Windows which is inherited across
616 # static library boundaries, if you want to remove the default symbol config 651 # static library boundaries, if you want to remove the default symbol config
617 # and set a different one on a target, you also have to do it for all static 652 # and set a different one on a target, you also have to do it for all static
618 # libraries that go into that target, which is messed up. Either we need a 653 # libraries that go into that target, which is messed up. Either we need a
619 # more flexible system for defining linker flags, or we need to separate this 654 # more flexible system for defining linker flags, or we need to separate this
620 # out into a "symbols_linker" config that is only applied to DLLs and EXEs. 655 # out into a "symbols_linker" config that is only applied to DLLs and EXEs.
621 config("symbols") { 656 config("symbols") {
622 if (is_win) { 657 if (is_win) {
(...skipping 11 matching lines...) Expand all
634 } else { 669 } else {
635 cflags = [ "-g1" ] 670 cflags = [ "-g1" ]
636 } 671 }
637 } 672 }
638 673
639 config("no_symbols") { 674 config("no_symbols") {
640 if (!is_win) { 675 if (!is_win) {
641 cflags = [ "-g0" ] 676 cflags = [ "-g0" ]
642 } 677 }
643 } 678 }
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