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

Side by Side Diff: build/config/BUILDCONFIG.gn

Issue 1467413005: GN: Propagate top-level host_toolchain through to all toolchains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak assert for windows x86 kludge Created 5 years 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 | build/toolchain/gcc_toolchain.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 (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 # ============================================================================= 5 # =============================================================================
6 # PLATFORM SELECTION 6 # PLATFORM SELECTION
7 # ============================================================================= 7 # =============================================================================
8 # 8 #
9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name
10 # of the GN thing that encodes combinations of these things. 10 # of the GN thing that encodes combinations of these things.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 # Set to true when compiling with the Clang compiler. Typically this is used 123 # Set to true when compiling with the Clang compiler. Typically this is used
124 # to configure warnings. 124 # to configure warnings.
125 is_clang = current_os == "mac" || current_os == "ios" || 125 is_clang = current_os == "mac" || current_os == "ios" ||
126 current_os == "linux" || current_os == "chromeos" 126 current_os == "linux" || current_os == "chromeos"
127 127
128 # Allows the path to a custom target toolchain to be injected as a single 128 # Allows the path to a custom target toolchain to be injected as a single
129 # argument, and set as the default toolchain. 129 # argument, and set as the default toolchain.
130 custom_toolchain = "" 130 custom_toolchain = ""
131 131
132 # This should not normally be set as a build argument. It's here so that
133 # every toolchain can pass through the "global" value via toolchain_args().
134 host_toolchain = ""
135
132 # DON'T ADD MORE FLAGS HERE. Read the comment above. 136 # DON'T ADD MORE FLAGS HERE. Read the comment above.
133 } 137 }
134 138
135 # ============================================================================== 139 # ==============================================================================
136 # TOOLCHAIN SETUP 140 # TOOLCHAIN SETUP
137 # ============================================================================== 141 # ==============================================================================
138 # 142 #
139 # Here we set the default toolchain, as well as the variable host_toolchain 143 # Here we set the default toolchain, as well as the variable host_toolchain
140 # which will identify the toolchain corresponding to the local system when 144 # which will identify the toolchain corresponding to the local system when
141 # doing cross-compiles. When not cross-compiling, this will be the same as the 145 # doing cross-compiles. When not cross-compiling, this will be the same as the
142 # default toolchain. 146 # default toolchain.
143 # 147 #
144 # We do this before anything else to make sure we complain about any 148 # We do this before anything else to make sure we complain about any
145 # unsupported os/cpu combinations as early as possible. 149 # unsupported os/cpu combinations as early as possible.
146 150
147 if (host_os == "linux") { 151 if (host_toolchain == "") {
148 if (target_os != "linux") { 152 # This should only happen in the top level context.
149 # TODO(dpranke) - is_clang normally applies only to the target 153 # In a specific toolchain context, the toolchain_args()
150 # build, and there is no way to indicate that you want to override 154 # block should have propagated a value down.
Dirk Pranke 2015/11/25 03:48:05 In the top level context (the first time through B
151 # it for both the target build *and* the host build. Do we need to 155 assert(current_os == host_os,
152 # support this? 156 "All toolchains must plumb through host_toolchain in toolchain_args()")
153 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" 157 if (host_os == "win") {
154 } else if (is_clang) { 158 # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so
155 host_toolchain = "//build/toolchain/linux:clang_$host_cpu" 159 # use the target_cpu instead of the host_cpu.
160 assert(
161 current_cpu == target_cpu,
162 "All toolchains must plumb through host_toolchain in toolchain_args()")
156 } else { 163 } else {
157 host_toolchain = "//build/toolchain/linux:$host_cpu" 164 assert(
165 current_cpu == host_cpu,
166 "All toolchains must plumb through host_toolchain in toolchain_args()")
158 } 167 }
159 } else if (host_os == "mac") { 168
160 host_toolchain = "//build/toolchain/mac:clang_$host_cpu" 169 if (host_os == "linux") {
161 } else if (host_os == "win") { 170 if (is_clang) {
162 # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so 171 host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
163 # use the target_cpu instead of the host_cpu. 172 } else {
164 if (is_clang) { 173 host_toolchain = "//build/toolchain/linux:$host_cpu"
165 host_toolchain = "//build/toolchain/win:clang_$target_cpu" 174 }
175 } else if (host_os == "mac") {
176 host_toolchain = "//build/toolchain/mac:clang_$host_cpu"
177 } else if (host_os == "win") {
178 # TODO(crbug.com/467159): win cross-compiles don't actually work yet, so
179 # use the target_cpu instead of the host_cpu.
180 if (is_clang) {
181 host_toolchain = "//build/toolchain/win:clang_$target_cpu"
182 } else {
183 host_toolchain = "//build/toolchain/win:$target_cpu"
184 }
166 } else { 185 } else {
167 host_toolchain = "//build/toolchain/win:$target_cpu" 186 assert(false, "Unsupported host_os: $host_os")
168 } 187 }
169 } else {
170 assert(false, "Unsupported host_os: $host_os")
171 } 188 }
172 189
173 _default_toolchain = "" 190 _default_toolchain = ""
174 191
175 if (target_os == "android") { 192 if (target_os == "android") {
176 assert(host_os == "linux" || host_os == "mac", 193 assert(host_os == "linux" || host_os == "mac",
177 "Android builds are only supported on Linux and Mac hosts.") 194 "Android builds are only supported on Linux and Mac hosts.")
178 if (is_clang) { 195 if (is_clang) {
179 _default_toolchain = "//build/toolchain/android:clang_$target_cpu" 196 _default_toolchain = "//build/toolchain/android:clang_$target_cpu"
180 } else { 197 } else {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 forward_variables_from(invoker, "*") 598 forward_variables_from(invoker, "*")
582 599
583 # All shared libraries must have the sanitizer deps to properly link in 600 # All shared libraries must have the sanitizer deps to properly link in
584 # asan mode (this target will be empty in other cases). 601 # asan mode (this target will be empty in other cases).
585 if (!defined(deps)) { 602 if (!defined(deps)) {
586 deps = [] 603 deps = []
587 } 604 }
588 deps += [ "//build/config/sanitizers:deps" ] 605 deps += [ "//build/config/sanitizers:deps" ]
589 } 606 }
590 } 607 }
OLDNEW
« no previous file with comments | « no previous file | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698