xref: /aosp_15_r20/external/perfetto/gn/standalone/android.gni (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15declare_args() {
16  android_api_level = 21
17  android_ndk_root = rebase_path("//buildtools/ndk")
18  _android_toolchain_version = "4.9"
19
20  if (host_os == "linux") {
21    android_host = "linux-x86_64"
22  } else if (host_os == "mac") {
23    android_host = "darwin-x86_64"
24  } else {
25    android_host = "UNSUPPORTED_ON_WINDOWS"
26  }
27}
28
29declare_args() {
30  android_llvm_dir = "$android_ndk_root/toolchains/llvm/prebuilt/$android_host"
31  android_clangrt_dir = "$android_llvm_dir/lib/clang/17/lib/linux"
32  android_compile_sysroot = "$android_llvm_dir/sysroot"
33
34  if (current_cpu == "x86") {
35    android_abi_target = "i686-linux-android"
36    android_llvm_arch = "i686"
37  } else if (current_cpu == "arm") {
38    android_abi_target = "arm-linux-androideabi"
39    android_llvm_arch = "arm"
40  } else if (current_cpu == "x64") {
41    android_abi_target = "x86_64-linux-android"
42    android_llvm_arch = "x86_64"
43  } else if (current_cpu == "arm64") {
44    android_abi_target = "aarch64-linux-android"
45    android_llvm_arch = "aarch64"
46  } else {
47    assert(false, "Need android libgcc support for this arch.")
48  }
49
50  if (current_cpu == "x86") {
51    android_app_abi = "x86"
52  } else if (current_cpu == "arm") {
53    android_app_abi = "armeabi-v7a"
54  } else if (current_cpu == "x64") {
55    android_app_abi = "x86_64"
56  } else if (current_cpu == "arm64") {
57    android_app_abi = "arm64-v8a"
58  } else {
59    assert(false, "Unknown ABI: " + current_cpu)
60  }
61}
62