| 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/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/toolchain/clang.gni") | 6 import("//build/toolchain/clang.gni") |
| 7 import("//build/toolchain/goma.gni") | 7 import("//build/toolchain/goma.gni") |
| 8 import("//build/toolchain/gcc_toolchain.gni") | 8 import("//build/toolchain/gcc_toolchain.gni") |
| 9 | 9 |
| 10 # Get the Android version of the name of the build host's architecture. | 10 # Get the Android version of the name of the build host's architecture. |
| 11 if (build_cpu_arch == "x64") { | 11 if (build_cpu_arch == "x64") { |
| 12 android_host_arch = "x86_64" | 12 android_host_arch = "x86_64" |
| 13 } else if (build_cpu_arch == "x86") { | 13 } else if (build_cpu_arch == "x86") { |
| 14 android_host_arch = "x86" | 14 android_host_arch = "x86" |
| 15 } else { | 15 } else { |
| 16 assert(false, "Need Android toolchain support for your build OS.") | 16 assert(false, "Need Android toolchain support for your build OS.") |
| 17 } | 17 } |
| 18 | 18 |
| 19 if (is_gyp) { | |
| 20 # Set the compilers for GYP to use. This logic is only relevant to GYP where | |
| 21 # there is "a" target compiler. In native GN builds, we have separate | |
| 22 # compilers for the toolchains below, any or all of which could be active in | |
| 23 # any given build. | |
| 24 if (is_clang) { | |
| 25 # Set the GYP header for all toolchains when running under Clang. | |
| 26 make_global_settings = make_clang_global_settings | |
| 27 } else { | |
| 28 # Find the compiler for GYP for non-Clang Android. | |
| 29 if (cpu_arch == "x86") { | |
| 30 android_toolchain_arch = "x86-4.6" | |
| 31 } else if (cpu_arch == "arm") { | |
| 32 android_toolchain_arch = "arm-linux-androideabi-4.6" | |
| 33 } else if (cpu_arch == "mipsel") { | |
| 34 android_toolchain_arch = "mipsel-linux-android-4.6" | |
| 35 } else { | |
| 36 assert(false, "Need Android toolchain support for your platform.") | |
| 37 } | |
| 38 | |
| 39 # The extra slash before "toolchains" is because GYP generates this and we | |
| 40 # have to match the make_global_settings character-for-character, | |
| 41 # TODO(brettw) remove extra slash before toolchains when GYP compat is no | |
| 42 # longer necessary. | |
| 43 android_toolchain = | |
| 44 "$android_ndk_root//toolchains/$android_toolchain_arch/prebuilt/$build_os-
$android_host_arch/bin" | |
| 45 | |
| 46 # This script will find the compilers for the given Android toolchain | |
| 47 # directory. | |
| 48 android_compilers = exec_script("find_android_compiler.py", | |
| 49 [android_toolchain], "value") | |
| 50 make_global_settings = | |
| 51 "['CC', '" + android_compilers[0] + "']," + | |
| 52 "['CXX', '" + android_compilers[1] + "']," + | |
| 53 "['CC.host', '" + android_compilers[2] + "']," + | |
| 54 "['CXX.host', '" + android_compilers[3] + "']," | |
| 55 } | |
| 56 | |
| 57 if (use_goma) { | |
| 58 # There is a TODO(yyanagisawa) in common.gypi about the make generator not | |
| 59 # supporting CC_wrapper without CC. As a result, we must add a condition | |
| 60 # when on the generator when we're not explicitly setting the variables | |
| 61 # above (which happens when gyp_header is empty at this point). | |
| 62 # | |
| 63 # GYP will interpret the file once for each generator, so we have to write | |
| 64 # this condition into the GYP file since the user could have more than one | |
| 65 # generator set. | |
| 66 gyp_header = | |
| 67 "'conditions': [" + | |
| 68 "['\"<(GENERATOR)\"==\"ninja\"', { 'make_global_settings': [" + | |
| 69 make_global_settings + | |
| 70 make_goma_global_settings + | |
| 71 "]}]]," | |
| 72 } else { | |
| 73 gyp_header = "'make_global_settings': [" + make_global_settings + "]," | |
| 74 } | |
| 75 } | |
| 76 | |
| 77 gcc_toolchain("x86") { | 19 gcc_toolchain("x86") { |
| 78 prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_hos
t_arch/bin/i686-linux-android-" | 20 prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_hos
t_arch/bin/i686-linux-android-" |
| 79 cc = prefix + "gcc" | 21 cc = prefix + "gcc" |
| 80 cxx = prefix + "g++" | 22 cxx = prefix + "g++" |
| 81 ar = prefix + "ar" | 23 ar = prefix + "ar" |
| 82 ld = cxx | 24 ld = cxx |
| 83 | 25 |
| 84 toolchain_cpu_arch = "x86" | 26 toolchain_cpu_arch = "x86" |
| 85 toolchain_os = "android" | 27 toolchain_os = "android" |
| 86 } | 28 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 gcc_toolchain("mipsel") { | 41 gcc_toolchain("mipsel") { |
| 100 prefix = "$android_ndk_root/toolchains/mipsel-linux-android-4.6/prebuilt/$buil
d_os-$android_host_arch/bin/mipsel-linux-android-" | 42 prefix = "$android_ndk_root/toolchains/mipsel-linux-android-4.6/prebuilt/$buil
d_os-$android_host_arch/bin/mipsel-linux-android-" |
| 101 cc = prefix + "gcc" | 43 cc = prefix + "gcc" |
| 102 cxx = prefix + "g++" | 44 cxx = prefix + "g++" |
| 103 ar = prefix + "ar" | 45 ar = prefix + "ar" |
| 104 ld = cxx | 46 ld = cxx |
| 105 | 47 |
| 106 toolchain_cpu_arch = "mipsel" | 48 toolchain_cpu_arch = "mipsel" |
| 107 toolchain_os = "android" | 49 toolchain_os = "android" |
| 108 } | 50 } |
| OLD | NEW |