| # Copyright 2013 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/android/config.gni") |
| import("//build/config/chrome_build.gni") |
| import("//build/config/clang/clang.gni") |
| import("//build/config/compiler/compiler.gni") |
| import("//build/config/ozone.gni") |
| import("//build/config/sysroot.gni") # Imports android/config.gni. |
| import("//build/toolchain/gcc_toolchain.gni") |
| if (build_with_chromium) { |
| import("//third_party/jni_zero/jni_zero.gni") |
| } |
| |
| declare_args() { |
| # Whether unstripped binaries, i.e. compiled with debug symbols, should be |
| # considered runtime_deps rather than stripped ones. |
| android_unstripped_runtime_outputs = true |
| } |
| |
| template("android_clang_toolchain") { |
| clang_toolchain(target_name) { |
| assert(defined(invoker.toolchain_args), |
| "toolchain_args must be defined for android_clang_toolchain()") |
| |
| toolchain_args = { |
| forward_variables_from(invoker.toolchain_args, "*") |
| current_os = "android" |
| use_debug_fission = false |
| is_high_end_android = is_high_end_android_secondary_toolchain |
| } |
| |
| # Output linker map files for binary size analysis. |
| enable_linker_map = true |
| |
| strip = rebase_path("$clang_base_path/bin/llvm-strip", root_build_dir) |
| |
| use_unstripped_as_runtime_outputs = android_unstripped_runtime_outputs |
| |
| # Don't use .cr.so for loadable_modules since they are always loaded via |
| # absolute path. |
| loadable_module_extension = ".so" |
| |
| # We propagate configs to allow cross-toolchain JNI include directories to |
| # work. This flag does not otherwise affect our build, but if applied to |
| # non-android toolchains, it causes unwanted configs from perfetto to |
| # propagate from host_toolchain deps. |
| propagates_configs = true |
| } |
| } |
| |
| android_clang_toolchain("android_clang_x86") { |
| toolchain_args = { |
| current_cpu = "x86" |
| } |
| } |
| |
| android_clang_toolchain("android_clang_arm") { |
| toolchain_args = { |
| current_cpu = "arm" |
| } |
| } |
| |
| android_clang_toolchain("android_clang_mipsel") { |
| toolchain_args = { |
| current_cpu = "mipsel" |
| } |
| } |
| |
| android_clang_toolchain("android_clang_x64") { |
| toolchain_args = { |
| current_cpu = "x64" |
| } |
| } |
| |
| android_clang_toolchain("android_clang_arm64") { |
| toolchain_args = { |
| current_cpu = "arm64" |
| } |
| } |
| |
| android_clang_toolchain("android_clang_arm64_hwasan") { |
| toolchain_args = { |
| current_cpu = "arm64" |
| is_hwasan = true |
| android64_ndk_api_level = 29 |
| } |
| } |
| |
| android_clang_toolchain("android_clang_mips64el") { |
| toolchain_args = { |
| current_cpu = "mips64el" |
| } |
| } |
| |
| # Placeholder for riscv64 support, not tested since the toolchain is not ready. |
| android_clang_toolchain("android_clang_riscv64") { |
| toolchain_args = { |
| current_cpu = "riscv64" |
| } |
| } |
| |
| # Toolchain for creating native libraries that can be used by |
| # robolectric_binary targets. It does not emulate NDK APIs nor make available |
| # NDK header files. |
| # Targets that opt into defining JNI entrypoints should use the |
| # //third_party/jdk:jdk config to make jni.h available. |
| # This toolchain will set: |
| # is_linux = true |
| # is_android = false |
| # is_robolectric = true |
| clang_toolchain("robolectric_$host_cpu") { |
| toolchain_args = { |
| current_os = host_os |
| current_cpu = host_cpu |
| is_robolectric = true |
| if (build_with_chromium) { |
| # Forwarding this value from the primary toolchain to the secondary |
| # robolectric toolchain, since the default depends on is_component_build |
| # which can be different between primary and robolectric. |
| enable_jni_multiplexing = enable_jni_multiplexing |
| } |
| } |
| |
| # TODO(crbug.com/40283271): Figure out why robolectric tests fail with component builds. |
| toolchain_args.is_component_build = false |
| shlib_extension = ".so" |
| } |