| 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 if (target_os == "ios") { |
| 6 declare_args() { |
| 7 # If defined, then the build is a multi-architecture build (aka fat build) |
| 8 # and target_cpu must not be defined. Any value supported by target_cpu can |
| 9 # be used in this list. |
| 10 multi_arch_target_cpus = [] |
| 11 } |
| 12 } |
| 13 |
| 5 # ============================================================================= | 14 # ============================================================================= |
| 6 # PLATFORM SELECTION | 15 # PLATFORM SELECTION |
| 7 # ============================================================================= | 16 # ============================================================================= |
| 8 # | 17 # |
| 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name | 18 # There are two main things to set: "os" and "cpu". The "toolchain" is the name |
| 10 # of the GN thing that encodes combinations of these things. | 19 # of the GN thing that encodes combinations of these things. |
| 11 # | 20 # |
| 12 # Users typically only set the variables "target_os" and "target_cpu" in "gn | 21 # Users typically only set the variables "target_os" and "target_cpu" in "gn |
| 13 # args", the rest are set up by our build and internal to GN. | 22 # args", the rest are set up by our build and internal to GN. |
| 14 # | 23 # |
| (...skipping 23 matching lines...) Expand all Loading... |
| 38 target_os = host_os | 47 target_os = host_os |
| 39 } | 48 } |
| 40 | 49 |
| 41 if (target_cpu == "") { | 50 if (target_cpu == "") { |
| 42 if (target_os == "android") { | 51 if (target_os == "android") { |
| 43 # If we're building for Android, we should assume that we want to | 52 # If we're building for Android, we should assume that we want to |
| 44 # build for ARM by default, not the host_cpu (which is likely x64). | 53 # build for ARM by default, not the host_cpu (which is likely x64). |
| 45 # This allows us to not have to specify both target_os and target_cpu | 54 # This allows us to not have to specify both target_os and target_cpu |
| 46 # on the command line. | 55 # on the command line. |
| 47 target_cpu = "arm" | 56 target_cpu = "arm" |
| 57 } else if (target_os == "ios") { |
| 58 # If we're building for iOS, we respect the multi_arch_target_cpus if |
| 59 # it is defined. In that case, we pick the first architecture listed in |
| 60 # multi_arch_target_cpus and use it as target_cpu, the others will be |
| 61 # build as secondary toolchain by the ios_app_bundle target. |
| 62 if (multi_arch_target_cpus != []) { |
| 63 assert(target_cpu == "", |
| 64 "cannot define both multi_arch_target_cpus and target_cpu") |
| 65 target_cpu = multi_arch_target_cpus[0] |
| 66 } else { |
| 67 target_cpu = host_cpu |
| 68 } |
| 48 } else { | 69 } else { |
| 49 target_cpu = host_cpu | 70 target_cpu = host_cpu |
| 50 } | 71 } |
| 51 } | 72 } |
| 52 | 73 |
| 53 if (current_cpu == "") { | 74 if (current_cpu == "") { |
| 54 current_cpu = target_cpu | 75 current_cpu = target_cpu |
| 55 } | 76 } |
| 56 if (current_os == "") { | 77 if (current_os == "") { |
| 57 current_os = target_os | 78 current_os = target_os |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 # See comments in build/toolchain/cros/BUILD.gn about board compiles. | 228 # See comments in build/toolchain/cros/BUILD.gn about board compiles. |
| 208 assert(host_os == "linux", | 229 assert(host_os == "linux", |
| 209 "ChromeOS builds are only supported on Linux hosts.") | 230 "ChromeOS builds are only supported on Linux hosts.") |
| 210 if (is_clang) { | 231 if (is_clang) { |
| 211 _default_toolchain = "//build/toolchain/cros:clang_target" | 232 _default_toolchain = "//build/toolchain/cros:clang_target" |
| 212 } else { | 233 } else { |
| 213 _default_toolchain = "//build/toolchain/cros:target" | 234 _default_toolchain = "//build/toolchain/cros:target" |
| 214 } | 235 } |
| 215 } else if (target_os == "ios") { | 236 } else if (target_os == "ios") { |
| 216 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" | 237 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" |
| 238 assert(custom_toolchain == "" || multi_arch_target_cpus == [], |
| 239 "cannot define both multi_arch_target_cpus and custom_toolchain") |
| 240 |
| 241 # Initialize multi_arch_toolchains from multi_arch_target_cpus. The |
| 242 # list will not contain the default_toolchain and may be empty while |
| 243 # multi_arch_target_cpus is not. This allows the build to default to |
| 244 # regular build if multi_arch_target_cpus contains a single cpu. |
| 245 multi_arch_toolchains = [] |
| 246 foreach(_multi_arch_target_cpu, multi_arch_target_cpus) { |
| 247 if (_multi_arch_target_cpu != target_cpu) { |
| 248 multi_arch_toolchains += |
| 249 [ "//build/toolchain/mac:ios_clang_$_multi_arch_target_cpu" ] |
| 250 } |
| 251 } |
| 217 } else if (target_os == "linux") { | 252 } else if (target_os == "linux") { |
| 218 if (is_clang) { | 253 if (is_clang) { |
| 219 _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" | 254 _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" |
| 220 } else { | 255 } else { |
| 221 _default_toolchain = "//build/toolchain/linux:$target_cpu" | 256 _default_toolchain = "//build/toolchain/linux:$target_cpu" |
| 222 } | 257 } |
| 223 } else if (target_os == "mac") { | 258 } else if (target_os == "mac") { |
| 224 assert(host_os == "mac", "Mac cross-compiles are unsupported.") | 259 assert(host_os == "mac", "Mac cross-compiles are unsupported.") |
| 225 _default_toolchain = host_toolchain | 260 _default_toolchain = host_toolchain |
| 226 } else if (target_os == "win") { | 261 } else if (target_os == "win") { |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 forward_variables_from(invoker, "*", [ "visibility" ]) | 693 forward_variables_from(invoker, "*", [ "visibility" ]) |
| 659 | 694 |
| 660 # All shared libraries must have the sanitizer deps to properly link in | 695 # All shared libraries must have the sanitizer deps to properly link in |
| 661 # asan mode (this target will be empty in other cases). | 696 # asan mode (this target will be empty in other cases). |
| 662 if (!defined(deps)) { | 697 if (!defined(deps)) { |
| 663 deps = [] | 698 deps = [] |
| 664 } | 699 } |
| 665 deps += [ "//build/config/sanitizers:deps" ] | 700 deps += [ "//build/config/sanitizers:deps" ] |
| 666 } | 701 } |
| 667 } | 702 } |
| OLD | NEW |