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/lib64/clang/9.0.9/lib/linux" 32 android_compile_sysroot = "$android_ndk_root/sysroot/usr/include" 33 34 if (current_cpu == "x86") { 35 android_abi_target = "i686-linux-android" 36 android_compile_sysroot_subdir = "i686-linux-android" 37 android_link_sysroot_subdir = 38 "platforms/android-${android_api_level}/arch-x86" 39 android_prebuilt_arch = "android-x86" 40 android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/$android_host" 41 android_llvm_arch = "i686" 42 } else if (current_cpu == "arm") { 43 android_abi_target = "arm-linux-androideabi" 44 android_compile_sysroot_subdir = "arm-linux-androideabi" 45 android_link_sysroot_subdir = 46 "platforms/android-${android_api_level}/arch-arm" 47 android_prebuilt_arch = "android-arm" 48 android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/$android_host" 49 android_llvm_arch = "arm" 50 } else if (current_cpu == "x64") { 51 android_abi_target = "x86_64-linux-android" 52 android_compile_sysroot_subdir = "x86_64-linux-android" 53 android_link_sysroot_subdir = 54 "platforms/android-${android_api_level}/arch-x86_64" 55 android_prebuilt_arch = "android-x86_64" 56 android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/$android_host" 57 android_llvm_arch = "x86_64" 58 } else if (current_cpu == "arm64") { 59 android_abi_target = "aarch64-linux-android" 60 android_compile_sysroot_subdir = "aarch64-linux-android" 61 android_link_sysroot_subdir = 62 "platforms/android-${android_api_level}/arch-arm64" 63 android_prebuilt_arch = "android-arm64" 64 android_toolchain_root = "$android_ndk_root/toolchains/aarch64-linux-android-${_android_toolchain_version}/prebuilt/$android_host" 65 android_llvm_arch = "aarch64" 66 } else { 67 assert(false, "Need android libgcc support for this arch.") 68 } 69 70 if (current_cpu == "x86") { 71 android_app_abi = "x86" 72 } else if (current_cpu == "arm") { 73 android_app_abi = "armeabi-v7a" 74 } else if (current_cpu == "x64") { 75 android_app_abi = "x86_64" 76 } else if (current_cpu == "arm64") { 77 android_app_abi = "arm64-v8a" 78 } else { 79 assert(false, "Unknown ABI: " + current_cpu) 80 } 81} 82