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 declare_args() { |
| 6 # The optimization level to use for debug builds. |
| 7 if (is_android) { |
| 8 # On Android we kind of optimize some things that don't affect debugging |
| 9 # much even when optimization is disabled to get the binary size down. |
| 10 debug_optimization_level = "s" |
| 11 } else { |
| 12 debug_optimization_level = "2" |
| 13 } |
| 14 } |
| 15 |
5 import("//build/config/android/config.gni") | 16 import("//build/config/android/config.gni") |
6 if (current_cpu == "arm") { | 17 if (current_cpu == "arm") { |
7 import("//build/config/arm.gni") | 18 import("//build/config/arm.gni") |
8 } | 19 } |
9 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 20 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
10 import("//build/config/mips.gni") | 21 import("//build/config/mips.gni") |
11 } | 22 } |
12 if (is_posix) { | 23 if (is_posix) { |
13 import("//build/config/gcc/gcc_version.gni") | 24 import("//build/config/gcc/gcc_version.gni") |
14 } | 25 } |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 747 } |
737 ldflags = common_optimize_on_ldflags | 748 ldflags = common_optimize_on_ldflags |
738 } | 749 } |
739 | 750 |
740 # Turn off optimizations. | 751 # Turn off optimizations. |
741 config("no_optimize") { | 752 config("no_optimize") { |
742 if (is_win) { | 753 if (is_win) { |
743 # The only difference on windows is that the inlining is less aggressive. | 754 # The only difference on windows is that the inlining is less aggressive. |
744 # (We accept the default level). Otherwise it is very slow. | 755 # (We accept the default level). Otherwise it is very slow. |
745 cflags = [ | 756 cflags = [ |
746 "/O2", # Do some optimizations. | 757 "/O${debug_optimization_level}", # Do some optimizations. |
747 "/Oy-", # Disable omitting frame pointers, must be after /O2. | 758 "/Oy-", # Disable omitting frame pointers, must be after /O2. |
748 ] | 759 ] |
749 } else if (is_android) { | 760 } else if (is_android) { |
750 # On Android we kind of optimize some things that don't affect debugging | 761 # On Android we kind of optimize some things that don't affect debugging |
751 # much even when optimization is disabled to get the binary size down. | 762 # much even when optimization is disabled to get the binary size down. |
752 cflags = [ | 763 cflags = [ |
753 "-Os", | 764 "-O${debug_optimization_level}", |
754 "-fdata-sections", | 765 "-fdata-sections", |
755 "-ffunction-sections", | 766 "-ffunction-sections", |
756 ] | 767 ] |
757 ldflags = common_optimize_on_ldflags | 768 ldflags = common_optimize_on_ldflags |
758 } else { | 769 } else { |
759 cflags = [ | 770 cflags = [ |
760 "-O2", | 771 "-O${debug_optimization_level}", |
761 "-fdata-sections", | 772 "-fdata-sections", |
762 "-ffunction-sections", | 773 "-ffunction-sections", |
763 ] | 774 ] |
764 } | 775 } |
765 } | 776 } |
766 | 777 |
767 # Symbols ---------------------------------------------------------------------- | 778 # Symbols ---------------------------------------------------------------------- |
768 | 779 |
769 config("symbols") { | 780 config("symbols") { |
770 if (is_win) { | 781 if (is_win) { |
771 import("//build/toolchain/goma.gni") | 782 import("//build/toolchain/goma.gni") |
772 if (use_goma) { | 783 if (use_goma) { |
773 cflags = [ "/Z7" ] # No PDB file | 784 cflags = [ "/Z7" ] # No PDB file |
774 } else { | 785 } else { |
775 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 786 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
776 } | 787 } |
777 ldflags = [ "/DEBUG" ] | 788 ldflags = [ "/DEBUG" ] |
778 } else { | 789 } else { |
779 cflags = [ | 790 cflags = [ |
780 "-g3", | 791 "-g3", |
781 "-ggdb3", | 792 "-ggdb3", |
782 ] | 793 ] |
783 } | 794 } |
784 } | 795 } |
OLD | NEW |