Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 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 | |
| 15 | declare_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 | |
| 29 | declare_args() { |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 30 | 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 Tucci | b45bfac | 2017-11-28 14:37:48 +0000 | [diff] [blame] | 32 | android_compile_sysroot = "$android_ndk_root/sysroot/usr/include" |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 33 | |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 34 | if (current_cpu == "x86") { |
| 35 | android_abi_target = "i686-linux-androideabi" |
Primiano Tucci | b45bfac | 2017-11-28 14:37:48 +0000 | [diff] [blame] | 36 | android_compile_sysroot_subdir = "i686-linux-android" |
| 37 | android_link_sysroot_subdir = |
| 38 | "platforms/android-${android_api_level}/arch-x86" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 39 | android_prebuilt_arch = "android-x86" |
| 40 | android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/$android_host" |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 41 | android_llvm_arch = "i686" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 42 | } else if (current_cpu == "arm") { |
| 43 | android_abi_target = "arm-linux-androideabi" |
Primiano Tucci | b45bfac | 2017-11-28 14:37:48 +0000 | [diff] [blame] | 44 | android_compile_sysroot_subdir = "arm-linux-androideabi" |
| 45 | android_link_sysroot_subdir = |
| 46 | "platforms/android-${android_api_level}/arch-arm" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 47 | android_prebuilt_arch = "android-arm" |
| 48 | android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/$android_host" |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 49 | android_llvm_arch = "arm" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 50 | } else if (current_cpu == "x64") { |
Primiano Tucci | a6a5fab | 2017-12-21 20:51:14 +0100 | [diff] [blame] | 51 | android_abi_target = "x86_64-linux-android" |
Primiano Tucci | b45bfac | 2017-11-28 14:37:48 +0000 | [diff] [blame] | 52 | android_compile_sysroot_subdir = "x86_64-linux-android" |
| 53 | android_link_sysroot_subdir = |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 54 | "platforms/android-${android_api_level}/arch-x86_64" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 55 | android_prebuilt_arch = "android-x86_64" |
| 56 | android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/$android_host" |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 57 | android_llvm_arch = "x86_64" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 58 | } else if (current_cpu == "arm64") { |
| 59 | android_abi_target = "aarch64-linux-android" |
Primiano Tucci | b45bfac | 2017-11-28 14:37:48 +0000 | [diff] [blame] | 60 | android_compile_sysroot_subdir = "aarch64-linux-android" |
| 61 | android_link_sysroot_subdir = |
| 62 | "platforms/android-${android_api_level}/arch-arm64" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 63 | android_prebuilt_arch = "android-arm64" |
| 64 | android_toolchain_root = "$android_ndk_root/toolchains/aarch64-linux-android-${_android_toolchain_version}/prebuilt/$android_host" |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 65 | android_llvm_arch = "aarch64" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 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 | } |