OLD | NEW |
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 import("//build/config/ios/ios_sdk.gni") | 10 import("//build/config/ios/ios_sdk.gni") |
11 import("//build/config/mac/mac_sdk.gni") | 11 import("//build/config/mac/mac_sdk.gni") |
12 import("//build/config/mac/symbols.gni") | 12 import("//build/config/mac/symbols.gni") |
13 | 13 |
14 assert(host_os == "mac") | 14 assert(host_os == "mac") |
15 | 15 |
16 import("//build/toolchain/cc_wrapper.gni") | 16 import("//build/toolchain/cc_wrapper.gni") |
17 import("//build/toolchain/goma.gni") | 17 import("//build/toolchain/goma.gni") |
18 import("//build/toolchain/toolchain.gni") | 18 import("//build/toolchain/toolchain.gni") |
19 import("//build/toolchain/concurrent_links.gni") | 19 import("//build/toolchain/concurrent_links.gni") |
20 | 20 |
21 if (use_goma) { | 21 if (use_goma) { |
22 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") | 22 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") |
23 compiler_prefix = "$goma_dir/gomacc " | 23 compiler_prefix = "$goma_dir/gomacc " |
24 } else if (cc_wrapper != "") { | 24 } else if (cc_wrapper != "") { |
25 compiler_prefix = cc_wrapper + " " | 25 compiler_prefix = cc_wrapper + " " |
26 } else { | 26 } else { |
27 compiler_prefix = "" | 27 compiler_prefix = "" |
28 } | 28 } |
29 | 29 |
30 if (use_xcode_clang) { | 30 if (!use_xcode_clang) { |
31 _clang_prefix = "" | 31 compiler_prefix = compiler_prefix + |
32 } else { | 32 rebase_path("//third_party/llvm-build/Release+Asserts/bin/", |
33 _clang_prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin/", | 33 root_build_dir) |
34 root_build_dir) | |
35 } | 34 } |
36 | 35 |
37 if (current_toolchain == default_toolchain) { | 36 if (current_toolchain == default_toolchain) { |
38 # Reduce the number of tasks using the copy_bundle_data and compile_xcassets | 37 # Reduce the number of tasks using the copy_bundle_data and compile_xcassets |
39 # tools as they can cause lots of I/O contention when invoking ninja with a | 38 # tools as they can cause lots of I/O contention when invoking ninja with a |
40 # large number of parallel jobs (e.g. when using distributed build like goma). | 39 # large number of parallel jobs (e.g. when using distributed build like goma). |
41 pool("bundle_pool") { | 40 pool("bundle_pool") { |
42 depth = concurrent_links | 41 depth = concurrent_links |
43 } | 42 } |
44 } | 43 } |
(...skipping 25 matching lines...) Expand all Loading... |
70 root_build_dir), | 69 root_build_dir), |
71 "trim scope") | 70 "trim scope") |
72 | 71 |
73 # Work around for unused variable warning in template https://crbug.com/395883. | 72 # Work around for unused variable warning in template https://crbug.com/395883. |
74 assert(tool_versions != "") | 73 assert(tool_versions != "") |
75 | 74 |
76 # Shared toolchain definition. Invocations should set toolchain_os to set the | 75 # Shared toolchain definition. Invocations should set toolchain_os to set the |
77 # build args in this definition. | 76 # build args in this definition. |
78 template("mac_toolchain") { | 77 template("mac_toolchain") { |
79 toolchain(target_name) { | 78 toolchain(target_name) { |
80 assert(defined(invoker.cc), "mac_toolchain() must specify a \"cc\" value") | |
81 assert(defined(invoker.cxx), "mac_toolchain() must specify a \"cxx\" value") | |
82 assert(defined(invoker.ld), "mac_toolchain() must specify a \"ld\" value") | |
83 assert(defined(invoker.toolchain_cpu), | 79 assert(defined(invoker.toolchain_cpu), |
84 "mac_toolchain() must specify a \"toolchain_cpu\"") | 80 "mac_toolchain() must specify a \"toolchain_cpu\"") |
85 assert(defined(invoker.toolchain_os), | 81 assert(defined(invoker.toolchain_os), |
86 "mac_toolchain() must specify a \"toolchain_os\"") | 82 "mac_toolchain() must specify a \"toolchain_os\"") |
87 | 83 |
88 # concurrent_links is picked up from the declare_arg(). | 84 # concurrent_links is picked up from the declare_arg(). |
89 | 85 |
90 # We can't do string interpolation ($ in strings) on things with dots in | 86 cc = "${compiler_prefix}clang" |
91 # them. To allow us to use $cc below, for example, we create copies of | 87 cxx = "${compiler_prefix}clang++" |
92 # these values in our scope. | 88 ld = cxx |
93 cc = invoker.cc | |
94 cxx = invoker.cxx | |
95 ld = invoker.ld | |
96 | 89 |
97 linker_driver = | 90 linker_driver = |
98 "TOOL_VERSION=${tool_versions.linker_driver} " + | 91 "TOOL_VERSION=${tool_versions.linker_driver} " + |
99 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) | 92 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
100 | 93 |
101 # Make these apply to all tools below. | 94 # Make these apply to all tools below. |
102 lib_switch = "-l" | 95 lib_switch = "-l" |
103 lib_dir_switch = "-L" | 96 lib_dir_switch = "-L" |
104 | 97 |
105 # Object files go in this directory. Use label_name instead of | 98 # Object files go in this directory. Use label_name instead of |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 336 } |
344 | 337 |
345 toolchain_args() { | 338 toolchain_args() { |
346 current_cpu = invoker.toolchain_cpu | 339 current_cpu = invoker.toolchain_cpu |
347 current_os = invoker.toolchain_os | 340 current_os = invoker.toolchain_os |
348 | 341 |
349 # These values need to be passed through unchanged. | 342 # These values need to be passed through unchanged. |
350 host_toolchain = host_toolchain | 343 host_toolchain = host_toolchain |
351 target_os = target_os | 344 target_os = target_os |
352 target_cpu = target_cpu | 345 target_cpu = target_cpu |
353 | 346 is_clang = true |
354 if (defined(invoker.is_clang)) { | |
355 is_clang = invoker.is_clang | |
356 } | |
357 } | 347 } |
358 } | 348 } |
359 } | 349 } |
360 | 350 |
361 mac_toolchain("clang_arm") { | 351 mac_toolchain("clang_arm") { |
362 toolchain_cpu = "arm" | 352 toolchain_cpu = "arm" |
363 toolchain_os = "mac" | 353 toolchain_os = "mac" |
364 cc = "${compiler_prefix}${_clang_prefix}clang" | |
365 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
366 ld = cxx | |
367 is_clang = true | |
368 } | |
369 | |
370 mac_toolchain("arm") { | |
371 toolchain_cpu = "arm" | |
372 toolchain_os = "mac" | |
373 cc = "${compiler_prefix}gcc" | |
374 cxx = "${compiler_prefix}g++" | |
375 ld = cxx | |
376 is_clang = false | |
377 } | 354 } |
378 | 355 |
379 mac_toolchain("clang_x64") { | 356 mac_toolchain("clang_x64") { |
380 toolchain_cpu = "x64" | 357 toolchain_cpu = "x64" |
381 toolchain_os = "mac" | 358 toolchain_os = "mac" |
382 cc = "${compiler_prefix}${_clang_prefix}clang" | |
383 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
384 ld = cxx | |
385 is_clang = true | |
386 } | |
387 | |
388 mac_toolchain("x64") { | |
389 toolchain_cpu = "x64" | |
390 toolchain_os = "mac" | |
391 cc = "${compiler_prefix}gcc" | |
392 cxx = "${compiler_prefix}g++" | |
393 ld = cxx | |
394 is_clang = false | |
395 } | 359 } |
396 | 360 |
397 mac_toolchain("ios_clang_arm") { | 361 mac_toolchain("ios_clang_arm") { |
398 toolchain_cpu = "arm" | 362 toolchain_cpu = "arm" |
399 toolchain_os = "mac" | 363 toolchain_os = "ios" |
400 cc = "${compiler_prefix}${_clang_prefix}clang" | |
401 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
402 ld = cxx | |
403 is_clang = true | |
404 } | 364 } |
405 | 365 |
406 mac_toolchain("ios_clang_arm64") { | 366 mac_toolchain("ios_clang_arm64") { |
407 toolchain_cpu = "arm64" | 367 toolchain_cpu = "arm64" |
408 toolchain_os = "mac" | 368 toolchain_os = "ios" |
409 cc = "${compiler_prefix}${_clang_prefix}clang" | |
410 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
411 ld = cxx | |
412 is_clang = true | |
413 } | 369 } |
414 | 370 |
415 mac_toolchain("ios_clang_x86") { | 371 mac_toolchain("ios_clang_x86") { |
416 toolchain_cpu = "x86" | 372 toolchain_cpu = "x86" |
417 toolchain_os = "mac" | 373 toolchain_os = "ios" |
418 cc = "${compiler_prefix}${_clang_prefix}clang" | |
419 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
420 ld = cxx | |
421 is_clang = true | |
422 } | 374 } |
423 | 375 |
424 mac_toolchain("ios_clang_x64") { | 376 mac_toolchain("ios_clang_x64") { |
425 toolchain_cpu = "x64" | 377 toolchain_cpu = "x64" |
426 toolchain_os = "mac" | 378 toolchain_os = "ios" |
427 cc = "${compiler_prefix}${_clang_prefix}clang" | |
428 cxx = "${compiler_prefix}${_clang_prefix}clang++" | |
429 ld = cxx | |
430 is_clang = true | |
431 } | 379 } |
OLD | NEW |