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

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

Issue 132833002: Improves GN's make_global_settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | build/toolchain/clang.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) { 19 if (is_gyp) {
20 # Set the compilers for GYP to use. This logic is only relevant to GYP where 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 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 22 # compilers for the toolchains below, any or all of which could be active in
23 # any given build. 23 # any given build.
24 if (is_clang) { 24 if (is_clang) {
25 # Set the GYP header for all toolchains when running under Clang. 25 # Set the GYP header for all toolchains when running under Clang.
26 gyp_header = make_clang_global_settings 26 make_global_settings = make_clang_global_settings
27 } else { 27 } else {
28 # Find the compiler for GYP for non-Clang Android. 28 # Find the compiler for GYP for non-Clang Android.
29 if (cpu_arch == "x86") { 29 if (cpu_arch == "x86") {
30 android_toolchain_arch = "x86-4.6" 30 android_toolchain_arch = "x86-4.6"
31 } else if (cpu_arch == "arm") { 31 } else if (cpu_arch == "arm") {
32 android_toolchain_arch = "arm-linux-androideabi-4.6" 32 android_toolchain_arch = "arm-linux-androideabi-4.6"
33 } else if (cpu_arch == "mipsel") { 33 } else if (cpu_arch == "mipsel") {
34 android_toolchain_arch = "mipsel-linux-android-4.6" 34 android_toolchain_arch = "mipsel-linux-android-4.6"
35 } else { 35 } else {
36 assert(false, "Need Android toolchain support for your platform.") 36 assert(false, "Need Android toolchain support for your platform.")
37 } 37 }
38 38
39 # The extra slash before "toolchains" is because GYP generates this and we 39 # The extra slash before "toolchains" is because GYP generates this and we
40 # have to match the make_global_settings character-for-character, 40 # have to match the make_global_settings character-for-character,
41 # TODO(brettw) remove extra slash before toolchains when GYP compat is no 41 # TODO(brettw) remove extra slash before toolchains when GYP compat is no
42 # longer necessary. 42 # longer necessary.
43 android_toolchain = 43 android_toolchain =
44 "$android_ndk_root//toolchains/$android_toolchain_arch/prebuilt/$build_os- $android_host_arch/bin" 44 "$android_ndk_root//toolchains/$android_toolchain_arch/prebuilt/$build_os- $android_host_arch/bin"
45 45
46 # This script will find the compilers for the given Android toolchain 46 # This script will find the compilers for the given Android toolchain
47 # directory. 47 # directory.
48 android_compilers = exec_script("find_android_compiler.py", 48 android_compilers = exec_script("find_android_compiler.py",
49 [android_toolchain], "value") 49 [android_toolchain], "value")
50 gyp_header = 50 make_global_settings =
51 "'make_global_settings': [" +
52 "['CC', '" + android_compilers[0] + "']," + 51 "['CC', '" + android_compilers[0] + "']," +
53 "['CXX', '" + android_compilers[1] + "']," + 52 "['CXX', '" + android_compilers[1] + "']," +
54 "['CC.host', '" + android_compilers[2] + "']," + 53 "['CC.host', '" + android_compilers[2] + "']," +
55 "['CXX.host', '" + android_compilers[3] + "']," + 54 "['CXX.host', '" + android_compilers[3] + "'],"
56 "],"
57 } 55 }
58 56
59 if (use_goma) { 57 if (use_goma) {
60 # There is a TODO(yyanagisawa) in common.gypi about the make generator not 58 # There is a TODO(yyanagisawa) in common.gypi about the make generator not
61 # supporting CC_wrapper without CC. As a result, we must add a condition 59 # supporting CC_wrapper without CC. As a result, we must add a condition
62 # when on the generator when we're not explicitly setting the variables 60 # when on the generator when we're not explicitly setting the variables
63 # above (which happens when gyp_header is empty at this point). 61 # above (which happens when gyp_header is empty at this point).
64 # 62 #
65 # GYP will interpret the file once for each generator, so we have to write 63 # GYP will interpret the file once for each generator, so we have to write
66 # this condition into the GYP file since the user could have more than one 64 # this condition into the GYP file since the user could have more than one
67 # generator set. 65 # generator set.
68 if (gyp_header == "") { 66 gyp_header =
69 gyp_header += 67 "'conditions': [" +
70 "'conditions':" + 68 "['\"<(GENERATOR)\"==\"ninja\"', { 'make_global_settings': [" +
71 "['\"<(GENERATOR)\"==\"ninja\"', {" + 69 make_global_settings +
72 make_goma_global_settings + 70 make_goma_global_settings +
73 "}]," 71 "]}]],"
74 } else { 72 } else {
75 gyp_header += make_goma_global_settings 73 gyp_header = "'make_global_settings': [" + make_global_settings + "],"
76 }
77 } 74 }
78 } 75 }
79 76
80 gcc_toolchain("x86") { 77 gcc_toolchain("x86") {
81 prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_hos t_arch/bin/i686-linux-android-" 78 prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_hos t_arch/bin/i686-linux-android-"
82 cc = prefix + "gcc" 79 cc = prefix + "gcc"
83 cxx = prefix + "g++" 80 cxx = prefix + "g++"
84 ar = prefix + "ar" 81 ar = prefix + "ar"
85 ld = cxx 82 ld = cxx
86 83
(...skipping 15 matching lines...) Expand all
102 gcc_toolchain("mipsel") { 99 gcc_toolchain("mipsel") {
103 prefix = "$android_ndk_root/toolchains/mipsel-linux-android-4.6/prebuilt/$buil d_os-$android_host_arch/bin/mipsel-linux-android-" 100 prefix = "$android_ndk_root/toolchains/mipsel-linux-android-4.6/prebuilt/$buil d_os-$android_host_arch/bin/mipsel-linux-android-"
104 cc = prefix + "gcc" 101 cc = prefix + "gcc"
105 cxx = prefix + "g++" 102 cxx = prefix + "g++"
106 ar = prefix + "ar" 103 ar = prefix + "ar"
107 ld = cxx 104 ld = cxx
108 105
109 toolchain_cpu_arch = "mipsel" 106 toolchain_cpu_arch = "mipsel"
110 toolchain_os = "android" 107 toolchain_os = "android"
111 } 108 }
OLDNEW
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | build/toolchain/clang.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698