| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/sysroot.gni") # Imports android/config.gni. | 5 import("//build/config/sysroot.gni") # Imports android/config.gni. |
| 6 import("//build/toolchain/ccache.gni") | 6 import("//build/toolchain/ccache.gni") |
| 7 import("//build/toolchain/clang.gni") | 7 import("//build/toolchain/clang.gni") |
| 8 import("//build/toolchain/goma.gni") | 8 import("//build/toolchain/goma.gni") |
| 9 import("//build/toolchain/gcc_toolchain.gni") | 9 import("//build/toolchain/gcc_toolchain.gni") |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 if (use_goma) { | 39 if (use_goma) { |
| 40 assert(!use_ccache, "Goma and ccache can't be used together.") | 40 assert(!use_ccache, "Goma and ccache can't be used together.") |
| 41 compiler_prefix = "$goma_dir/gomacc " | 41 compiler_prefix = "$goma_dir/gomacc " |
| 42 } else if (use_ccache) { | 42 } else if (use_ccache) { |
| 43 compiler_prefix = "ccache " | 43 compiler_prefix = "ccache " |
| 44 } else { | 44 } else { |
| 45 compiler_prefix = "" | 45 compiler_prefix = "" |
| 46 } | 46 } |
| 47 | 47 |
| 48 cc = compiler_prefix + tool_prefix + "gcc" | 48 is_clang = invoker.is_clang |
| 49 cxx = compiler_prefix + tool_prefix + "g++" | 49 if (is_clang) { |
| 50 if (use_clang_type_profiler) { |
| 51 prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin", |
| 52 root_build_dir) |
| 53 } else { |
| 54 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
| 55 root_build_dir) |
| 56 } |
| 57 cc = "${compiler_prefix}$prefix/clang" |
| 58 cxx = "${compiler_prefix}$prefix/clang++" |
| 59 } else { |
| 60 cc = "${compiler_prefix}${tool_prefix}gcc" |
| 61 cxx = "${compiler_prefix}${tool_prefix}g++" |
| 62 } |
| 50 ar = tool_prefix + "ar" | 63 ar = tool_prefix + "ar" |
| 51 ld = cxx | 64 ld = cxx |
| 52 readelf = compiler_prefix + tool_prefix + "readelf" | 65 readelf = compiler_prefix + tool_prefix + "readelf" |
| 53 nm = compiler_prefix + tool_prefix + "nm" | 66 nm = compiler_prefix + tool_prefix + "nm" |
| 54 | 67 |
| 55 toolchain_os = "android" | 68 toolchain_os = "android" |
| 56 toolchain_cpu = invoker.toolchain_cpu | 69 toolchain_cpu = invoker.toolchain_cpu |
| 57 | 70 |
| 58 # We make the assumption that the gcc_toolchain will produce a soname with | 71 # We make the assumption that the gcc_toolchain will produce a soname with |
| 59 # the following definition. | 72 # the following definition. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 | 86 |
| 74 # We make the assumption that the gcc_toolchain will produce an exe with | 87 # We make the assumption that the gcc_toolchain will produce an exe with |
| 75 # the following definition. | 88 # the following definition. |
| 76 exe = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 89 exe = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
| 77 stripped_exe = "exe.stripped/$exe" | 90 stripped_exe = "exe.stripped/$exe" |
| 78 postlink = "$android_strip --strip-unneeded -o $stripped_exe $exe" | 91 postlink = "$android_strip --strip-unneeded -o $stripped_exe $exe" |
| 79 link_outputs = [ stripped_exe ] | 92 link_outputs = [ stripped_exe ] |
| 80 } | 93 } |
| 81 } | 94 } |
| 82 | 95 |
| 83 android_gcc_toolchain("x86") { | 96 template("android_gcc_toolchains_helper") { |
| 97 android_gcc_toolchain(target_name) { |
| 98 android_ndk_sysroot = invoker.android_ndk_sysroot |
| 99 android_ndk_lib_dir = invoker.android_ndk_lib_dir |
| 100 tool_prefix = invoker.tool_prefix |
| 101 toolchain_cpu = invoker.toolchain_cpu |
| 102 } |
| 103 |
| 104 android_gcc_toolchain("clang_$target_name") { |
| 105 android_ndk_sysroot = invoker.android_ndk_sysroot |
| 106 android_ndk_lib_dir = invoker.android_ndk_lib_dir |
| 107 tool_prefix = invoker.tool_prefix |
| 108 toolchain_cpu = invoker.toolchain_cpu |
| 109 is_clang = true |
| 110 } |
| 111 } |
| 112 |
| 113 android_gcc_toolchains_helper("x86") { |
| 84 android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" | 114 android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" |
| 85 android_ndk_lib_dir = "usr/lib" | 115 android_ndk_lib_dir = "usr/lib" |
| 86 | 116 |
| 87 tool_prefix = "$x86_android_toolchain_root/bin/i686-linux-android-" | 117 tool_prefix = "$x86_android_toolchain_root/bin/i686-linux-android-" |
| 88 toolchain_cpu = "x86" | 118 toolchain_cpu = "x86" |
| 89 } | 119 } |
| 90 | 120 |
| 91 android_gcc_toolchain("arm") { | 121 android_gcc_toolchains_helper("arm") { |
| 92 android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" | 122 android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" |
| 93 android_ndk_lib_dir = "usr/lib" | 123 android_ndk_lib_dir = "usr/lib" |
| 94 | 124 |
| 95 tool_prefix = "$arm_android_toolchain_root/bin/arm-linux-androideabi-" | 125 tool_prefix = "$arm_android_toolchain_root/bin/arm-linux-androideabi-" |
| 96 toolchain_cpu = "arm" | 126 toolchain_cpu = "arm" |
| 97 } | 127 } |
| 98 | 128 |
| 99 android_gcc_toolchain("mipsel") { | 129 android_gcc_toolchains_helper("mipsel") { |
| 100 android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" | 130 android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" |
| 101 android_ndk_lib_dir = "usr/lib" | 131 android_ndk_lib_dir = "usr/lib" |
| 102 | 132 |
| 103 tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-" | 133 tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-" |
| 104 toolchain_cpu = "mipsel" | 134 toolchain_cpu = "mipsel" |
| 105 } | 135 } |
| 106 | 136 |
| 107 android_gcc_toolchain("x64") { | 137 android_gcc_toolchains_helper("x64") { |
| 108 android_ndk_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" | 138 android_ndk_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" |
| 109 android_ndk_lib_dir = "usr/lib64" | 139 android_ndk_lib_dir = "usr/lib64" |
| 110 | 140 |
| 111 tool_prefix = "$x86_64_android_toolchain_root/bin/x86_64-linux-android-" | 141 tool_prefix = "$x86_64_android_toolchain_root/bin/x86_64-linux-android-" |
| 112 toolchain_cpu = "x86_64" | 142 toolchain_cpu = "x86_64" |
| 113 } | 143 } |
| 114 | 144 |
| 115 android_gcc_toolchain("arm64") { | 145 android_gcc_toolchains_helper("arm64") { |
| 116 android_ndk_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" | 146 android_ndk_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" |
| 117 android_ndk_lib_dir = "usr/lib" | 147 android_ndk_lib_dir = "usr/lib" |
| 118 | 148 |
| 119 tool_prefix = "$arm64_android_toolchain_root/bin/arm-linux-androideabi-" | 149 tool_prefix = "$arm64_android_toolchain_root/bin/arm-linux-androideabi-" |
| 120 toolchain_cpu = "aarch64" | 150 toolchain_cpu = "aarch64" |
| 121 } | 151 } |
| 122 | 152 |
| 123 android_gcc_toolchain("mips64el") { | 153 android_gcc_toolchains_helper("mips64el") { |
| 124 android_ndk_sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" | 154 android_ndk_sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" |
| 125 android_ndk_lib_dir = "usr/lib64" | 155 android_ndk_lib_dir = "usr/lib64" |
| 126 | 156 |
| 127 tool_prefix = "$mips64_android_toolchain_root/bin/mipsel-linux-android-" | 157 tool_prefix = "$mips64_android_toolchain_root/bin/mipsel-linux-android-" |
| 128 toolchain_cpu = "mipsel64el" | 158 toolchain_cpu = "mipsel64el" |
| 129 } | 159 } |
| OLD | NEW |