# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. assert(is_android) import("abi.gni") # Get Android Env used to build Android Library. ANDROID_HOME = getenv("ANDROID_HOME") if (ANDROID_HOME == "") { assert( false, "Maybe you have not set up android development environment." + " Or some environment variable is named differently. Check, please!" + " Get set-up steps from https://gitee.com/ark_standalone_build/docs") } else { print("ANDROID_HOME=$ANDROID_HOME") } # Using a separate declare_args block for only these arguments, so that # we can decide if we have to pull in definitions from the internal config # early. declare_args() { # AOSP API level for 64 bits platforms aosp64_ndk_api_level = 29 } if (!defined(default_aosp_ndk_root)) { default_aosp_ndk_root = "${ANDROID_HOME}/ndk/21.3.6528147" default_aosp_ndk_major_version = 16 } else { assert(defined(default_aosp_ndk_major_version)) } declare_args() { aosp_ndk_root = default_aosp_ndk_root aosp_ndk_major_version = default_aosp_ndk_major_version # Libc++ library directory. Override to use a custom libc++ binary. aosp_libcpp_lib_dir = "" } # Defines the name the AOSP build gives to the current host CPU # architecture, which is different than the names GN uses. if (host_cpu == "x64") { aosp_host_arch = "x86_64" } else if (host_cpu == "x86") { aosp_host_arch = "x86" } else { assert(false, "Need AOSP toolchain support for your build CPU arch.") } # Defines the name the aosp build gives to the current host CPU # architecture, which is different than the names GN uses. if (host_os == "linux") { aosp_host_os = "linux" } else if (host_os == "mac") { aosp_host_os = "darwin" } else { assert(false, "Need AOSP toolchain support for your build OS.") } # Directories and files arm64_aosp_sysroot_subdir = "platforms/android-${aosp64_ndk_api_level}/arch-arm64" # # Toolchain root directory for each build. The actual binaries are inside # # a "bin" directory inside of these. _aosp_toolchain_version = "4.9" _aosp_toolchain_detailed_version = "4.9.x" arm64_aosp_toolchain_root = "$aosp_ndk_root/toolchains/aarch64-linux-android-${_aosp_toolchain_version}/prebuilt/${aosp_host_os}-${aosp_host_arch}" # Location of libgcc. This is only needed for the current GN toolchain, so we # only need to define the current one, rather than one for every platform # like the toolchain roots. if (current_cpu == "arm64") { aosp_prebuilt_arch = "android-arm64" _binary_prefix = "aarch64-linux-android" aosp_toolchain_root = "$arm64_aosp_toolchain_root" aosp_libgcc_file = "$aosp_toolchain_root/lib/gcc/aarch64-linux-android/${_aosp_toolchain_detailed_version}/libgcc.a" } aosp_libcpp_root = "$aosp_ndk_root/sources/cxx-stl/llvm-libc++" if (aosp_libcpp_lib_dir == "") { aosp_libcpp_lib_dir = "${aosp_libcpp_root}/libs/${aosp_app_abi}" }