| 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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 # -1 means auto-set (off in release, regular in debug). | 65 # -1 means auto-set (off in release, regular in debug). |
| 66 symbol_level = -1 | 66 symbol_level = -1 |
| 67 | 67 |
| 68 # Component build. | 68 # Component build. |
| 69 is_component_build = false | 69 is_component_build = false |
| 70 | 70 |
| 71 # Debug build. | 71 # Debug build. |
| 72 is_debug = true | 72 is_debug = true |
| 73 | 73 |
| 74 # Whether we're a traditional desktop unix. | 74 # Whether we're a traditional desktop unix. |
| 75 is_desktop_linux = os == "linux" && os != "chromeos" | 75 is_desktop_linux = current_os == "linux" && current_os != "chromeos" |
| 76 | 76 |
| 77 # Set to true when compiling with the Clang compiler. Typically this is used | 77 # Set to true when compiling with the Clang compiler. Typically this is used |
| 78 # to configure warnings. | 78 # to configure warnings. |
| 79 is_clang = os == "mac" || os == "ios" || os == "linux" || os == "chromeos" | 79 is_clang = current_os == "mac" || current_os == "ios" || |
| 80 current_os == "linux" || current_os == "chromeos" |
| 80 | 81 |
| 81 # Selects the desired build flavor. Official builds get additional | 82 # Selects the desired build flavor. Official builds get additional |
| 82 # processing to prepare for release. Normally you will want to develop and | 83 # processing to prepare for release. Normally you will want to develop and |
| 83 # test with this flag off. | 84 # test with this flag off. |
| 84 is_official_build = false | 85 is_official_build = false |
| 85 | 86 |
| 86 # Select the desired branding flavor. False means normal Chromium branding, | 87 # Select the desired branding flavor. False means normal Chromium branding, |
| 87 # true means official Google Chrome branding (requires extra Google-internal | 88 # true means official Google Chrome branding (requires extra Google-internal |
| 88 # resources). | 89 # resources). |
| 89 is_chrome_branded = false | 90 is_chrome_branded = false |
| 90 | 91 |
| 91 # Compile for Address Sanitizer to find memory bugs. | 92 # Compile for Address Sanitizer to find memory bugs. |
| 92 is_asan = false | 93 is_asan = false |
| 93 | 94 |
| 94 # Compile for Leak Sanitizer to find leaks. | 95 # Compile for Leak Sanitizer to find leaks. |
| 95 is_lsan = false | 96 is_lsan = false |
| 96 | 97 |
| 97 # Compile for Memory Sanitizer to find uninitialized reads. | 98 # Compile for Memory Sanitizer to find uninitialized reads. |
| 98 is_msan = false | 99 is_msan = false |
| 99 | 100 |
| 100 # Compile for Thread Sanitizer to find threading bugs. | 101 # Compile for Thread Sanitizer to find threading bugs. |
| 101 is_tsan = false | 102 is_tsan = false |
| 102 | 103 |
| 103 if (os == "chromeos") { | 104 if (current_os == "chromeos") { |
| 104 # Allows the target toolchain to be injected as arguments. This is needed | 105 # Allows the target toolchain to be injected as arguments. This is needed |
| 105 # to support the CrOS build system which supports per-build-configuration | 106 # to support the CrOS build system which supports per-build-configuration |
| 106 # toolchains. | 107 # toolchains. |
| 107 cros_use_custom_toolchain = false | 108 cros_use_custom_toolchain = false |
| 108 } | 109 } |
| 109 | 110 |
| 110 # TODO(cjhopman): Make target_arch work for all platforms. | 111 # TODO(dpranke): Replace target_arch with target_cpu. |
| 111 | 112 |
| 112 # Architecture of the target device. For Android builds, this will be equal to | 113 # Architecture of the target device. For Android builds, this will be |
| 113 # the cpu_arch of the default toolchain. When checking the CPU architecture | 114 # equal to the current_cpu of the default toolchain. When checking |
| 114 # for source files and build dependencies you should almost alway use cpu_arch | 115 # the CPU architecture for source files and build dependencies you |
| 115 # instead. cpu_arch is the architecture of the current toolchain and allows | 116 # should almost alway use current_cpu instead. current_cpu is the |
| 116 # cross-compiles (compiling the same target for multiple toolchains in the | 117 # architecture of the current toolchain and allows cross-compiles |
| 117 # same build) to work. | 118 # (compiling the same target for multiple toolchains in the same build) |
| 119 # to work. |
| 118 target_arch = "arm" | 120 target_arch = "arm" |
| 119 | 121 |
| 120 # TODO(brettw) remove this flag (and therefore enable linking all targets) on | 122 # TODO(brettw) remove this flag (and therefore enable linking all targets) on |
| 121 # Windows when we have sufficient bot capacity. In the meantime, you can | 123 # Windows when we have sufficient bot capacity. In the meantime, you can |
| 122 # enable linking for local compiles. | 124 # enable linking for local compiles. |
| 123 link_chrome_on_windows = true | 125 link_chrome_on_windows = true |
| 124 } | 126 } |
| 125 | 127 |
| 126 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed. | 128 # TODO(dpranke): Remove these asserts when os and cpu_arch are removed. |
| 127 assert(current_cpu == cpu_arch) | 129 assert(current_cpu == cpu_arch) |
| 128 assert(current_os == os) | 130 assert(current_os == os) |
| 129 | 131 |
| 130 # ============================================================================= | 132 # ============================================================================= |
| 131 # OS DEFINITIONS | 133 # OS DEFINITIONS |
| 132 # ============================================================================= | 134 # ============================================================================= |
| 133 # | 135 # |
| 134 # We set these various is_FOO booleans for convenience in writing OS-based | 136 # We set these various is_FOO booleans for convenience in writing OS-based |
| 135 # conditions. | 137 # conditions. |
| 136 # | 138 # |
| 137 # - is_android, is_chromeos, is_ios, and is_win should be obvious. | 139 # - is_android, is_chromeos, is_ios, and is_win should be obvious. |
| 138 # - is_mac is set only for desktop Mac. It is not set on iOS. | 140 # - is_mac is set only for desktop Mac. It is not set on iOS. |
| 139 # - is_posix is true for mac and any Unix-like system (basically everything | 141 # - is_posix is true for mac and any Unix-like system (basically everything |
| 140 # except Windows). | 142 # except Windows). |
| 141 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is | 143 # - is_linux is true for desktop Linux and ChromeOS, but not Android (which is |
| 142 # generally too different despite being based on the Linux kernel). | 144 # generally too different despite being based on the Linux kernel). |
| 143 # | 145 # |
| 144 # Do not add more is_* variants here for random lesser-used Unix systems like | 146 # Do not add more is_* variants here for random lesser-used Unix systems like |
| 145 # aix or one of the BSDs. If you need to check these, just check the os value | 147 # aix or one of the BSDs. If you need to check these, just check the |
| 146 # directly. | 148 # current_os value directly. |
| 147 | 149 |
| 148 if (os == "win") { | 150 if (current_os == "win") { |
| 149 is_android = false | 151 is_android = false |
| 150 is_chromeos = false | 152 is_chromeos = false |
| 151 is_ios = false | 153 is_ios = false |
| 152 is_linux = false | 154 is_linux = false |
| 153 is_mac = false | 155 is_mac = false |
| 154 is_nacl = false | 156 is_nacl = false |
| 155 is_posix = false | 157 is_posix = false |
| 156 is_win = true | 158 is_win = true |
| 157 } else if (os == "mac") { | 159 } else if (current_os == "mac") { |
| 158 is_android = false | 160 is_android = false |
| 159 is_chromeos = false | 161 is_chromeos = false |
| 160 is_ios = false | 162 is_ios = false |
| 161 is_linux = false | 163 is_linux = false |
| 162 is_mac = true | 164 is_mac = true |
| 163 is_nacl = false | 165 is_nacl = false |
| 164 is_posix = true | 166 is_posix = true |
| 165 is_win = false | 167 is_win = false |
| 166 } else if (os == "android") { | 168 } else if (current_os == "android") { |
| 167 is_android = true | 169 is_android = true |
| 168 is_chromeos = false | 170 is_chromeos = false |
| 169 is_ios = false | 171 is_ios = false |
| 170 is_linux = false | 172 is_linux = false |
| 171 is_mac = false | 173 is_mac = false |
| 172 is_nacl = false | 174 is_nacl = false |
| 173 is_posix = true | 175 is_posix = true |
| 174 is_win = false | 176 is_win = false |
| 175 } else if (os == "chromeos") { | 177 } else if (current_os == "chromeos") { |
| 176 is_android = false | 178 is_android = false |
| 177 is_chromeos = true | 179 is_chromeos = true |
| 178 is_ios = false | 180 is_ios = false |
| 179 is_linux = true | 181 is_linux = true |
| 180 is_mac = false | 182 is_mac = false |
| 181 is_nacl = false | 183 is_nacl = false |
| 182 is_posix = true | 184 is_posix = true |
| 183 is_win = false | 185 is_win = false |
| 184 } else if (os == "nacl") { | 186 } else if (current_os == "nacl") { |
| 185 # os == "nacl" will be passed by the nacl toolchain definition. It is not | 187 # current_os == "nacl" will be passed by the nacl toolchain definition. |
| 186 # set by default or on the command line. We treat is as a Posix variant. | 188 # It is not set by default or on the command line. We treat is as a |
| 189 # Posix variant. |
| 187 is_android = false | 190 is_android = false |
| 188 is_chromeos = false | 191 is_chromeos = false |
| 189 is_ios = false | 192 is_ios = false |
| 190 is_linux = false | 193 is_linux = false |
| 191 is_mac = false | 194 is_mac = false |
| 192 is_nacl = true | 195 is_nacl = true |
| 193 is_posix = true | 196 is_posix = true |
| 194 is_win = false | 197 is_win = false |
| 195 } else if (os == "ios") { | 198 } else if (current_os == "ios") { |
| 196 is_android = false | 199 is_android = false |
| 197 is_chromeos = false | 200 is_chromeos = false |
| 198 is_ios = true | 201 is_ios = true |
| 199 is_linux = false | 202 is_linux = false |
| 200 is_mac = false | 203 is_mac = false |
| 201 is_nacl = false | 204 is_nacl = false |
| 202 is_posix = true | 205 is_posix = true |
| 203 is_win = false | 206 is_win = false |
| 204 } else if (os == "linux") { | 207 } else if (current_os == "linux") { |
| 205 is_android = false | 208 is_android = false |
| 206 is_chromeos = false | 209 is_chromeos = false |
| 207 is_ios = false | 210 is_ios = false |
| 208 is_linux = true | 211 is_linux = true |
| 209 is_mac = false | 212 is_mac = false |
| 210 is_nacl = false | 213 is_nacl = false |
| 211 is_posix = true | 214 is_posix = true |
| 212 is_win = false | 215 is_win = false |
| 213 } | 216 } |
| 214 | 217 |
| 215 # ============================================================================= | 218 # ============================================================================= |
| 216 # CPU ARCHITECTURE | 219 # CPU ARCHITECTURE |
| 217 # ============================================================================= | 220 # ============================================================================= |
| 218 | 221 |
| 219 if (is_android) { | 222 if (is_android) { |
| 220 # TODO(cjhopman): enable this assert once bots are updated to not set | 223 # TODO(cjhopman): enable this assert once bots are updated to not set |
| 221 # cpu_arch. | 224 # current_cpu. |
| 222 #assert(cpu_arch == build_cpu_arch, "Android device target architecture should | 225 #assert(current_cpu == host_cpu, "Android device target architecture should |
| 223 # be set with 'target_arch', not 'cpu_arch'") | 226 # be set with 'target_arch', not 'current_cpu'") |
| 224 cpu_arch = target_arch | 227 current_cpu = target_arch |
| 225 } | 228 } |
| 226 | 229 |
| 227 # ============================================================================= | 230 # ============================================================================= |
| 228 # SOURCES FILTERS | 231 # SOURCES FILTERS |
| 229 # ============================================================================= | 232 # ============================================================================= |
| 230 # | 233 # |
| 231 # These patterns filter out platform-specific files when assigning to the | 234 # These patterns filter out platform-specific files when assigning to the |
| 232 # sources variable. The magic variable |sources_assignment_filter| is applied | 235 # sources variable. The magic variable |sources_assignment_filter| is applied |
| 233 # to each assignment or appending to the sources variable and matches are | 236 # to each assignment or appending to the sources variable and matches are |
| 234 # automatcally removed. | 237 # automatcally removed. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 # TOOLCHAIN SETUP | 526 # TOOLCHAIN SETUP |
| 524 # ============================================================================== | 527 # ============================================================================== |
| 525 # | 528 # |
| 526 # Here we set the default toolchain, as well as the variable host_toolchain | 529 # Here we set the default toolchain, as well as the variable host_toolchain |
| 527 # which will identify the toolchain corresponding to the local system when | 530 # which will identify the toolchain corresponding to the local system when |
| 528 # doing cross-compiles. When not cross-compiling, this will be the same as the | 531 # doing cross-compiles. When not cross-compiling, this will be the same as the |
| 529 # default toolchain. | 532 # default toolchain. |
| 530 | 533 |
| 531 if (is_win) { | 534 if (is_win) { |
| 532 # On windows we use the same toolchain for host and target by default. | 535 # On windows we use the same toolchain for host and target by default. |
| 533 # TODO(dpranke): rename the toolchains to x64 and x86 to match cpu_arch. | 536 # TODO(dpranke): rename the toolchains to x64 and x86 to match current_cpu. |
| 534 if (cpu_arch == "x64") { | 537 if (current_cpu == "x64") { |
| 535 host_toolchain = "//build/toolchain/win:64" | 538 host_toolchain = "//build/toolchain/win:64" |
| 536 } else if (cpu_arch == "x86") { | 539 } else if (current_cpu == "x86") { |
| 537 host_toolchain = "//build/toolchain/win:32" | 540 host_toolchain = "//build/toolchain/win:32" |
| 538 } | 541 } |
| 539 set_default_toolchain("$host_toolchain") | 542 set_default_toolchain("$host_toolchain") |
| 540 } else if (is_android) { | 543 } else if (is_android) { |
| 541 # Use clang for the x86/64 Linux host builds. | 544 # Use clang for the x86/64 Linux host builds. |
| 542 if (build_cpu_arch == "x86" || build_cpu_arch == "x64") { | 545 if (host_cpu == "x86" || host_cpu == "x64") { |
| 543 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" | 546 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| 544 } else { | 547 } else { |
| 545 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" | 548 host_toolchain = "//build/toolchain/linux:$host_cpu" |
| 546 } | 549 } |
| 547 set_default_toolchain("//build/toolchain/android:$cpu_arch") | 550 set_default_toolchain("//build/toolchain/android:$current_cpu") |
| 548 } else if (is_linux) { | 551 } else if (is_linux) { |
| 549 if (is_clang) { | 552 if (is_clang) { |
| 550 host_toolchain = "//build/toolchain/linux:clang_$build_cpu_arch" | 553 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" |
| 551 set_default_toolchain("//build/toolchain/linux:clang_$cpu_arch") | 554 set_default_toolchain("//build/toolchain/linux:clang_$current_cpu") |
| 552 } else { | 555 } else { |
| 553 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" | 556 host_toolchain = "//build/toolchain/linux:$host_cpu" |
| 554 set_default_toolchain("//build/toolchain/linux:$cpu_arch") | 557 set_default_toolchain("//build/toolchain/linux:$current_cpu") |
| 555 } | 558 } |
| 556 if (is_chromeos && cros_use_custom_toolchain) { | 559 if (is_chromeos && cros_use_custom_toolchain) { |
| 557 set_default_toolchain("//build/toolchain/cros:target") | 560 set_default_toolchain("//build/toolchain/cros:target") |
| 558 } | 561 } |
| 559 } else if (is_mac) { | 562 } else if (is_mac) { |
| 560 host_toolchain = "//build/toolchain/mac:clang" | 563 host_toolchain = "//build/toolchain/mac:clang" |
| 561 set_default_toolchain(host_toolchain) | 564 set_default_toolchain(host_toolchain) |
| 562 } else if (is_ios) { | 565 } else if (is_ios) { |
| 563 host_toolchain = "//build/toolchain/mac:host_clang" | 566 host_toolchain = "//build/toolchain/mac:host_clang" |
| 564 set_default_toolchain("//build/toolchain/mac:clang") | 567 set_default_toolchain("//build/toolchain/mac:clang") |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 767 } |
| 765 if (defined(invoker.testonly)) { | 768 if (defined(invoker.testonly)) { |
| 766 testonly = invoker.testonly | 769 testonly = invoker.testonly |
| 767 } | 770 } |
| 768 if (defined(invoker.visibility)) { | 771 if (defined(invoker.visibility)) { |
| 769 visibility = invoker.visibility | 772 visibility = invoker.visibility |
| 770 } | 773 } |
| 771 } | 774 } |
| 772 } | 775 } |
| 773 } | 776 } |
| OLD | NEW |