OLD | NEW |
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 if (cpu_arch == "arm") { | 6 if (cpu_arch == "arm") { |
7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
8 } | 8 } |
9 if (is_posix) { | 9 if (is_posix) { |
10 import("//build/config/gcc/gcc_version.gni") | 10 import("//build/config/gcc/gcc_version.gni") |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } else { | 686 } else { |
687 # Non-Mac Posix linker flags. | 687 # Non-Mac Posix linker flags. |
688 common_optimize_on_ldflags += [ | 688 common_optimize_on_ldflags += [ |
689 # Specifically tell the linker to perform optimizations. | 689 # Specifically tell the linker to perform optimizations. |
690 # See http://lwn.net/Articles/192624/ . | 690 # See http://lwn.net/Articles/192624/ . |
691 "-Wl,-O1", | 691 "-Wl,-O1", |
692 "-Wl,--as-needed", | 692 "-Wl,--as-needed", |
693 "-Wl,--gc-sections", | 693 "-Wl,--gc-sections", |
694 ] | 694 ] |
695 } | 695 } |
696 | |
697 if (is_android || is_ios) { | |
698 common_optimize_on_cflags += [ "-Os" ] | |
699 } else { | |
700 common_optimize_on_cflags += [ "-O2" ] | |
701 } | |
702 } | 696 } |
703 | 697 |
704 # Default "optimization on" config. On Windows, this favors size over speed. | 698 # Default "optimization on" config. On Windows, this favors size over speed. |
705 config("optimize") { | 699 config("optimize") { |
706 cflags = common_optimize_on_cflags | 700 cflags = common_optimize_on_cflags |
707 ldflags = common_optimize_on_ldflags | 701 ldflags = common_optimize_on_ldflags |
708 if (is_win) { | 702 if (is_win) { |
709 cflags += [ | 703 cflags += [ |
710 "/Os", # favor size over speed. | 704 "/Os", # favor size over speed. |
711 ] | 705 ] |
| 706 } else if (is_android || is_ios) { |
| 707 cflags += [ |
| 708 "-Os", # Favor size over speed. |
| 709 ] |
| 710 } else { |
| 711 cflags += [ |
| 712 "-O2", |
| 713 ] |
712 } | 714 } |
713 } | 715 } |
714 | 716 |
715 # Turn off optimizations. | 717 # Turn off optimizations. |
716 config("no_optimize") { | 718 config("no_optimize") { |
717 if (is_win) { | 719 if (is_win) { |
718 cflags = [ | 720 cflags = [ |
719 "/Od", # Disable optimization. | 721 "/Od", # Disable optimization. |
720 "/Ob0", # Disable all inlining (on by default). | 722 "/Ob0", # Disable all inlining (on by default). |
721 "/RTC1", # Runtime checks for stack frame and uninitialized variables. | 723 "/RTC1", # Runtime checks for stack frame and uninitialized variables. |
(...skipping 17 matching lines...) Expand all Loading... |
739 # optimization and link-time code generation which is very expensive and should | 741 # optimization and link-time code generation which is very expensive and should |
740 # be used sparingly. For non-Windows, this is the same as "optimize". | 742 # be used sparingly. For non-Windows, this is the same as "optimize". |
741 config("optimize_max") { | 743 config("optimize_max") { |
742 cflags = common_optimize_on_cflags | 744 cflags = common_optimize_on_cflags |
743 ldflags = common_optimize_on_ldflags | 745 ldflags = common_optimize_on_ldflags |
744 if (is_win) { | 746 if (is_win) { |
745 cflags += [ | 747 cflags += [ |
746 "/Ot", # Favor speed over size. | 748 "/Ot", # Favor speed over size. |
747 "/GL", # Whole program optimization. | 749 "/GL", # Whole program optimization. |
748 ] | 750 ] |
| 751 } else { |
| 752 cflags += [ |
| 753 "-O2", |
| 754 ] |
749 } | 755 } |
750 } | 756 } |
751 | 757 |
752 # Symbols ---------------------------------------------------------------------- | 758 # Symbols ---------------------------------------------------------------------- |
753 | 759 |
754 config("symbols") { | 760 config("symbols") { |
755 if (is_win) { | 761 if (is_win) { |
756 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 762 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
757 ldflags = [ "/DEBUG" ] | 763 ldflags = [ "/DEBUG" ] |
758 } else { | 764 } else { |
759 cflags = [ "-g2" ] | 765 cflags = [ "-g2" ] |
760 } | 766 } |
761 } | 767 } |
762 | 768 |
763 config("minimal_symbols") { | 769 config("minimal_symbols") { |
764 if (is_win) { | 770 if (is_win) { |
765 # Linker symbols for backtraces only. | 771 # Linker symbols for backtraces only. |
766 ldflags = [ "/DEBUG" ] | 772 ldflags = [ "/DEBUG" ] |
767 } else { | 773 } else { |
768 cflags = [ "-g1" ] | 774 cflags = [ "-g1" ] |
769 } | 775 } |
770 } | 776 } |
771 | 777 |
772 config("no_symbols") { | 778 config("no_symbols") { |
773 if (!is_win) { | 779 if (!is_win) { |
774 cflags = [ "-g0" ] | 780 cflags = [ "-g0" ] |
775 } | 781 } |
776 } | 782 } |
OLD | NEW |