• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Logic separated out from config.gni so that it can be used by compiler.gni
6# without introducing a circular dependency.
7
8# NOTE: Because Chrome OS builds may depend on targets built with the Android
9# toolchain, this GNI file may be read and processed from within Chrome OS
10# toolchains. Checking |is_android| here would therefore be too restrictive.
11assert(is_android || is_chromeos)
12
13declare_args() {
14  # Adds intrumentation to each function. Writes a file with the order that
15  # functions are called at startup.
16  use_order_profiling = false
17
18  # Only effective if use_order_profiling = true. When this is true,
19  # instrumentation switches from startup profiling after a delay, and
20  # then waits for a devtools memory dump request to dump all
21  # profiling information. When false, the same delay is used to switch from
22  # startup, and then after a second delay all profiling information is dumped.
23  # See base::android::orderfile::StartDelayedDump for more information.
24  devtools_instrumentation_dumping = false
25
26  # Only effective if use_order_profiling = true. When this is true the call
27  # graph based instrumentation is used.
28  use_call_graph = false
29
30  # Build additional browser splits with HWASAN instrumentation enabled.
31  build_hwasan_splits = false
32
33  # This configuration has minimal coverage.
34  # Forces all APKs/bundles to be 64-bit only to improve build speed
35  # (no need to also build 32-bit library).
36  skip_secondary_abi_for_cq = false
37}
38
39assert(!devtools_instrumentation_dumping || use_order_profiling,
40       "devtools_instrumentation_dumping requires use_order_profiling")
41assert(!use_call_graph || use_order_profiling,
42       "use_call_graph requires use_order_profiling")
43
44if (current_cpu == "x86") {
45  android_app_abi = "x86"
46  android_abi_target = "i686-linux-android"
47} else if (current_cpu == "arm") {
48  import("//build/config/arm.gni")
49  if (arm_version < 7) {
50    android_app_abi = "armeabi"
51  } else {
52    android_app_abi = "armeabi-v7a"
53  }
54  android_abi_target = "arm-linux-androideabi"
55} else if (current_cpu == "mipsel") {
56  android_app_abi = "mips"
57  android_abi_target = "mipsel-linux-android"
58} else if (current_cpu == "x64") {
59  android_app_abi = "x86_64"
60
61  # Place holder for x64 support, not tested.
62  # TODO: Enable clang support for Android x64. http://crbug.com/539781
63  android_abi_target = "x86_64-linux-android"
64} else if (current_cpu == "arm64") {
65  android_app_abi = "arm64-v8a"
66  android_abi_target = "aarch64-linux-android"
67} else if (current_cpu == "mips64el") {
68  android_app_abi = "mips64"
69
70  # Place holder for mips64 support, not tested.
71  android_abi_target = "mips64el-linux-android"
72} else if (current_cpu == "riscv64") {
73  android_app_abi = "riscv64"
74
75  # Place holder for riscv64 support, not tested.
76  android_abi_target = "riscv64-linux-android"
77} else {
78  assert(false, "Unknown Android ABI: " + current_cpu)
79}
80
81if (target_cpu == "arm64" || target_cpu == "x64" || target_cpu == "mips64el" ||
82    target_cpu == "riscv64") {
83  android_64bit_target_cpu = true
84} else if (target_cpu == "arm" || target_cpu == "x86" ||
85           target_cpu == "mipsel") {
86  android_64bit_target_cpu = false
87} else {
88  assert(false, "Unknown target CPU: $target_cpu")
89}
90
91android_64bit_current_cpu = current_cpu == "arm64" || target_cpu == "x64" ||
92                            target_cpu == "mips64el" || current_cpu == "riscv64"
93
94# Do not define android_secondary_abi_cpu or android_app_secondary_abi for
95# target_cpu's that are 32-bit-only or 64-bit-only, as they are not used. The
96# presence of this variable may be used in conjunction with android_64bit_target_cpu
97# to identify target_cpu's that are 32-bit-only or 64-bit-only.
98if (target_cpu == "arm64") {
99  android_secondary_abi_cpu = "arm"
100  android_app_secondary_abi = "armeabi-v7a"
101} else if (target_cpu == "x64") {
102  android_secondary_abi_cpu = "x86"
103  android_app_secondary_abi = "x86"
104} else if (target_cpu == "mips64el") {
105  android_secondary_abi_cpu = "mipsel"
106  android_app_secondary_abi = "mips"
107}
108
109if (defined(android_secondary_abi_cpu)) {
110  android_secondary_abi_toolchain =
111      "//build/toolchain/android:android_clang_${android_secondary_abi_cpu}"
112}
113