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 # ============================================================================= | 5 # ============================================================================= |
6 # BUILD FLAGS | 6 # BUILD FLAGS |
7 # ============================================================================= | 7 # ============================================================================= |
8 # | 8 # |
9 # This block lists input arguments to the build, along with their default | 9 # This block lists input arguments to the build, along with their default |
10 # values. GN requires listing them explicitly so it can validate input and have | 10 # values. GN requires listing them explicitly so it can validate input and have |
11 # a central place to manage the build flags. | 11 # a central place to manage the build flags. |
12 # | 12 # |
13 # If a value is specified on the command line, it will overwrite the defaults | 13 # If a value is specified on the command line, it will overwrite the defaults |
14 # given here, otherwise the default will be injected into the root scope. | 14 # given here, otherwise the default will be injected into the root scope. |
15 # | 15 # |
16 # KEEP IN ALPHABETICAL ORDER and write a good description for everything. | 16 # KEEP IN ALPHABETICAL ORDER and write a good description for everything. |
17 # Use "is_*" names for intrinsic platform descriptions and build modes, and | 17 # Use "is_*" names for intrinsic platform descriptions and build modes, and |
18 # "use_*" names for optional features libraries, and configurations. | 18 # "use_*" names for optional features libraries, and configurations. |
19 | 19 |
20 # TODO(dpranke): The os and cpu_arch variables exist for backwards | |
21 # compatibility and should be deleted once all of the build files and | |
22 # bots have been updated to use current_cpu/target_cpu and | |
23 # current_os/target_os instead. | |
24 | |
25 if (target_os == "") { | 20 if (target_os == "") { |
26 if (defined(os)) { | 21 target_os = host_os |
27 # If os is defined, it was set in an args file and needs to be | |
28 # used for backwards-compatibility. | |
29 target_os = os | |
30 } else { | |
31 target_os = host_os | |
32 } | |
33 } | 22 } |
34 | 23 |
35 if (target_cpu == "") { | 24 if (target_cpu == "") { |
36 if (defined(cpu_arch)) { | 25 if (target_os == "android") { |
37 # If cpu_arch is defined, it was set in an args file and needs to be | |
38 # used for backwards-compatibility. | |
39 target_cpu = cpu_arch | |
40 } else if (target_os == "android") { | |
41 # If we're building for Android, we should assume that we want to | 26 # If we're building for Android, we should assume that we want to |
42 # build for ARM by default, not the host_cpu (which is likely x64). | 27 # build for ARM by default, not the host_cpu (which is likely x64). |
43 # This allows us to not have to specify both target_os and target_cpu | 28 # This allows us to not have to specify both target_os and target_cpu |
44 # on the command line. | 29 # on the command line. |
45 target_cpu = "arm" | 30 target_cpu = "arm" |
46 } else { | 31 } else { |
47 target_cpu = host_cpu | 32 target_cpu = host_cpu |
48 } | 33 } |
49 } | 34 } |
50 | 35 |
51 if (current_cpu == "") { | 36 if (current_cpu == "") { |
52 current_cpu = target_cpu | 37 current_cpu = target_cpu |
53 } | 38 } |
54 if (current_os == "") { | 39 if (current_os == "") { |
55 current_os = target_os | 40 current_os = target_os |
56 } | 41 } |
57 | 42 |
58 declare_args() { | 43 declare_args() { |
59 # TODO(dpranke): These values are here for backwards compatibility and | |
60 # should be deleted when all of the builders and configs have been updated. | |
61 cpu_arch = target_cpu | |
62 os = target_os | |
63 build_cpu_arch = host_cpu | |
64 build_os = host_os | |
65 | |
66 # How many symbols to include in the build. This affects the performance of | 44 # How many symbols to include in the build. This affects the performance of |
67 # the build since the symbols are large and dealing with them is slow. | 45 # the build since the symbols are large and dealing with them is slow. |
68 # 2 means regular build with symbols. | 46 # 2 means regular build with symbols. |
69 # 1 means minimal symbols, usually enough for backtraces only. | 47 # 1 means minimal symbols, usually enough for backtraces only. |
70 # 0 means no symbols. | 48 # 0 means no symbols. |
71 # -1 means auto-set (off in release, regular in debug). | 49 # -1 means auto-set (off in release, regular in debug). |
72 symbol_level = -1 | 50 symbol_level = -1 |
73 | 51 |
74 # Component build. | 52 # Component build. |
75 is_component_build = false | 53 is_component_build = false |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 is_tsan = false | 86 is_tsan = false |
109 | 87 |
110 if (current_os == "chromeos") { | 88 if (current_os == "chromeos") { |
111 # Allows the target toolchain to be injected as arguments. This is needed | 89 # Allows the target toolchain to be injected as arguments. This is needed |
112 # to support the CrOS build system which supports per-build-configuration | 90 # to support the CrOS build system which supports per-build-configuration |
113 # toolchains. | 91 # toolchains. |
114 cros_use_custom_toolchain = false | 92 cros_use_custom_toolchain = false |
115 } | 93 } |
116 } | 94 } |
117 | 95 |
118 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed. | |
119 assert(current_cpu == cpu_arch) | |
120 assert(current_os == os) | |
121 | |
122 # ============================================================================= | 96 # ============================================================================= |
123 # OS DEFINITIONS | 97 # OS DEFINITIONS |
124 # ============================================================================= | 98 # ============================================================================= |
125 # | 99 # |
126 # We set these various is_FOO booleans for convenience in writing OS-based | 100 # We set these various is_FOO booleans for convenience in writing OS-based |
127 # conditions. | 101 # conditions. |
128 # | 102 # |
129 # - is_android, is_chromeos, is_ios, and is_win should be obvious. | 103 # - is_android, is_chromeos, is_ios, and is_win should be obvious. |
130 # - is_mac is set only for desktop Mac. It is not set on iOS. | 104 # - is_mac is set only for desktop Mac. It is not set on iOS. |
131 # - is_posix is true for mac and any Unix-like system (basically everything | 105 # - is_posix is true for mac and any Unix-like system (basically everything |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 506 } |
533 } else if (is_mac) { | 507 } else if (is_mac) { |
534 host_toolchain = "//build/toolchain/mac:clang" | 508 host_toolchain = "//build/toolchain/mac:clang" |
535 set_default_toolchain(host_toolchain) | 509 set_default_toolchain(host_toolchain) |
536 } else if (is_ios) { | 510 } else if (is_ios) { |
537 host_toolchain = "//build/toolchain/mac:host_clang" | 511 host_toolchain = "//build/toolchain/mac:host_clang" |
538 set_default_toolchain("//build/toolchain/mac:clang") | 512 set_default_toolchain("//build/toolchain/mac:clang") |
539 } else if (is_nacl) { | 513 } else if (is_nacl) { |
540 # TODO(GYP): This will need to change when we get NaCl working | 514 # TODO(GYP): This will need to change when we get NaCl working |
541 # on multiple platforms, but this whole block of code (how we define | 515 # on multiple platforms, but this whole block of code (how we define |
542 # host_toolchain) needs to be reworked regardless to key off of build_os | 516 # host_toolchain) needs to be reworked regardless to key off of host_os |
543 # and build_cpu_arch rather than the is_* variables. | 517 # and host_cpu rather than the is_* variables. |
544 host_toolchain = "//build/toolchain/linux:clang_x64" | 518 host_toolchain = "//build/toolchain/linux:clang_x64" |
545 } | 519 } |
546 | 520 |
547 # ============================================================================== | 521 # ============================================================================== |
548 # COMPONENT SETUP | 522 # COMPONENT SETUP |
549 # ============================================================================== | 523 # ============================================================================== |
550 | 524 |
551 # TODO(brettw) erase this once the built-in "component" function is removed. | 525 # TODO(brettw) erase this once the built-in "component" function is removed. |
552 if (is_component_build) { | 526 if (is_component_build) { |
553 component_mode = "shared_library" | 527 component_mode = "shared_library" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 718 } |
745 if (defined(invoker.testonly)) { | 719 if (defined(invoker.testonly)) { |
746 testonly = invoker.testonly | 720 testonly = invoker.testonly |
747 } | 721 } |
748 if (defined(invoker.visibility)) { | 722 if (defined(invoker.visibility)) { |
749 visibility = invoker.visibility | 723 visibility = invoker.visibility |
750 } | 724 } |
751 } | 725 } |
752 } | 726 } |
753 } | 727 } |
OLD | NEW |