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