blob: 76037aa4f8b1a97afce4a321fd655c11f9b03fd5 [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# 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 assert(false, "Need Android toolchain support for your build OS.")
26 }
27}
28
29declare_args() {
Primiano Tucci0825bc82017-09-28 18:50:23 +010030 android_llvm_dir = "$android_ndk_root/toolchains/llvm/prebuilt/$android_host"
31 android_clangrt_dir = "$android_llvm_dir/lib64/clang/5.0/lib/linux"
Primiano Tuccib45bfac2017-11-28 14:37:48 +000032 android_compile_sysroot = "$android_ndk_root/sysroot/usr/include"
Primiano Tucci0825bc82017-09-28 18:50:23 +010033
Primiano Tucciae2879e2017-09-27 11:02:09 +090034 if (current_cpu == "x86") {
35 android_abi_target = "i686-linux-androideabi"
Primiano Tuccib45bfac2017-11-28 14:37:48 +000036 android_compile_sysroot_subdir = "i686-linux-android"
37 android_link_sysroot_subdir =
38 "platforms/android-${android_api_level}/arch-x86"
Primiano Tucciae2879e2017-09-27 11:02:09 +090039 android_prebuilt_arch = "android-x86"
40 android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/$android_host"
Primiano Tucci0825bc82017-09-28 18:50:23 +010041 android_llvm_arch = "i686"
Primiano Tucciae2879e2017-09-27 11:02:09 +090042 } else if (current_cpu == "arm") {
43 android_abi_target = "arm-linux-androideabi"
Primiano Tuccib45bfac2017-11-28 14:37:48 +000044 android_compile_sysroot_subdir = "arm-linux-androideabi"
45 android_link_sysroot_subdir =
46 "platforms/android-${android_api_level}/arch-arm"
Primiano Tucciae2879e2017-09-27 11:02:09 +090047 android_prebuilt_arch = "android-arm"
48 android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/$android_host"
Primiano Tucci0825bc82017-09-28 18:50:23 +010049 android_llvm_arch = "arm"
Primiano Tucciae2879e2017-09-27 11:02:09 +090050 } else if (current_cpu == "x64") {
Primiano Tuccia6a5fab2017-12-21 20:51:14 +010051 android_abi_target = "x86_64-linux-android"
Primiano Tuccib45bfac2017-11-28 14:37:48 +000052 android_compile_sysroot_subdir = "x86_64-linux-android"
53 android_link_sysroot_subdir =
Primiano Tucci0825bc82017-09-28 18:50:23 +010054 "platforms/android-${android_api_level}/arch-x86_64"
Primiano Tucciae2879e2017-09-27 11:02:09 +090055 android_prebuilt_arch = "android-x86_64"
56 android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/$android_host"
Primiano Tucci0825bc82017-09-28 18:50:23 +010057 android_llvm_arch = "x86_64"
Primiano Tucciae2879e2017-09-27 11:02:09 +090058 } else if (current_cpu == "arm64") {
59 android_abi_target = "aarch64-linux-android"
Primiano Tuccib45bfac2017-11-28 14:37:48 +000060 android_compile_sysroot_subdir = "aarch64-linux-android"
61 android_link_sysroot_subdir =
62 "platforms/android-${android_api_level}/arch-arm64"
Primiano Tucciae2879e2017-09-27 11:02:09 +090063 android_prebuilt_arch = "android-arm64"
64 android_toolchain_root = "$android_ndk_root/toolchains/aarch64-linux-android-${_android_toolchain_version}/prebuilt/$android_host"
Primiano Tucci0825bc82017-09-28 18:50:23 +010065 android_llvm_arch = "aarch64"
Primiano Tucciae2879e2017-09-27 11:02:09 +090066 } 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}