Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: build/toolchain/android/BUILD.gn

Issue 117863003: Work on GN toolchain definitions and build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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", ".", "")
Nico 2013/12/26 22:14:34 Mostly unrelated: As it happens, I'm currently try
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 android_compilers = exec_script("find_android_compilers.py",
48 [android_toolchain], "value")
49 gyp_header =
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
58 if (use_goma) {
59 # There is a TODO(yyanagisawa) in common.gypi about the make generator not
60 # supporting CC_wrapper without CC. As a result, we must add a condition
61 # when on the generator when we're not explicitly setting the variables
62 # above (which happens when gyp_header is empty at this point).
63 #
64 # GYP will interpret the file once for each generator, so we have to write
65 # this condition into the GYP file since the user could have more than one
66 # generator set.
67 if (gyp_header == "") {
68 gyp_header +=
69 "'conditions':" +
70 "['\"<(GENERATOR)\"==\"ninja\"', {" +
71 make_goma_global_settings +
72 "}],"
73 } else {
74 gyp_header += make_goma_global_settings
75 }
76 }
77 }
78
79 gcc_toolchain("x86") {
80 prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_hos t_arch/bin/i686-linux-android-"
81 cc = prefix + "gcc"
82 cxx = prefix + "g++"
83 ar = prefix + "ar"
84 ld = cxx
85
86 toolchain_cpu_arch = "x86"
87 toolchain_os = "android"
88 }
89
90 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-"
92 cc = prefix + "gcc"
93 cxx = prefix + "g++"
94 ar = prefix + "ar"
95 ld = cxx
96
97 toolchain_cpu_arch = "arm"
98 toolchain_os = "android"
99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698