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 685 matching lines...) Loading... |
696 } else { | 696 } else { |
697 # Non-Mac Posix linker flags. | 697 # Non-Mac Posix linker flags. |
698 common_optimize_on_ldflags += [ | 698 common_optimize_on_ldflags += [ |
699 # Specifically tell the linker to perform optimizations. | 699 # Specifically tell the linker to perform optimizations. |
700 # See http://lwn.net/Articles/192624/ . | 700 # See http://lwn.net/Articles/192624/ . |
701 "-Wl,-O1", | 701 "-Wl,-O1", |
702 "-Wl,--as-needed", | 702 "-Wl,--as-needed", |
703 "-Wl,--gc-sections", | 703 "-Wl,--gc-sections", |
704 ] | 704 ] |
705 } | 705 } |
706 | |
707 if (is_android || is_ios) { | |
708 common_optimize_on_cflags += [ "-Os" ] | |
709 } else { | |
710 common_optimize_on_cflags += [ "-O2" ] | |
711 } | |
712 } | 706 } |
713 | 707 |
714 # Default "optimization on" config. On Windows, this favors size over speed. | 708 # Default "optimization on" config. On Windows, this favors size over speed. |
715 config("optimize") { | 709 config("optimize") { |
716 cflags = common_optimize_on_cflags | 710 cflags = common_optimize_on_cflags |
717 ldflags = common_optimize_on_ldflags | 711 ldflags = common_optimize_on_ldflags |
718 if (is_win) { | 712 if (is_win) { |
719 cflags += [ | 713 cflags += [ |
720 "/Os", # favor size over speed. | 714 "/Os", # favor size over speed. |
721 ] | 715 ] |
| 716 } else if (is_android || is_ios) { |
| 717 cflags += [ |
| 718 "-Os", # Favor size over speed. |
| 719 ] |
| 720 } else { |
| 721 cflags += [ |
| 722 "-O2", |
| 723 ] |
722 } | 724 } |
723 } | 725 } |
724 | 726 |
725 # Turn off optimizations. | 727 # Turn off optimizations. |
726 config("no_optimize") { | 728 config("no_optimize") { |
727 if (is_win) { | 729 if (is_win) { |
728 cflags = [ | 730 cflags = [ |
729 "/Od", # Disable optimization. | 731 "/Od", # Disable optimization. |
730 "/Ob0", # Disable all inlining (on by default). | 732 "/Ob0", # Disable all inlining (on by default). |
731 "/RTC1", # Runtime checks for stack frame and uninitialized variables. | 733 "/RTC1", # Runtime checks for stack frame and uninitialized variables. |
(...skipping 17 matching lines...) Loading... |
749 # optimization and link-time code generation which is very expensive and should | 751 # optimization and link-time code generation which is very expensive and should |
750 # be used sparingly. For non-Windows, this is the same as "optimize". | 752 # be used sparingly. For non-Windows, this is the same as "optimize". |
751 config("optimize_max") { | 753 config("optimize_max") { |
752 cflags = common_optimize_on_cflags | 754 cflags = common_optimize_on_cflags |
753 ldflags = common_optimize_on_ldflags | 755 ldflags = common_optimize_on_ldflags |
754 if (is_win) { | 756 if (is_win) { |
755 cflags += [ | 757 cflags += [ |
756 "/Ot", # Favor speed over size. | 758 "/Ot", # Favor speed over size. |
757 "/GL", # Whole program optimization. | 759 "/GL", # Whole program optimization. |
758 ] | 760 ] |
| 761 } else { |
| 762 cflags += [ |
| 763 "-O2", |
| 764 ] |
759 } | 765 } |
760 } | 766 } |
761 | 767 |
762 # Symbols ---------------------------------------------------------------------- | 768 # Symbols ---------------------------------------------------------------------- |
763 | 769 |
764 config("symbols") { | 770 config("symbols") { |
765 if (is_win) { | 771 if (is_win) { |
766 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 772 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
767 ldflags = [ "/DEBUG" ] | 773 ldflags = [ "/DEBUG" ] |
768 } else { | 774 } else { |
769 cflags = [ "-g2" ] | 775 cflags = [ "-g2" ] |
770 } | 776 } |
771 } | 777 } |
772 | 778 |
773 config("minimal_symbols") { | 779 config("minimal_symbols") { |
774 if (is_win) { | 780 if (is_win) { |
775 # Linker symbols for backtraces only. | 781 # Linker symbols for backtraces only. |
776 ldflags = [ "/DEBUG" ] | 782 ldflags = [ "/DEBUG" ] |
777 } else { | 783 } else { |
778 cflags = [ "-g1" ] | 784 cflags = [ "-g1" ] |
779 } | 785 } |
780 } | 786 } |
781 | 787 |
782 config("no_symbols") { | 788 config("no_symbols") { |
783 if (!is_win) { | 789 if (!is_win) { |
784 cflags = [ "-g0" ] | 790 cflags = [ "-g0" ] |
785 } | 791 } |
786 } | 792 } |
OLD | NEW |