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

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

Issue 1128903005: Enable cross compile to android from mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « build/toolchain/linux/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires
6 # some enhancements since the commands on Mac are slightly different than on 6 # some enhancements since the commands on Mac are slightly different than on
7 # Linux. 7 # Linux.
8 8
9 import("../goma.gni") 9 import("../goma.gni")
10 10
11 # Should only be running on Mac. 11 assert(host_os == "mac")
12 assert(is_mac || is_ios)
13 12
14 import("//build/toolchain/clang.gni") 13 import("//build/toolchain/clang.gni")
15 import("//build/toolchain/goma.gni") 14 import("//build/toolchain/goma.gni")
16 15
17 if (use_goma) { 16 if (use_goma) {
18 goma_prefix = "$goma_dir/gomacc " 17 goma_prefix = "$goma_dir/gomacc "
19 } else { 18 } else {
20 goma_prefix = "" 19 goma_prefix = ""
21 } 20 }
22 21
23 if (is_clang) {
24 cc = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang",
25 root_build_dir)
26 cxx = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang++",
27 root_build_dir)
28 } else {
29 cc = "gcc"
30 cxx = "g++"
31 }
32 cc = goma_prefix + cc
33 cxx = goma_prefix + cxx
34 ld = cxx
35
36 # This will copy the gyp-mac-tool to the build directory. We pass in the source 22 # This will copy the gyp-mac-tool to the build directory. We pass in the source
37 # file of the win tool. 23 # file of the win tool.
38 gyp_mac_tool_source = 24 gyp_mac_tool_source =
39 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) 25 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir)
40 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ]) 26 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ])
41 27
42 # Shared toolchain definition. Invocations should set toolchain_os to set the 28 # Shared toolchain definition. Invocations should set toolchain_os to set the
43 # build args in this definition. 29 # build args in this definition.
44 template("mac_clang_toolchain") { 30 template("mac_clang_toolchain") {
45 toolchain(target_name) { 31 toolchain(target_name) {
46 assert(defined(invoker.cc), 32 assert(defined(invoker.cc),
47 "mac_clang_toolchain() must specify a \"cc\" value") 33 "mac_clang_toolchain() must specify a \"cc\" value")
48 assert(defined(invoker.cxx), 34 assert(defined(invoker.cxx),
49 "mac_clang_toolchain() must specify a \"cxx\" value") 35 "mac_clang_toolchain() must specify a \"cxx\" value")
50 assert(defined(invoker.ld), 36 assert(defined(invoker.ld),
51 "mac_clang_toolchain() must specify a \"ld\" value") 37 "mac_clang_toolchain() must specify a \"ld\" value")
38 assert(defined(invoker.toolchain_cpu),
39 "mac_clang_toolchain() must specify a \"toolchain_cpu\"")
52 assert(defined(invoker.toolchain_os), 40 assert(defined(invoker.toolchain_os),
53 "mac_clang_toolchain() must specify a \"toolchain_os\"") 41 "mac_clang_toolchain() must specify a \"toolchain_os\"")
54 42
55 # We can't do string interpolation ($ in strings) on things with dots in 43 # We can't do string interpolation ($ in strings) on things with dots in
56 # them. To allow us to use $cc below, for example, we create copies of 44 # them. To allow us to use $cc below, for example, we create copies of
57 # these values in our scope. 45 # these values in our scope.
58 cc = invoker.cc 46 cc = invoker.cc
59 cxx = invoker.cxx 47 cxx = invoker.cxx
60 ld = invoker.ld 48 ld = invoker.ld
61 49
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 command = "touch {{output}}" 175 command = "touch {{output}}"
188 description = "STAMP {{output}}" 176 description = "STAMP {{output}}"
189 } 177 }
190 178
191 tool("copy") { 179 tool("copy") {
192 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} & & cp -af {{source}} {{output}})" 180 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} & & cp -af {{source}} {{output}})"
193 description = "COPY {{source}} {{output}}" 181 description = "COPY {{source}} {{output}}"
194 } 182 }
195 183
196 toolchain_args() { 184 toolchain_args() {
185 current_cpu = invoker.toolchain_cpu
197 current_os = invoker.toolchain_os 186 current_os = invoker.toolchain_os
187
188 # These values need to be passed through unchanged.
189 target_os = target_os
190 target_cpu = target_cpu
191
192 if (defined(invoker.is_clang)) {
193 is_clang = invoker.is_clang
194 }
198 } 195 }
199 } 196 }
200 } 197 }
201 198
202 # Toolchain representing the target build (either mac or iOS). 199 mac_clang_toolchain("clang_arm") {
203 mac_clang_toolchain("clang") { 200 toolchain_cpu = "arm"
204 toolchain_os = current_os 201 toolchain_os = "mac"
202 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
203 root_build_dir)
204 cc = "${goma_prefix}$prefix/clang"
205 cxx = "${goma_prefix}$prefix/clang++"
206 ld = cxx
207 is_clang = true
205 } 208 }
206 209
207 # This toolchain provides a way for iOS target compiles to reference targets 210 mac_clang_toolchain("arm") {
brettw 2015/05/13 22:20:48 If you're making this optionally clang or not, you
cdotstout 2015/05/14 18:20:26 Done.
208 # compiled for the host system. It just overrides the OS back to "mac". 211 toolchain_cpu = "arm"
209 mac_clang_toolchain("host_clang") {
210 toolchain_os = "mac" 212 toolchain_os = "mac"
213 cc = "${goma_prefix}/gcc"
214 cxx = "${goma_prefix}/g++"
215 ld = cxx
216 is_clang = false
211 } 217 }
218
219 mac_clang_toolchain("clang_x64") {
220 toolchain_cpu = "x64"
221 toolchain_os = "mac"
222 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
223 root_build_dir)
224 cc = "${goma_prefix}$prefix/clang"
225 cxx = "${goma_prefix}$prefix/clang++"
226 ld = cxx
227 is_clang = true
228 }
229
230 mac_clang_toolchain("x64") {
231 toolchain_cpu = "x64"
232 toolchain_os = "mac"
233 cc = "${goma_prefix}/gcc"
234 cxx = "${goma_prefix}/g++"
235 ld = cxx
236 is_clang = false
237 }
OLDNEW
« no previous file with comments | « build/toolchain/linux/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698