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 import("//build/config/clang/clang.gni") | 5 import("//build/config/clang/clang.gni") |
6 import("//build/config/compiler/compiler.gni") | 6 import("//build/config/compiler/compiler.gni") |
7 import("//build/config/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
8 import("//build/config/win/visual_studio_version.gni") | 8 import("//build/config/win/visual_studio_version.gni") |
9 import("//build/toolchain/goma.gni") | 9 import("//build/toolchain/goma.gni") |
10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
11 import("//build/toolchain/concurrent_links.gni") | |
12 | 11 |
13 # Should only be running on Windows. | 12 # Should only be running on Windows. |
14 assert(is_win) | 13 assert(is_win) |
15 | 14 |
16 # Setup the Visual Studio state. | 15 # Setup the Visual Studio state. |
17 # | 16 # |
18 # Its arguments are the VS path and the compiler wrapper tool. It will write | 17 # Its arguments are the VS path and the compiler wrapper tool. It will write |
19 # "environment.x86" and "environment.x64" to the build directory and return a | 18 # "environment.x86" and "environment.x64" to the build directory and return a |
20 # list to us. | 19 # list to us. |
21 gyp_win_tool_path = | 20 gyp_win_tool_path = |
(...skipping 20 matching lines...) Expand all Loading... |
42 configuration_name, | 41 configuration_name, |
43 target_cpu, | 42 target_cpu, |
44 ]) | 43 ]) |
45 } | 44 } |
46 | 45 |
47 # Parameters: | 46 # Parameters: |
48 # toolchain_cpu: current_cpu to pass as a build arg | 47 # toolchain_cpu: current_cpu to pass as a build arg |
49 # toolchain_os: current_os to pass as a build arg | 48 # toolchain_os: current_os to pass as a build arg |
50 # environment: File name of environment file. | 49 # environment: File name of environment file. |
51 template("msvc_toolchain") { | 50 template("msvc_toolchain") { |
52 if (defined(invoker.concurrent_links)) { | |
53 # concurrent_links is picked up from the declare_arg() otherwise. | |
54 concurrent_links = invoker.concurrent_links | |
55 } | |
56 | |
57 env = invoker.environment | 51 env = invoker.environment |
58 | 52 |
59 if (invoker.is_clang && host_os != "win") { | 53 if (invoker.is_clang && host_os != "win") { |
60 # This toolchain definition uses response files for compilations. GN uses | 54 # This toolchain definition uses response files for compilations. GN uses |
61 # the quoting rules of the host OS, while clang-cl always defaults to | 55 # the quoting rules of the host OS, while clang-cl always defaults to |
62 # cmd.exe quoting rules for parsing response files. Tell clang-cl to use | 56 # cmd.exe quoting rules for parsing response files. Tell clang-cl to use |
63 # POSIX quoting rules, so it can understand what GN generates. | 57 # POSIX quoting rules, so it can understand what GN generates. |
64 cl = "${invoker.cl} --rsp-quoting=posix" | 58 cl = "${invoker.cl} --rsp-quoting=posix" |
65 } else { | 59 } else { |
66 cl = invoker.cl | 60 cl = invoker.cl |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 # The use of inputs_newline is to work around a fixed per-line buffer | 169 # The use of inputs_newline is to work around a fixed per-line buffer |
176 # size in the linker. | 170 # size in the linker. |
177 rspfile_content = "{{inputs_newline}}" | 171 rspfile_content = "{{inputs_newline}}" |
178 } | 172 } |
179 | 173 |
180 tool("solink") { | 174 tool("solink") { |
181 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll | 175 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll |
182 libname = "${dllname}.lib" # e.g. foo.dll.lib | 176 libname = "${dllname}.lib" # e.g. foo.dll.lib |
183 pdbname = "${dllname}.pdb" | 177 pdbname = "${dllname}.pdb" |
184 rspfile = "${dllname}.rsp" | 178 rspfile = "${dllname}.rsp" |
| 179 pool = "//build/toolchain:link_pool($default_toolchain)" |
185 | 180 |
186 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 181 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
187 | 182 |
188 default_output_extension = ".dll" | 183 default_output_extension = ".dll" |
189 default_output_dir = "{{root_out_dir}}" | 184 default_output_dir = "{{root_out_dir}}" |
190 description = "LINK(DLL) {{output}}" | 185 description = "LINK(DLL) {{output}}" |
191 outputs = [ | 186 outputs = [ |
192 dllname, | 187 dllname, |
193 libname, | 188 libname, |
194 ] | 189 ] |
(...skipping 12 matching lines...) Expand all Loading... |
207 | 202 |
208 # The use of inputs_newline is to work around a fixed per-line buffer | 203 # The use of inputs_newline is to work around a fixed per-line buffer |
209 # size in the linker. | 204 # size in the linker. |
210 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 205 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
211 } | 206 } |
212 | 207 |
213 tool("solink_module") { | 208 tool("solink_module") { |
214 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll | 209 dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # e
.g. foo.dll |
215 pdbname = "${dllname}.pdb" | 210 pdbname = "${dllname}.pdb" |
216 rspfile = "${dllname}.rsp" | 211 rspfile = "${dllname}.rsp" |
| 212 pool = "//build/toolchain:link_pool($default_toolchain)" |
217 | 213 |
218 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/DLL /OUT:$dllname /PDB:$pdbname @$rspfile" | 214 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/DLL /OUT:$dllname /PDB:$pdbname @$rspfile" |
219 | 215 |
220 default_output_extension = ".dll" | 216 default_output_extension = ".dll" |
221 default_output_dir = "{{root_out_dir}}" | 217 default_output_dir = "{{root_out_dir}}" |
222 description = "LINK_MODULE(DLL) {{output}}" | 218 description = "LINK_MODULE(DLL) {{output}}" |
223 outputs = [ | 219 outputs = [ |
224 dllname, | 220 dllname, |
225 ] | 221 ] |
226 if (symbol_level != 0) { | 222 if (symbol_level != 0) { |
227 outputs += [ pdbname ] | 223 outputs += [ pdbname ] |
228 } | 224 } |
229 runtime_outputs = outputs | 225 runtime_outputs = outputs |
230 | 226 |
231 # The use of inputs_newline is to work around a fixed per-line buffer | 227 # The use of inputs_newline is to work around a fixed per-line buffer |
232 # size in the linker. | 228 # size in the linker. |
233 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" | 229 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" |
234 } | 230 } |
235 | 231 |
236 tool("link") { | 232 tool("link") { |
237 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 233 exename = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
238 pdbname = "$exename.pdb" | 234 pdbname = "$exename.pdb" |
239 rspfile = "$exename.rsp" | 235 rspfile = "$exename.rsp" |
| 236 pool = "//build/toolchain:link_pool($default_toolchain)" |
240 | 237 |
241 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/OUT:$exename /PDB:$pdbname @$rspfile" | 238 command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo
/OUT:$exename /PDB:$pdbname @$rspfile" |
242 | 239 |
243 default_output_extension = ".exe" | 240 default_output_extension = ".exe" |
244 default_output_dir = "{{root_out_dir}}" | 241 default_output_dir = "{{root_out_dir}}" |
245 description = "LINK {{output}}" | 242 description = "LINK {{output}}" |
246 outputs = [ | 243 outputs = [ |
247 exename, | 244 exename, |
248 ] | 245 ] |
249 if (symbol_level != 0) { | 246 if (symbol_level != 0) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 windows_sdk_path, | 343 windows_sdk_path, |
347 visual_studio_runtime_dirs, | 344 visual_studio_runtime_dirs, |
348 "x64", | 345 "x64", |
349 "${sys_include_prefix}", | 346 "${sys_include_prefix}", |
350 ], | 347 ], |
351 "scope") | 348 "scope") |
352 | 349 |
353 template("win_x64_toolchains") { | 350 template("win_x64_toolchains") { |
354 # TODO(mcgrathr): These assignments are only required because of | 351 # TODO(mcgrathr): These assignments are only required because of |
355 # crbug.com/395883. Drop them if that ever gets fixed in GN. | 352 # crbug.com/395883. Drop them if that ever gets fixed in GN. |
356 concurrent_links = invoker.concurrent_links | |
357 goma_prefix = invoker.goma_prefix | 353 goma_prefix = invoker.goma_prefix |
358 x64_toolchain_data = invoker.x64_toolchain_data | 354 x64_toolchain_data = invoker.x64_toolchain_data |
359 clang_cl = invoker.clang_cl | 355 clang_cl = invoker.clang_cl |
360 | 356 |
361 msvc_toolchain(target_name) { | 357 msvc_toolchain(target_name) { |
362 environment = "environment.x64" | 358 environment = "environment.x64" |
363 toolchain_cpu = "x64" | 359 toolchain_cpu = "x64" |
364 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" | 360 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" |
365 is_clang = false | 361 is_clang = false |
366 | 362 |
(...skipping 17 matching lines...) Expand all Loading... |
384 # the existing value, so we need to set it explicitly. | 380 # the existing value, so we need to set it explicitly. |
385 if (defined(invoker.is_component_build)) { | 381 if (defined(invoker.is_component_build)) { |
386 is_component_build = invoker.is_component_build | 382 is_component_build = invoker.is_component_build |
387 } | 383 } |
388 } | 384 } |
389 } | 385 } |
390 | 386 |
391 win_x64_toolchains("x64") { | 387 win_x64_toolchains("x64") { |
392 # TODO(mcgrathr): These assignments are only required because of | 388 # TODO(mcgrathr): These assignments are only required because of |
393 # crbug.com/395883. Drop them if that ever gets fixed in GN. | 389 # crbug.com/395883. Drop them if that ever gets fixed in GN. |
394 concurrent_links = concurrent_links | |
395 goma_prefix = goma_prefix | 390 goma_prefix = goma_prefix |
396 x64_toolchain_data = x64_toolchain_data | 391 x64_toolchain_data = x64_toolchain_data |
397 } | 392 } |
398 | 393 |
399 # The nacl_win64 toolchain is nearly identical to the plain x64 toolchain. | 394 # The nacl_win64 toolchain is nearly identical to the plain x64 toolchain. |
400 # It's used solely for building nacl64.exe (//components/nacl/broker:nacl64). | 395 # It's used solely for building nacl64.exe (//components/nacl/broker:nacl64). |
401 # The only reason it's a separate toolchain is so that it can force | 396 # The only reason it's a separate toolchain is so that it can force |
402 # is_component_build to false in the toolchain_args() block, because | 397 # is_component_build to false in the toolchain_args() block, because |
403 # building nacl64.exe in component style does not work. | 398 # building nacl64.exe in component style does not work. |
404 win_x64_toolchains("nacl_win64") { | 399 win_x64_toolchains("nacl_win64") { |
405 is_component_build = false | 400 is_component_build = false |
406 | 401 |
407 # TODO(mcgrathr): These assignments are only required because of | 402 # TODO(mcgrathr): These assignments are only required because of |
408 # crbug.com/395883. Drop them if that ever gets fixed in GN. | 403 # crbug.com/395883. Drop them if that ever gets fixed in GN. |
409 concurrent_links = concurrent_links | |
410 goma_prefix = goma_prefix | 404 goma_prefix = goma_prefix |
411 x64_toolchain_data = x64_toolchain_data | 405 x64_toolchain_data = x64_toolchain_data |
412 clang_cl = clang_cl | 406 clang_cl = clang_cl |
413 } | 407 } |
414 | 408 |
415 # WinRT toolchains. Only define these when targeting them. | 409 # WinRT toolchains. Only define these when targeting them. |
416 # | 410 # |
417 # NOTE: This is currently broken because it references vc_bin_dir. brettw@ | 411 # NOTE: This is currently broken because it references vc_bin_dir. brettw@ |
418 # changed this around a bit, and I don't know what this should be set to | 412 # changed this around a bit, and I don't know what this should be set to |
419 # in terms of what setup_toolchain returns for a certain CPU architecture. | 413 # in terms of what setup_toolchain returns for a certain CPU architecture. |
(...skipping 10 matching lines...) Expand all Loading... |
430 | 424 |
431 msvc_toolchain("winrt_x64") { | 425 msvc_toolchain("winrt_x64") { |
432 environment = "environment.winrt_x64" | 426 environment = "environment.winrt_x64" |
433 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" | 427 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" |
434 is_clang = false | 428 is_clang = false |
435 | 429 |
436 toolchain_cpu = "x64" | 430 toolchain_cpu = "x64" |
437 toolchain_os = current_os | 431 toolchain_os = current_os |
438 } | 432 } |
439 } | 433 } |
OLD | NEW |