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

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

Issue 2613503002: GN: avoid going through compiler wrapper for "link" tool for macOS/iOS. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | 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 import("//build/config/clang/clang.gni") 10 import("//build/config/clang/clang.gni")
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 # Populate toolchain args from the invoker. 76 # Populate toolchain args from the invoker.
77 forward_variables_from(invoker.toolchain_args, "*") 77 forward_variables_from(invoker.toolchain_args, "*")
78 78
79 # The host toolchain value computed by the default toolchain's setup 79 # The host toolchain value computed by the default toolchain's setup
80 # needs to be passed through unchanged to all secondary toolchains to 80 # needs to be passed through unchanged to all secondary toolchains to
81 # ensure that it's always the same, regardless of the values that may be 81 # ensure that it's always the same, regardless of the values that may be
82 # set on those toolchains. 82 # set on those toolchains.
83 host_toolchain = host_toolchain 83 host_toolchain = host_toolchain
84 } 84 }
85 85
86 # Supports building with the version of clang shipped with Xcode when
87 # targetting iOS by not respecting clang_base_path.
88 if (toolchain_args.current_os == "ios" && use_xcode_clang) {
89 prefix = ""
90 } else {
91 prefix = rebase_path("$clang_base_path/bin/", root_build_dir)
92 }
93
94 _cc = "${prefix}clang"
95 _cxx = "${prefix}clang++"
96
86 # When the invoker has explicitly overridden use_goma or cc_wrapper in the 97 # When the invoker has explicitly overridden use_goma or cc_wrapper in the
87 # toolchain args, use those values, otherwise default to the global one. 98 # toolchain args, use those values, otherwise default to the global one.
88 # This works because the only reasonable override that toolchains might 99 # This works because the only reasonable override that toolchains might
89 # supply for these values are to force-disable them. 100 # supply for these values are to force-disable them.
90 if (defined(toolchain_args.use_goma)) { 101 if (defined(toolchain_args.use_goma)) {
91 toolchain_uses_goma = toolchain_args.use_goma 102 toolchain_uses_goma = toolchain_args.use_goma
92 } else { 103 } else {
93 toolchain_uses_goma = use_goma 104 toolchain_uses_goma = use_goma
94 } 105 }
95 if (defined(toolchain_args.cc_wrapper)) { 106 if (defined(toolchain_args.cc_wrapper)) {
96 toolchain_cc_wrapper = toolchain_args.cc_wrapper 107 toolchain_cc_wrapper = toolchain_args.cc_wrapper
97 } else { 108 } else {
98 toolchain_cc_wrapper = cc_wrapper 109 toolchain_cc_wrapper = cc_wrapper
99 } 110 }
100 111
101 # Compute the compiler prefix. 112 # Compute the compiler prefix.
102 if (toolchain_uses_goma) { 113 if (toolchain_uses_goma) {
103 assert(toolchain_cc_wrapper == "", 114 assert(toolchain_cc_wrapper == "",
104 "Goma and cc_wrapper can't be used together.") 115 "Goma and cc_wrapper can't be used together.")
105 compiler_prefix = "$goma_dir/gomacc " 116 compiler_prefix = "$goma_dir/gomacc "
106 } else if (toolchain_cc_wrapper != "") { 117 } else if (toolchain_cc_wrapper != "") {
107 compiler_prefix = toolchain_cc_wrapper + " " 118 compiler_prefix = toolchain_cc_wrapper + " "
108 } else { 119 } else {
109 compiler_prefix = "" 120 compiler_prefix = ""
110 } 121 }
111 122
112 if (toolchain_args.current_os != "ios" || !use_xcode_clang) { 123 cc = compiler_prefix + _cc
113 compiler_prefix += rebase_path("$clang_base_path/bin/", root_build_dir) 124 cxx = compiler_prefix + _cxx
114 } 125 ld = _cxx
115
116 cc = "${compiler_prefix}clang"
117 cxx = "${compiler_prefix}clang++"
118 ld = cxx
119 126
120 linker_driver = 127 linker_driver =
121 "TOOL_VERSION=${tool_versions.linker_driver} " + 128 "TOOL_VERSION=${tool_versions.linker_driver} " +
122 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) 129 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir)
123 130
124 # On iOS, the final applications are assembled using lipo (to support fat 131 # On iOS, the final applications are assembled using lipo (to support fat
125 # builds). The correct flags are passed to the linker_driver.py script 132 # builds). The correct flags are passed to the linker_driver.py script
126 # directly during the lipo call. 133 # directly during the lipo call.
127 if (toolchain_args.current_os != "ios") { 134 if (toolchain_args.current_os != "ios") {
128 _enable_dsyms = enable_dsyms 135 _enable_dsyms = enable_dsyms
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 460 }
454 } 461 }
455 462
456 mac_toolchain("ios_clang_x64") { 463 mac_toolchain("ios_clang_x64") {
457 toolchain_args = { 464 toolchain_args = {
458 current_cpu = "x64" 465 current_cpu = "x64"
459 current_os = "ios" 466 current_os = "ios"
460 } 467 }
461 } 468 }
462 } 469 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698