Index: build/toolchain/android/BUILD.gn |
diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn |
index 087f04b3506331bd1d6c631f49074f03ffea449e..867fa4897a51c1bdc464e5b704ab74a74ce1b97b 100644 |
--- a/build/toolchain/android/BUILD.gn |
+++ b/build/toolchain/android/BUILD.gn |
@@ -45,8 +45,21 @@ template("android_gcc_toolchain") { |
compiler_prefix = "" |
} |
- cc = compiler_prefix + tool_prefix + "gcc" |
- cxx = compiler_prefix + tool_prefix + "g++" |
+ is_clang = invoker.is_clang |
+ if (is_clang) { |
+ if (use_clang_type_profiler) { |
+ prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin", |
+ root_build_dir) |
+ } else { |
+ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
+ root_build_dir) |
+ } |
+ cc = "${compiler_prefix}$prefix/clang" |
+ cxx = "${compiler_prefix}$prefix/clang++" |
+ } else { |
+ cc = "${compiler_prefix}${tool_prefix}gcc" |
+ cxx = "${compiler_prefix}${tool_prefix}g++" |
+ } |
ar = tool_prefix + "ar" |
ld = cxx |
readelf = compiler_prefix + tool_prefix + "readelf" |
@@ -80,7 +93,24 @@ template("android_gcc_toolchain") { |
} |
} |
-android_gcc_toolchain("x86") { |
+template("android_gcc_toolchains_helper") { |
+ android_gcc_toolchain(target_name) { |
+ android_ndk_sysroot = invoker.android_ndk_sysroot |
+ android_ndk_lib_dir = invoker.android_ndk_lib_dir |
+ tool_prefix = invoker.tool_prefix |
+ toolchain_cpu = invoker.toolchain_cpu |
+ } |
+ |
+ android_gcc_toolchain("clang_$target_name") { |
+ android_ndk_sysroot = invoker.android_ndk_sysroot |
+ android_ndk_lib_dir = invoker.android_ndk_lib_dir |
+ tool_prefix = invoker.tool_prefix |
+ toolchain_cpu = invoker.toolchain_cpu |
+ is_clang = true |
+ } |
+} |
+ |
+android_gcc_toolchains_helper("x86") { |
android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib" |
@@ -88,7 +118,7 @@ android_gcc_toolchain("x86") { |
toolchain_cpu = "x86" |
} |
-android_gcc_toolchain("arm") { |
+android_gcc_toolchains_helper("arm") { |
android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib" |
@@ -96,7 +126,7 @@ android_gcc_toolchain("arm") { |
toolchain_cpu = "arm" |
} |
-android_gcc_toolchain("mipsel") { |
+android_gcc_toolchains_helper("mipsel") { |
android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib" |
@@ -104,7 +134,7 @@ android_gcc_toolchain("mipsel") { |
toolchain_cpu = "mipsel" |
} |
-android_gcc_toolchain("x64") { |
+android_gcc_toolchains_helper("x64") { |
android_ndk_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib64" |
@@ -112,7 +142,7 @@ android_gcc_toolchain("x64") { |
toolchain_cpu = "x86_64" |
} |
-android_gcc_toolchain("arm64") { |
+android_gcc_toolchains_helper("arm64") { |
android_ndk_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib" |
@@ -120,7 +150,7 @@ android_gcc_toolchain("arm64") { |
toolchain_cpu = "aarch64" |
} |
-android_gcc_toolchain("mips64el") { |
+android_gcc_toolchains_helper("mips64el") { |
android_ndk_sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" |
android_ndk_lib_dir = "usr/lib64" |