OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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/toolchain/gcc_toolchain.gni") | 5 import("//build/toolchain/gcc_toolchain.gni") |
6 | 6 |
7 # CrOS builds must cross-compile on a Linux host for the actual CrOS | 7 # CrOS builds must cross-compile on a Linux host for the actual CrOS |
8 # device target. There are many different CrOS devices so the build | 8 # device target. There are many different CrOS devices so the build |
9 # system provides configuration variables that permit a CrOS build to | 9 # system provides configuration variables that permit a CrOS build to |
10 # control the cross-compilation tool chain. However, requiring such | 10 # control the cross-compilation tool chain. However, requiring such |
(...skipping 18 matching lines...) Expand all Loading... | |
29 # | 29 # |
30 # goma_dir = "/g/.cros_cache/common/goma+2" | 30 # goma_dir = "/g/.cros_cache/common/goma+2" |
31 # target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroo t_chromeos-base_chromeos-chrome.tar.xz" | 31 # target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroo t_chromeos-base_chromeos-chrome.tar.xz" |
32 # cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarbal ls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-lin ux-gnu/binutils-bin/2.25.51-gold" | 32 # cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarbal ls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-lin ux-gnu/binutils-bin/2.25.51-gold" |
33 # cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarba lls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-li nux-gnu/binutils-bin/2.25.51-gold" | 33 # cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarba lls/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-li nux-gnu/binutils-bin/2.25.51-gold" |
34 # cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar" | 34 # cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar" |
35 # target_cpu = "x64" | 35 # target_cpu = "x64" |
36 | 36 |
37 declare_args() { | 37 declare_args() { |
38 # These must be specified for a board-specific build. | 38 # These must be specified for a board-specific build. |
39 cros_target_cc = "" | 39 cros_target_ar = "ar" |
40 cros_target_cxx = "" | 40 cros_target_cc = "gcc" |
41 cros_target_ar = "" | 41 cros_target_cxx = "g++" |
42 cros_target_ld = "" | |
43 | |
44 # These can be optionally set. | |
45 cros_target_extra_cflags = "" | |
46 cros_target_extra_cppflags = "" | |
47 cros_target_extra_cxxflags = "" | |
48 cros_target_extra_ldflags = "" | |
49 | |
50 # is_clang is used instead of cros_target_is_clang | |
51 | |
52 cros_host_ar = "ar" | |
53 cros_host_cc = "gcc" | |
54 cros_host_cxx = "g++" | |
55 cros_host_ld = "" | |
56 cros_host_extra_cflags = "" | |
57 cros_host_extra_cppflags = "" | |
58 cros_host_extra_cxxflags = "" | |
59 cros_host_extra_ldflags = "" | |
60 cros_host_is_clang = false | |
61 | |
62 cros_v8_snapshot_ar = "ar" | |
63 cros_v8_snapshot_cc = "gcc" | |
64 cros_v8_snapshot_cxx = "g++" | |
65 cros_v8_snapshot_ld = "" | |
66 cros_v8_snapshot_extra_cflags = "" | |
67 cros_v8_snapshot_extra_cppflags = "" | |
68 cros_v8_snapshot_extra_cxxflags = "" | |
69 cros_v8_snapshot_extra_ldflags = "" | |
70 cros_v8_snapshot_is_clang = false | |
42 } | 71 } |
43 | 72 |
73 # TODO(dpranke): Delete this after we get rid of the reference to | |
74 # build/toolchain/cros:clang_target in BUILDCONFIG.gn | |
44 clang_toolchain("clang_target") { | 75 clang_toolchain("clang_target") { |
45 toolchain_cpu = target_cpu | 76 toolchain_cpu = target_cpu |
46 toolchain_os = "linux" | 77 toolchain_os = "linux" |
47 } | 78 } |
48 | 79 |
49 gcc_toolchain("target") { | 80 gcc_toolchain("target") { |
50 # These defaults permit building on a Linux host as described above. | 81 # TODO(dpranke): change the cros_target_{cc,cxx,ar} vars to default |
51 cc = "gcc" | 82 # to empty strings, and then assert that they are non-empty (i.e., |
52 cxx = "g++" | 83 # set in args.gn) once we get rid of the reference to |
53 ar = "ar" | 84 # build/toolchain/cros:target in BUILDCONFIG.gn |
hashimoto
2016/05/17 06:26:31
How are we going to use this toolchain after remov
hashimoto
2016/05/18 03:24:01
ping?
Dirk Pranke
2016/05/18 04:12:12
That's weird, I thought I wrote an answer for this
| |
54 | 85 |
55 # But to build for a specific board, the cros_* args will need to be defined. | 86 # These are args for the template. |
56 if (cros_target_cc != "") { | 87 cc = cros_target_cc |
57 cc = "${cros_target_cc}" | 88 cxx = cros_target_cxx |
89 ar = cros_target_ar | |
90 ld = cxx | |
91 if (cros_target_ld != "") { | |
92 ld = cros_target_ld | |
58 } | 93 } |
59 if (cros_target_cxx != "") { | 94 extra_cflags = cros_target_extra_cflags |
60 cxx = "${cros_target_cxx}" | 95 extra_cppflags = cros_target_extra_cppflags |
61 } | 96 extra_cxxflags = cros_target_extra_cxxflags |
62 if (cros_target_ar != "") { | 97 extra_ldflags = cros_target_extra_ldflags |
63 ar = "${cros_target_ar}" | |
64 } | |
65 ld = cxx | |
66 | 98 |
99 # These are passed through as toolchain_args. | |
100 cc_wrapper = "" | |
101 is_clang = is_clang | |
67 toolchain_cpu = target_cpu | 102 toolchain_cpu = target_cpu |
68 toolchain_os = "linux" | 103 toolchain_os = "linux" |
69 is_clang = is_clang | 104 } |
105 | |
106 gcc_toolchain("host") { | |
107 # These are args for the template. | |
108 ar = cros_host_ar | |
hashimoto
2016/05/17 06:26:31
nit: Please make the order consistent ("cc cxx ar
Dirk Pranke
2016/05/17 21:37:45
Yup, that's unintentionally different. Will fix.
| |
109 cc = cros_host_cc | |
110 cxx = cros_host_cxx | |
111 ld = cxx | |
112 if (cros_host_ld != "") { | |
113 ld = cros_host_ld | |
114 } | |
115 extra_cflags = cros_host_extra_cflags | |
116 extra_cppflags = cros_host_extra_cppflags | |
117 extra_cxxflags = cros_host_extra_cxxflags | |
118 extra_ldflags = cros_host_extra_ldflags | |
119 | |
120 # These are passed through as toolchain_args. | |
70 cc_wrapper = "" | 121 cc_wrapper = "" |
122 is_clang = cros_host_is_clang | |
123 toolchain_cpu = host_cpu | |
124 toolchain_os = "linux" | |
125 use_sysroot = false | |
71 } | 126 } |
127 | |
128 gcc_toolchain("v8_snapshot") { | |
129 # These are args for the template. | |
130 ar = cros_v8_snapshot_ar | |
131 cc = cros_v8_snapshot_cc | |
132 cxx = cros_v8_snapshot_cxx | |
133 ld = cxx | |
134 if (cros_v8_snapshot_ld != "") { | |
135 ld = cros_v8_snapshot_ld | |
136 } | |
137 extra_cflags = cros_v8_snapshot_extra_cflags | |
138 extra_cppflags = cros_v8_snapshot_extra_cppflags | |
139 extra_cxxflags = cros_v8_snapshot_extra_cxxflags | |
140 extra_ldflags = cros_v8_snapshot_extra_ldflags | |
141 | |
142 # These are passed through as toolchain_args. | |
143 cc_wrapper = "" | |
144 is_clang = cros_v8_snapshot_is_clang | |
145 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { | |
146 toolchain_cpu = "x86" | |
147 } else { | |
148 toolchain_cpu = "x64" | |
149 } | |
150 toolchain_os = "linux" | |
151 use_sysroot = false | |
152 } | |
OLD | NEW |