| 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("../clang.gni") | 5 import("../clang.gni") |
| 6 import("../goma.gni") | 6 import("../goma.gni") |
| 7 import("../gcc_toolchain.gni") | 7 import("../gcc_toolchain.gni") |
| 8 | 8 |
| 9 # Get the location of the Android tools in our tree. | 9 # Get the location of the Android tools in our tree. |
| 10 android_ndk_root = | 10 android_ndk_root = |
| 11 rebase_path("//third_party/android_tools/ndk", ".", "") | 11 rebase_path("//third_party/android_tools/ndk", ".", "") |
| 12 android_sdk_root = | |
| 13 rebase_path("//third_party/android_tools/sdk", ".", "") | |
| 14 | 12 |
| 15 # Get the Android version of the name of the build host's architecture. | 13 # Get the Android version of the name of the build host's architecture. |
| 16 if (build_cpu_arch == "x64") { | 14 if (build_cpu_arch == "x64") { |
| 17 android_host_arch = "x86_64" | 15 android_host_arch = "x86_64" |
| 18 } else if (build_cpu_arch == "x86") { | 16 } else if (build_cpu_arch == "x86") { |
| 19 android_host_arch = "x86" | 17 android_host_arch = "x86" |
| 20 } else { | 18 } else { |
| 21 assert(false, "Need Android toolchain support for your build OS.") | 19 assert(false, "Need Android toolchain support for your build OS.") |
| 22 } | 20 } |
| 23 | 21 |
| 24 if (is_gyp) { | 22 if (is_gyp) { |
| 25 # Set the compilers for GYP to use. This logic is only relevant to GYP where | 23 # 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 | 24 # 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 | 25 # compilers for the toolchains below, any or all of which could be active in |
| 28 # any given build. | 26 # any given build. |
| 29 if (is_clang) { | 27 if (is_clang) { |
| 30 # Set the GYP header for all toolchains when running under Clang. | 28 # Set the GYP header for all toolchains when running under Clang. |
| 31 gyp_header = make_clang_global_settings | 29 gyp_header = make_clang_global_settings |
| 32 } else { | 30 } else { |
| 33 # Find the compiler for GYP for non-Clang Android. | 31 # Find the compiler for GYP for non-Clang Android. |
| 34 if (cpu_arch == "x86") { | 32 if (cpu_arch == "x86") { |
| 35 android_toolchain_arch = "x86-4.6" | 33 android_toolchain_arch = "x86-4.6" |
| 36 } else if (cpu_arch == "arm") { | 34 } else if (cpu_arch == "arm") { |
| 37 android_toolchain_arch = "arm-linux-androideabi-4.6" | 35 android_toolchain_arch = "arm-linux-androideabi-4.6" |
| 38 } else { | 36 } else { |
| 39 assert(false, "Need Android toolchain support for your platform.") | 37 assert(false, "Need Android toolchain support for your platform.") |
| 40 } | 38 } |
| 41 | 39 |
| 40 # The extra slash before "toolchains" is because GYP generates this and we |
| 41 # have to match the make_global_settings character-for-character, |
| 42 # TODO(brettw) remove extra slash before toolchains when GYP compat is no |
| 43 # longer necessary. |
| 42 android_toolchain = | 44 android_toolchain = |
| 43 "$android_ndk_root/toolchains/$android_toolchain_arch/prebuilt/$build_os-$
android_host_arch/bin" | 45 "$android_ndk_root//toolchains/$android_toolchain_arch/prebuilt/$build_os-
$android_host_arch/bin" |
| 44 | 46 |
| 45 # This script will find the compilers for the given Android toolchain | 47 # This script will find the compilers for the given Android toolchain |
| 46 # directory. | 48 # directory. |
| 47 android_compilers = exec_script("find_android_compiler.py", | 49 android_compilers = exec_script("find_android_compiler.py", |
| 48 [android_toolchain], "value") | 50 [android_toolchain], "value") |
| 49 gyp_header = | 51 gyp_header = |
| 50 "'make_global_settings': [" + | 52 "'make_global_settings': [" + |
| 51 "['CC', '" + android_compilers[0] + "']," + | 53 "['CC', '" + android_compilers[0] + "']," + |
| 52 "['CXX', '" + android_compilers[1] + "']," + | 54 "['CXX', '" + android_compilers[1] + "']," + |
| 53 "['CC.host', '" + android_compilers[2] + "']," + | 55 "['CC.host', '" + android_compilers[2] + "']," + |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 gcc_toolchain("arm") { | 92 gcc_toolchain("arm") { |
| 91 prefix = "$android_ndk_root/toolchains/arm-linux-androideabi-4.6/prebuilt/$bui
ld_os-$android_host_arch/bin/arm-linux-androideabi-" | 93 prefix = "$android_ndk_root/toolchains/arm-linux-androideabi-4.6/prebuilt/$bui
ld_os-$android_host_arch/bin/arm-linux-androideabi-" |
| 92 cc = prefix + "gcc" | 94 cc = prefix + "gcc" |
| 93 cxx = prefix + "g++" | 95 cxx = prefix + "g++" |
| 94 ar = prefix + "ar" | 96 ar = prefix + "ar" |
| 95 ld = cxx | 97 ld = cxx |
| 96 | 98 |
| 97 toolchain_cpu_arch = "arm" | 99 toolchain_cpu_arch = "arm" |
| 98 toolchain_os = "android" | 100 toolchain_os = "android" |
| 99 } | 101 } |
| OLD | NEW |