# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This file contains common system config stuff for the Android build. if (is_android) { if (!defined(default_android_sdk_root)) { default_android_sdk_root = "//third_party/android_tools/sdk" default_android_sdk_version = "22" default_android_sdk_build_tools_version = "22.0.1" } declare_args() { android_sdk_root = default_android_sdk_root android_sdk_version = default_android_sdk_version android_sdk_build_tools_version = default_android_sdk_build_tools_version # Unused by Dart. Required for GN files in the third_party package ICU. enable_java_templates = false } # Host stuff ----------------------------------------------------------------- # Defines the name the Android build gives to the current host CPU # architecture, which is different than the names GN uses. if (host_cpu == "x64" || host_cpu == "x86") { android_host_arch = "x86_64" } else { assert(false, "Need Android toolchain support for your build CPU arch.") } # Defines the name the Android build gives to the current host CPU # architecture, which is different than the names GN uses. if (host_os == "linux") { android_host_os = "linux" } else if (host_os == "mac") { android_host_os = "darwin" } else { assert(false, "Need Android toolchain support for your build OS.") } # Directories and files ------------------------------------------------------ # # We define may of the dirs strings here for each output architecture (rather # than just the current one) since these are needed by the Android toolchain # file to define toolchains for all possible targets in one pass. android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}" # Path to the Android NDK and SDK. android_ndk_root = "//third_party/android_tools/ndk" android_ndk_include_dir = "$android_ndk_root/usr/include" android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}" android_sdk_tools = "${android_sdk_root}/tools" android_sdk_build_tools = "${android_sdk_root}/build-tools/$android_sdk_build_tools_version" # Path to the SDK's android.jar android_sdk_jar = "$android_sdk/android.jar" zipalign_path = "$android_sdk_build_tools/zipalign" # Subdirectories inside android_ndk_root that contain the sysroot for the # associated platform. if (current_cpu == "x64" || current_cpu == "arm64") { android_api_level = 22 } else { android_api_level = 16 } x86_android_sysroot_subdir = "platforms/android-${android_api_level}/arch-x86" arm_android_sysroot_subdir = "platforms/android-${android_api_level}/arch-arm" x86_64_android_sysroot_subdir = "platforms/android-${android_api_level}/arch-x86_64" arm64_android_sysroot_subdir = "platforms/android-${android_api_level}/arch-arm64" # Toolchain root directory for each build. The actual binaries are inside # a "bin" directory inside of these. _android_toolchain_version = "4.9" _android_toolchain_detailed_version = "4.9.x" x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}" arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}" x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}" arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_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 == "x86") { android_prebuilt_arch = "android-x86" android_target_triple = "i686-linux-android" android_toolchain_root = "$x86_android_toolchain_root" android_sysroot_subdir = "$x86_android_sysroot_subdir" } else if (current_cpu == "arm") { android_prebuilt_arch = "android-arm" android_target_triple = "arm-linux-androideabi" android_toolchain_root = "$arm_android_toolchain_root" android_sysroot_subdir = "$arm_android_sysroot_subdir" } else if (current_cpu == "x64") { android_prebuilt_arch = "android-x86_64" android_target_triple = "x86_64-linux-android" android_toolchain_root = "$x86_64_android_toolchain_root" android_sysroot_subdir = "$x86_64_android_sysroot_subdir" } else if (current_cpu == "arm64") { android_prebuilt_arch = "android-arm64" android_target_triple = "aarch64-linux-android" android_toolchain_root = "$arm64_android_toolchain_root" android_sysroot_subdir = "$arm64_android_sysroot_subdir" } else { assert(false, "Need android libgcc support for your target arch.") } android_tool_prefix = "$android_toolchain_root/bin/$android_target_triple-" android_readelf = "${android_tool_prefix}readelf" android_objcopy = "${android_tool_prefix}objcopy" android_gdbserver = "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver" # Toolchain stuff ------------------------------------------------------------ android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++" if (component_mode == "shared_library") { android_libcpp_library = "c++_shared" } else { android_libcpp_library = "c++_static" } if (component_mode == "shared_library") { # By appending .cr, we prevent name collisions with libraries already # loaded by the Android zygote. android_product_extension = ".cr.so" } else { android_product_extension = ".so" } # ABI ------------------------------------------------------------------------ if (current_cpu == "x86") { android_app_abi = "x86" } else if (current_cpu == "arm") { import("//build/config/arm.gni") if (arm_version < 7) { android_app_abi = "armeabi" } else { android_app_abi = "armeabi-v7a" } } else if (current_cpu == "x64") { android_app_abi = "x86_64" } else if (current_cpu == "arm64") { android_app_abi = "arm64-v8a" } else { assert(false, "Unknown Android ABI: " + current_cpu) } android_log_tag = "\"dart\"" }