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

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

Issue 2728233002: win: Decide how to include system dirs at toolchain time instead of globally. (Closed)
Patch Set: Created 3 years, 9 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
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 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")
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 command = stamp_command 305 command = stamp_command
306 description = stamp_description 306 description = stamp_description
307 } 307 }
308 tool("copy") { 308 tool("copy") {
309 command = copy_command 309 command = copy_command
310 description = copy_description 310 description = copy_description
311 } 311 }
312 } 312 }
313 } 313 }
314 314
315 if (is_clang) {
316 sys_include_prefix = "-imsvc"
317 } else {
318 # MSVC doesn't have the concept of system headers.
319 sys_include_prefix = "/I"
320 }
321
322 if (host_os == "win") { 315 if (host_os == "win") {
323 clang_cl = "clang-cl.exe" 316 clang_cl = "clang-cl.exe"
324 } else { 317 } else {
325 clang_cl = "clang-cl" 318 clang_cl = "clang-cl"
326 } 319 }
327 320
328 # 32-bit toolchains. Only define these when the target architecture is 32-bit 321 # 32-bit toolchains. Only define these when the target architecture is 32-bit
329 # since we don't do any 32-bit cross compiles when targeting 64-bit (the 322 # since we don't do any 32-bit cross compiles when targeting 64-bit (the
330 # build does generate some 64-bit stuff from 32-bit target builds). 323 # build does generate some 64-bit stuff from 32-bit target builds).
331 if (target_cpu == "x86") { 324 if (target_cpu == "x86") {
332 x86_toolchain_data = exec_script("setup_toolchain.py", 325 x86_toolchain_data = exec_script("setup_toolchain.py",
333 [ 326 [
334 visual_studio_path, 327 visual_studio_path,
335 windows_sdk_path, 328 windows_sdk_path,
336 visual_studio_runtime_dirs, 329 visual_studio_runtime_dirs,
337 "x86", 330 "x86",
338 "${sys_include_prefix}",
339 ], 331 ],
340 "scope") 332 "scope")
341 333
342 msvc_toolchain("x86") { 334 msvc_toolchain("x86") {
343 environment = "environment.x86" 335 environment = "environment.x86"
344 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\"" 336 cl = "${goma_prefix}\"${x86_toolchain_data.vc_bin_dir}/cl.exe\""
345 toolchain_args = { 337 toolchain_args = {
346 current_cpu = "x86" 338 current_cpu = "x86"
347 is_clang = false 339 is_clang = false
348 } 340 }
349 } 341 }
350 342
351 msvc_toolchain("clang_x86") { 343 msvc_toolchain("clang_x86") {
352 environment = "environment.x86" 344 environment = "environment.x86"
353 prefix = rebase_path("$clang_base_path/bin", root_build_dir) 345 prefix = rebase_path("$clang_base_path/bin", root_build_dir)
354 cl = "${goma_prefix}$prefix/${clang_cl}" 346 cl = "${goma_prefix}$prefix/${clang_cl}"
355 sys_include_flags = "${x86_toolchain_data.include_flags}" 347 sys_include_flags = "${x86_toolchain_data.include_flags_imsvc}"
356 348
357 toolchain_args = { 349 toolchain_args = {
358 current_cpu = "x86" 350 current_cpu = "x86"
359 is_clang = true 351 is_clang = true
360 } 352 }
361 } 353 }
362 } 354 }
363 355
364 # 64-bit toolchains. 356 # 64-bit toolchains.
365 x64_toolchain_data = exec_script("setup_toolchain.py", 357 x64_toolchain_data = exec_script("setup_toolchain.py",
366 [ 358 [
367 visual_studio_path, 359 visual_studio_path,
368 windows_sdk_path, 360 windows_sdk_path,
369 visual_studio_runtime_dirs, 361 visual_studio_runtime_dirs,
370 "x64", 362 "x64",
371 "${sys_include_prefix}",
372 ], 363 ],
373 "scope") 364 "scope")
374 365
375 template("win_x64_toolchains") { 366 template("win_x64_toolchains") {
376 msvc_toolchain(target_name) { 367 msvc_toolchain(target_name) {
377 environment = "environment.x64" 368 environment = "environment.x64"
378 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" 369 cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\""
379 370
380 toolchain_args = { 371 toolchain_args = {
381 if (defined(invoker.toolchain_args)) { 372 if (defined(invoker.toolchain_args)) {
382 forward_variables_from(invoker.toolchain_args, "*") 373 forward_variables_from(invoker.toolchain_args, "*")
383 } 374 }
384 is_clang = false 375 is_clang = false
385 current_cpu = "x64" 376 current_cpu = "x64"
386 } 377 }
387 } 378 }
388 379
389 msvc_toolchain("clang_" + target_name) { 380 msvc_toolchain("clang_" + target_name) {
390 environment = "environment.x64" 381 environment = "environment.x64"
391 prefix = rebase_path("$clang_base_path/bin", root_build_dir) 382 prefix = rebase_path("$clang_base_path/bin", root_build_dir)
392 cl = "${goma_prefix}$prefix/${clang_cl}" 383 cl = "${goma_prefix}$prefix/${clang_cl}"
393 sys_include_flags = "${x64_toolchain_data.include_flags}" 384 sys_include_flags = "${x64_toolchain_data.include_flags_imsvc}"
394 385
395 toolchain_args = { 386 toolchain_args = {
396 if (defined(invoker.toolchain_args)) { 387 if (defined(invoker.toolchain_args)) {
397 forward_variables_from(invoker.toolchain_args, "*") 388 forward_variables_from(invoker.toolchain_args, "*")
398 } 389 }
399 is_clang = true 390 is_clang = true
400 current_cpu = "x64" 391 current_cpu = "x64"
401 } 392 }
402 } 393 }
403 } 394 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 msvc_toolchain("winrt_x64") { 430 msvc_toolchain("winrt_x64") {
440 environment = "environment.winrt_x64" 431 environment = "environment.winrt_x64"
441 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" 432 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
442 433
443 toolchain_args = { 434 toolchain_args = {
444 is_clang = false 435 is_clang = false
445 current_cpu = "x64" 436 current_cpu = "x64"
446 } 437 }
447 } 438 }
448 } 439 }
OLDNEW
« no previous file with comments | « no previous file | build/toolchain/win/setup_toolchain.py » ('j') | build/toolchain/win/setup_toolchain.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698