github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/toolchains/preconfig/win_1803/bazel_025/cc_toolchain_config.bzl (about) 1 # Copyright 2019 The Bazel Authors. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 """A Starlark cc_toolchain configuration rule""" 16 17 load( 18 "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", 19 "action_config", 20 "artifact_name_pattern", 21 "env_entry", 22 "env_set", 23 "feature", 24 "feature_set", 25 "flag_group", 26 "flag_set", 27 "make_variable", 28 "tool", 29 "tool_path", 30 "variable_with_value", 31 "with_feature_set", 32 ) 33 load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") 34 35 all_compile_actions = [ 36 ACTION_NAMES.c_compile, 37 ACTION_NAMES.cpp_compile, 38 ACTION_NAMES.linkstamp_compile, 39 ACTION_NAMES.assemble, 40 ACTION_NAMES.preprocess_assemble, 41 ACTION_NAMES.cpp_header_parsing, 42 ACTION_NAMES.cpp_module_compile, 43 ACTION_NAMES.cpp_module_codegen, 44 ACTION_NAMES.clif_match, 45 ACTION_NAMES.lto_backend, 46 ] 47 48 all_cpp_compile_actions = [ 49 ACTION_NAMES.cpp_compile, 50 ACTION_NAMES.linkstamp_compile, 51 ACTION_NAMES.cpp_header_parsing, 52 ACTION_NAMES.cpp_module_compile, 53 ACTION_NAMES.cpp_module_codegen, 54 ACTION_NAMES.clif_match, 55 ] 56 57 preprocessor_compile_actions = [ 58 ACTION_NAMES.c_compile, 59 ACTION_NAMES.cpp_compile, 60 ACTION_NAMES.linkstamp_compile, 61 ACTION_NAMES.preprocess_assemble, 62 ACTION_NAMES.cpp_header_parsing, 63 ACTION_NAMES.cpp_module_compile, 64 ACTION_NAMES.clif_match, 65 ] 66 67 codegen_compile_actions = [ 68 ACTION_NAMES.c_compile, 69 ACTION_NAMES.cpp_compile, 70 ACTION_NAMES.linkstamp_compile, 71 ACTION_NAMES.assemble, 72 ACTION_NAMES.preprocess_assemble, 73 ACTION_NAMES.cpp_module_codegen, 74 ACTION_NAMES.lto_backend, 75 ] 76 77 all_link_actions = [ 78 ACTION_NAMES.cpp_link_executable, 79 ACTION_NAMES.cpp_link_dynamic_library, 80 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 81 ] 82 83 def _windows_msvc_impl(ctx): 84 toolchain_identifier = "msvc_x64" 85 host_system_name = "local" 86 target_system_name = "local" 87 target_cpu = "x64_windows" 88 target_libc = "msvcrt" 89 compiler = "msvc-cl" 90 abi_version = "local" 91 abi_libc_version = "local" 92 cc_target_os = None 93 builtin_sysroot = None 94 95 cxx_builtin_include_directories = [ 96 # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. 97 "C:\\botcode\\w", 98 "c:/tools/msys64/usr/", 99 "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", 100 "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", 101 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", 102 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", 103 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt", 104 ] 105 106 cpp_link_nodeps_dynamic_library_action = action_config( 107 action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library, 108 implies = [ 109 "nologo", 110 "shared_flag", 111 "linkstamps", 112 "output_execpath_flags", 113 "input_param_flags", 114 "user_link_flags", 115 "default_link_flags", 116 "linker_subsystem_flag", 117 "linker_param_file", 118 "msvc_env", 119 "no_stripping", 120 "has_configured_linker_path", 121 "def_file", 122 ], 123 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/link.exe")], 124 ) 125 126 cpp_link_static_library_action = action_config( 127 action_name = ACTION_NAMES.cpp_link_static_library, 128 implies = [ 129 "nologo", 130 "archiver_flags", 131 "input_param_flags", 132 "linker_param_file", 133 "msvc_env", 134 ], 135 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/lib.exe")], 136 ) 137 138 assemble_action = action_config( 139 action_name = ACTION_NAMES.assemble, 140 implies = [ 141 "compiler_input_flags", 142 "compiler_output_flags", 143 "nologo", 144 "msvc_env", 145 "sysroot", 146 ], 147 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/ml64.exe")], 148 ) 149 150 preprocess_assemble_action = action_config( 151 action_name = ACTION_NAMES.preprocess_assemble, 152 implies = [ 153 "compiler_input_flags", 154 "compiler_output_flags", 155 "nologo", 156 "msvc_env", 157 "sysroot", 158 ], 159 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/ml64.exe")], 160 ) 161 162 c_compile_action = action_config( 163 action_name = ACTION_NAMES.c_compile, 164 implies = [ 165 "compiler_input_flags", 166 "compiler_output_flags", 167 "default_compile_flags", 168 "nologo", 169 "msvc_env", 170 "parse_showincludes", 171 "user_compile_flags", 172 "sysroot", 173 "unfiltered_compile_flags", 174 ], 175 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/cl.exe")], 176 ) 177 178 cpp_compile_action = action_config( 179 action_name = ACTION_NAMES.cpp_compile, 180 implies = [ 181 "compiler_input_flags", 182 "compiler_output_flags", 183 "default_compile_flags", 184 "nologo", 185 "msvc_env", 186 "parse_showincludes", 187 "user_compile_flags", 188 "sysroot", 189 "unfiltered_compile_flags", 190 ], 191 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/cl.exe")], 192 ) 193 194 cpp_link_executable_action = action_config( 195 action_name = ACTION_NAMES.cpp_link_executable, 196 implies = [ 197 "nologo", 198 "linkstamps", 199 "output_execpath_flags", 200 "input_param_flags", 201 "user_link_flags", 202 "default_link_flags", 203 "linker_subsystem_flag", 204 "linker_param_file", 205 "msvc_env", 206 "no_stripping", 207 ], 208 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/link.exe")], 209 ) 210 211 cpp_link_dynamic_library_action = action_config( 212 action_name = ACTION_NAMES.cpp_link_dynamic_library, 213 implies = [ 214 "nologo", 215 "shared_flag", 216 "linkstamps", 217 "output_execpath_flags", 218 "input_param_flags", 219 "user_link_flags", 220 "default_link_flags", 221 "linker_subsystem_flag", 222 "linker_param_file", 223 "msvc_env", 224 "no_stripping", 225 "has_configured_linker_path", 226 "def_file", 227 ], 228 tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/link.exe")], 229 ) 230 231 action_configs = [ 232 assemble_action, 233 preprocess_assemble_action, 234 c_compile_action, 235 cpp_compile_action, 236 cpp_link_executable_action, 237 cpp_link_dynamic_library_action, 238 cpp_link_nodeps_dynamic_library_action, 239 cpp_link_static_library_action, 240 ] 241 242 msvc_link_env_feature = feature( 243 name = "msvc_link_env", 244 env_sets = [ 245 env_set( 246 actions = all_link_actions + 247 [ACTION_NAMES.cpp_link_static_library], 248 env_entries = [env_entry(key = "LIB", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64;")], 249 ), 250 ], 251 ) 252 253 shared_flag_feature = feature( 254 name = "shared_flag", 255 flag_sets = [ 256 flag_set( 257 actions = [ 258 ACTION_NAMES.cpp_link_dynamic_library, 259 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 260 ], 261 flag_groups = [flag_group(flags = ["/DLL"])], 262 ), 263 ], 264 ) 265 266 determinism_feature = feature( 267 name = "determinism", 268 enabled = True, 269 flag_sets = [ 270 flag_set( 271 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 272 flag_groups = [ 273 flag_group( 274 flags = [ 275 "/wd4117", 276 "-D__DATE__=\"redacted\"", 277 "-D__TIMESTAMP__=\"redacted\"", 278 "-D__TIME__=\"redacted\"", 279 ], 280 ), 281 ], 282 ), 283 ], 284 ) 285 286 sysroot_feature = feature( 287 name = "sysroot", 288 flag_sets = [ 289 flag_set( 290 actions = [ 291 ACTION_NAMES.assemble, 292 ACTION_NAMES.preprocess_assemble, 293 ACTION_NAMES.c_compile, 294 ACTION_NAMES.cpp_compile, 295 ACTION_NAMES.cpp_header_parsing, 296 ACTION_NAMES.cpp_module_compile, 297 ACTION_NAMES.cpp_module_codegen, 298 ACTION_NAMES.cpp_link_executable, 299 ACTION_NAMES.cpp_link_dynamic_library, 300 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 301 ], 302 flag_groups = [ 303 flag_group( 304 flags = ["--sysroot=%{sysroot}"], 305 iterate_over = "sysroot", 306 expand_if_available = "sysroot", 307 ), 308 ], 309 ), 310 ], 311 ) 312 313 unfiltered_compile_flags_feature = feature( 314 name = "unfiltered_compile_flags", 315 flag_sets = [ 316 flag_set( 317 actions = [ 318 ACTION_NAMES.preprocess_assemble, 319 ACTION_NAMES.c_compile, 320 ACTION_NAMES.cpp_compile, 321 ACTION_NAMES.cpp_header_parsing, 322 ACTION_NAMES.cpp_module_compile, 323 ACTION_NAMES.cpp_module_codegen, 324 ], 325 flag_groups = [ 326 flag_group( 327 flags = ["%{unfiltered_compile_flags}"], 328 iterate_over = "unfiltered_compile_flags", 329 expand_if_available = "unfiltered_compile_flags", 330 ), 331 ], 332 ), 333 ], 334 ) 335 336 compiler_param_file_feature = feature( 337 name = "compiler_param_file", 338 ) 339 340 copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary") 341 342 input_param_flags_feature = feature( 343 name = "input_param_flags", 344 flag_sets = [ 345 flag_set( 346 actions = [ 347 ACTION_NAMES.cpp_link_dynamic_library, 348 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 349 ], 350 flag_groups = [ 351 flag_group( 352 flags = ["/IMPLIB:%{interface_library_output_path}"], 353 expand_if_available = "interface_library_output_path", 354 ), 355 ], 356 ), 357 flag_set( 358 actions = all_link_actions, 359 flag_groups = [ 360 flag_group( 361 flags = ["%{libopts}"], 362 iterate_over = "libopts", 363 expand_if_available = "libopts", 364 ), 365 ], 366 ), 367 flag_set( 368 actions = all_link_actions + 369 [ACTION_NAMES.cpp_link_static_library], 370 flag_groups = [ 371 flag_group( 372 iterate_over = "libraries_to_link", 373 flag_groups = [ 374 flag_group( 375 iterate_over = "libraries_to_link.object_files", 376 flag_groups = [flag_group(flags = ["%{libraries_to_link.object_files}"])], 377 expand_if_equal = variable_with_value( 378 name = "libraries_to_link.type", 379 value = "object_file_group", 380 ), 381 ), 382 flag_group( 383 flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])], 384 expand_if_equal = variable_with_value( 385 name = "libraries_to_link.type", 386 value = "object_file", 387 ), 388 ), 389 flag_group( 390 flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])], 391 expand_if_equal = variable_with_value( 392 name = "libraries_to_link.type", 393 value = "interface_library", 394 ), 395 ), 396 flag_group( 397 flag_groups = [ 398 flag_group( 399 flags = ["%{libraries_to_link.name}"], 400 expand_if_false = "libraries_to_link.is_whole_archive", 401 ), 402 flag_group( 403 flags = ["/WHOLEARCHIVE:%{libraries_to_link.name}"], 404 expand_if_true = "libraries_to_link.is_whole_archive", 405 ), 406 ], 407 expand_if_equal = variable_with_value( 408 name = "libraries_to_link.type", 409 value = "static_library", 410 ), 411 ), 412 ], 413 expand_if_available = "libraries_to_link", 414 ), 415 ], 416 ), 417 ], 418 ) 419 420 fastbuild_feature = feature( 421 name = "fastbuild", 422 flag_sets = [ 423 flag_set( 424 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 425 flag_groups = [flag_group(flags = ["/Od", "/Z7"])], 426 ), 427 flag_set( 428 actions = all_link_actions, 429 flag_groups = [ 430 flag_group( 431 flags = ["/DEBUG:FASTLINK", "/INCREMENTAL:NO"], 432 ), 433 ], 434 ), 435 ], 436 implies = ["generate_pdb_file"], 437 ) 438 439 user_compile_flags_feature = feature( 440 name = "user_compile_flags", 441 flag_sets = [ 442 flag_set( 443 actions = [ 444 ACTION_NAMES.preprocess_assemble, 445 ACTION_NAMES.c_compile, 446 ACTION_NAMES.cpp_compile, 447 ACTION_NAMES.cpp_header_parsing, 448 ACTION_NAMES.cpp_module_compile, 449 ACTION_NAMES.cpp_module_codegen, 450 ], 451 flag_groups = [ 452 flag_group( 453 flags = ["%{user_compile_flags}"], 454 iterate_over = "user_compile_flags", 455 expand_if_available = "user_compile_flags", 456 ), 457 ], 458 ), 459 ], 460 ) 461 462 archiver_flags_feature = feature( 463 name = "archiver_flags", 464 flag_sets = [ 465 flag_set( 466 actions = [ACTION_NAMES.cpp_link_static_library], 467 flag_groups = [ 468 flag_group( 469 flags = ["/OUT:%{output_execpath}"], 470 expand_if_available = "output_execpath", 471 ), 472 flag_group( 473 flags = ["/MACHINE:X64"], 474 ), 475 ], 476 ), 477 ], 478 ) 479 480 default_link_flags_feature = feature( 481 name = "default_link_flags", 482 enabled = True, 483 flag_sets = [ 484 flag_set( 485 actions = all_link_actions, 486 flag_groups = [flag_group(flags = ["/MACHINE:X64"])], 487 ), 488 ], 489 ) 490 491 static_link_msvcrt_feature = feature(name = "static_link_msvcrt") 492 493 dynamic_link_msvcrt_debug_feature = feature( 494 name = "dynamic_link_msvcrt_debug", 495 flag_sets = [ 496 flag_set( 497 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 498 flag_groups = [flag_group(flags = ["/MDd"])], 499 ), 500 flag_set( 501 actions = all_link_actions, 502 flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrtd.lib"])], 503 ), 504 ], 505 requires = [feature_set(features = ["dbg"])], 506 ) 507 508 dbg_feature = feature( 509 name = "dbg", 510 flag_sets = [ 511 flag_set( 512 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 513 flag_groups = [flag_group(flags = ["/Od", "/Z7"])], 514 ), 515 flag_set( 516 actions = all_link_actions, 517 flag_groups = [ 518 flag_group( 519 flags = ["/DEBUG:FULL", "/INCREMENTAL:NO"], 520 ), 521 ], 522 ), 523 ], 524 implies = ["generate_pdb_file"], 525 ) 526 527 opt_feature = feature( 528 name = "opt", 529 flag_sets = [ 530 flag_set( 531 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 532 flag_groups = [flag_group(flags = ["/O2"])], 533 ), 534 ], 535 implies = ["frame_pointer"], 536 ) 537 538 supports_interface_shared_libraries_feature = feature( 539 name = "supports_interface_shared_libraries", 540 enabled = True, 541 ) 542 543 user_link_flags_feature = feature( 544 name = "user_link_flags", 545 flag_sets = [ 546 flag_set( 547 actions = all_link_actions, 548 flag_groups = [ 549 flag_group( 550 flags = ["%{user_link_flags}"], 551 iterate_over = "user_link_flags", 552 expand_if_available = "user_link_flags", 553 ), 554 ], 555 ), 556 ], 557 ) 558 559 default_compile_flags_feature = feature( 560 name = "default_compile_flags", 561 enabled = True, 562 flag_sets = [ 563 flag_set( 564 actions = [ 565 ACTION_NAMES.assemble, 566 ACTION_NAMES.preprocess_assemble, 567 ACTION_NAMES.linkstamp_compile, 568 ACTION_NAMES.c_compile, 569 ACTION_NAMES.cpp_compile, 570 ACTION_NAMES.cpp_header_parsing, 571 ACTION_NAMES.cpp_module_compile, 572 ACTION_NAMES.cpp_module_codegen, 573 ACTION_NAMES.lto_backend, 574 ACTION_NAMES.clif_match, 575 ], 576 flag_groups = [ 577 flag_group( 578 flags = [ 579 "/DCOMPILER_MSVC", 580 "/DNOMINMAX", 581 "/D_WIN32_WINNT=0x0601", 582 "/D_CRT_SECURE_NO_DEPRECATE", 583 "/D_CRT_SECURE_NO_WARNINGS", 584 "/bigobj", 585 "/Zm500", 586 "/EHsc", 587 "/wd4351", 588 "/wd4291", 589 "/wd4250", 590 "/wd4996", 591 ], 592 ), 593 ], 594 ), 595 ], 596 ) 597 598 msvc_compile_env_feature = feature( 599 name = "msvc_compile_env", 600 env_sets = [ 601 env_set( 602 actions = [ 603 ACTION_NAMES.c_compile, 604 ACTION_NAMES.cpp_compile, 605 ACTION_NAMES.cpp_module_compile, 606 ACTION_NAMES.cpp_module_codegen, 607 ACTION_NAMES.cpp_header_parsing, 608 ACTION_NAMES.assemble, 609 ACTION_NAMES.preprocess_assemble, 610 ], 611 env_entries = [env_entry(key = "INCLUDE", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt;")], 612 ), 613 ], 614 ) 615 616 preprocessor_defines_feature = feature( 617 name = "preprocessor_defines", 618 enabled = True, 619 flag_sets = [ 620 flag_set( 621 actions = [ 622 ACTION_NAMES.assemble, 623 ACTION_NAMES.preprocess_assemble, 624 ACTION_NAMES.c_compile, 625 ACTION_NAMES.cpp_compile, 626 ACTION_NAMES.cpp_header_parsing, 627 ACTION_NAMES.cpp_module_compile, 628 ], 629 flag_groups = [ 630 flag_group( 631 flags = ["/D%{preprocessor_defines}"], 632 iterate_over = "preprocessor_defines", 633 ), 634 ], 635 ), 636 ], 637 ) 638 639 generate_pdb_file_feature = feature( 640 name = "generate_pdb_file", 641 requires = [ 642 feature_set(features = ["dbg"]), 643 feature_set(features = ["fastbuild"]), 644 ], 645 ) 646 647 output_execpath_flags_feature = feature( 648 name = "output_execpath_flags", 649 flag_sets = [ 650 flag_set( 651 actions = all_link_actions, 652 flag_groups = [ 653 flag_group( 654 flags = ["/OUT:%{output_execpath}"], 655 expand_if_available = "output_execpath", 656 ), 657 ], 658 ), 659 ], 660 ) 661 662 dynamic_link_msvcrt_no_debug_feature = feature( 663 name = "dynamic_link_msvcrt_no_debug", 664 flag_sets = [ 665 flag_set( 666 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 667 flag_groups = [flag_group(flags = ["/MD"])], 668 ), 669 flag_set( 670 actions = all_link_actions, 671 flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrt.lib"])], 672 ), 673 ], 674 requires = [ 675 feature_set(features = ["fastbuild"]), 676 feature_set(features = ["opt"]), 677 ], 678 ) 679 680 disable_assertions_feature = feature( 681 name = "disable_assertions", 682 enabled = True, 683 flag_sets = [ 684 flag_set( 685 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 686 flag_groups = [flag_group(flags = ["/DNDEBUG"])], 687 with_features = [with_feature_set(features = ["opt"])], 688 ), 689 ], 690 ) 691 692 has_configured_linker_path_feature = feature(name = "has_configured_linker_path") 693 694 supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) 695 696 no_stripping_feature = feature(name = "no_stripping") 697 698 linker_param_file_feature = feature( 699 name = "linker_param_file", 700 flag_sets = [ 701 flag_set( 702 actions = all_link_actions + 703 [ACTION_NAMES.cpp_link_static_library], 704 flag_groups = [ 705 flag_group( 706 flags = ["@%{linker_param_file}"], 707 expand_if_available = "linker_param_file", 708 ), 709 ], 710 ), 711 ], 712 ) 713 714 ignore_noisy_warnings_feature = feature( 715 name = "ignore_noisy_warnings", 716 enabled = True, 717 flag_sets = [ 718 flag_set( 719 actions = [ACTION_NAMES.cpp_link_static_library], 720 flag_groups = [flag_group(flags = ["/ignore:4221"])], 721 ), 722 ], 723 ) 724 725 no_legacy_features_feature = feature(name = "no_legacy_features") 726 727 parse_showincludes_feature = feature( 728 name = "parse_showincludes", 729 flag_sets = [ 730 flag_set( 731 actions = [ 732 ACTION_NAMES.preprocess_assemble, 733 ACTION_NAMES.c_compile, 734 ACTION_NAMES.cpp_compile, 735 ACTION_NAMES.cpp_module_compile, 736 ACTION_NAMES.cpp_header_parsing, 737 ], 738 flag_groups = [flag_group(flags = ["/showIncludes"])], 739 ), 740 ], 741 ) 742 743 static_link_msvcrt_no_debug_feature = feature( 744 name = "static_link_msvcrt_no_debug", 745 flag_sets = [ 746 flag_set( 747 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 748 flag_groups = [flag_group(flags = ["/MT"])], 749 ), 750 flag_set( 751 actions = all_link_actions, 752 flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmt.lib"])], 753 ), 754 ], 755 requires = [ 756 feature_set(features = ["fastbuild"]), 757 feature_set(features = ["opt"]), 758 ], 759 ) 760 761 treat_warnings_as_errors_feature = feature( 762 name = "treat_warnings_as_errors", 763 flag_sets = [ 764 flag_set( 765 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 766 flag_groups = [flag_group(flags = ["/WX"])], 767 ), 768 ], 769 ) 770 771 windows_export_all_symbols_feature = feature(name = "windows_export_all_symbols") 772 773 no_windows_export_all_symbols_feature = feature(name = "no_windows_export_all_symbols") 774 775 include_paths_feature = feature( 776 name = "include_paths", 777 enabled = True, 778 flag_sets = [ 779 flag_set( 780 actions = [ 781 ACTION_NAMES.assemble, 782 ACTION_NAMES.preprocess_assemble, 783 ACTION_NAMES.c_compile, 784 ACTION_NAMES.cpp_compile, 785 ACTION_NAMES.cpp_header_parsing, 786 ACTION_NAMES.cpp_module_compile, 787 ], 788 flag_groups = [ 789 flag_group( 790 flags = ["/I%{quote_include_paths}"], 791 iterate_over = "quote_include_paths", 792 ), 793 flag_group( 794 flags = ["/I%{include_paths}"], 795 iterate_over = "include_paths", 796 ), 797 flag_group( 798 flags = ["/I%{system_include_paths}"], 799 iterate_over = "system_include_paths", 800 ), 801 ], 802 ), 803 ], 804 ) 805 806 linkstamps_feature = feature( 807 name = "linkstamps", 808 flag_sets = [ 809 flag_set( 810 actions = all_link_actions, 811 flag_groups = [ 812 flag_group( 813 flags = ["%{linkstamp_paths}"], 814 iterate_over = "linkstamp_paths", 815 expand_if_available = "linkstamp_paths", 816 ), 817 ], 818 ), 819 ], 820 ) 821 822 targets_windows_feature = feature( 823 name = "targets_windows", 824 enabled = True, 825 implies = ["copy_dynamic_libraries_to_binary"], 826 ) 827 828 linker_subsystem_flag_feature = feature( 829 name = "linker_subsystem_flag", 830 flag_sets = [ 831 flag_set( 832 actions = all_link_actions, 833 flag_groups = [flag_group(flags = ["/SUBSYSTEM:CONSOLE"])], 834 ), 835 ], 836 ) 837 838 static_link_msvcrt_debug_feature = feature( 839 name = "static_link_msvcrt_debug", 840 flag_sets = [ 841 flag_set( 842 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 843 flag_groups = [flag_group(flags = ["/MTd"])], 844 ), 845 flag_set( 846 actions = all_link_actions, 847 flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmtd.lib"])], 848 ), 849 ], 850 requires = [feature_set(features = ["dbg"])], 851 ) 852 853 frame_pointer_feature = feature( 854 name = "frame_pointer", 855 flag_sets = [ 856 flag_set( 857 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 858 flag_groups = [flag_group(flags = ["/Oy-"])], 859 ), 860 ], 861 ) 862 863 compiler_output_flags_feature = feature( 864 name = "compiler_output_flags", 865 flag_sets = [ 866 flag_set( 867 actions = [ACTION_NAMES.assemble], 868 flag_groups = [ 869 flag_group( 870 flag_groups = [ 871 flag_group( 872 flags = ["/Fo%{output_file}", "/Zi"], 873 expand_if_available = "output_file", 874 expand_if_not_available = "output_assembly_file", 875 ), 876 ], 877 expand_if_not_available = "output_preprocess_file", 878 ), 879 ], 880 ), 881 flag_set( 882 actions = [ 883 ACTION_NAMES.preprocess_assemble, 884 ACTION_NAMES.c_compile, 885 ACTION_NAMES.cpp_compile, 886 ACTION_NAMES.cpp_header_parsing, 887 ACTION_NAMES.cpp_module_compile, 888 ACTION_NAMES.cpp_module_codegen, 889 ], 890 flag_groups = [ 891 flag_group( 892 flag_groups = [ 893 flag_group( 894 flags = ["/Fo%{output_file}"], 895 expand_if_not_available = "output_preprocess_file", 896 ), 897 ], 898 expand_if_available = "output_file", 899 expand_if_not_available = "output_assembly_file", 900 ), 901 flag_group( 902 flag_groups = [ 903 flag_group( 904 flags = ["/Fa%{output_file}"], 905 expand_if_available = "output_assembly_file", 906 ), 907 ], 908 expand_if_available = "output_file", 909 ), 910 flag_group( 911 flag_groups = [ 912 flag_group( 913 flags = ["/P", "/Fi%{output_file}"], 914 expand_if_available = "output_preprocess_file", 915 ), 916 ], 917 expand_if_available = "output_file", 918 ), 919 ], 920 ), 921 ], 922 ) 923 924 nologo_feature = feature( 925 name = "nologo", 926 flag_sets = [ 927 flag_set( 928 actions = [ 929 ACTION_NAMES.c_compile, 930 ACTION_NAMES.cpp_compile, 931 ACTION_NAMES.cpp_module_compile, 932 ACTION_NAMES.cpp_module_codegen, 933 ACTION_NAMES.cpp_header_parsing, 934 ACTION_NAMES.assemble, 935 ACTION_NAMES.preprocess_assemble, 936 ACTION_NAMES.cpp_link_executable, 937 ACTION_NAMES.cpp_link_dynamic_library, 938 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 939 ACTION_NAMES.cpp_link_static_library, 940 ], 941 flag_groups = [flag_group(flags = ["/nologo"])], 942 ), 943 ], 944 ) 945 946 smaller_binary_feature = feature( 947 name = "smaller_binary", 948 enabled = True, 949 flag_sets = [ 950 flag_set( 951 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 952 flag_groups = [flag_group(flags = ["/Gy", "/Gw"])], 953 with_features = [with_feature_set(features = ["opt"])], 954 ), 955 flag_set( 956 actions = all_link_actions, 957 flag_groups = [flag_group(flags = ["/OPT:ICF", "/OPT:REF"])], 958 with_features = [with_feature_set(features = ["opt"])], 959 ), 960 ], 961 ) 962 963 compiler_input_flags_feature = feature( 964 name = "compiler_input_flags", 965 flag_sets = [ 966 flag_set( 967 actions = [ 968 ACTION_NAMES.assemble, 969 ACTION_NAMES.preprocess_assemble, 970 ACTION_NAMES.c_compile, 971 ACTION_NAMES.cpp_compile, 972 ACTION_NAMES.cpp_header_parsing, 973 ACTION_NAMES.cpp_module_compile, 974 ACTION_NAMES.cpp_module_codegen, 975 ], 976 flag_groups = [ 977 flag_group( 978 flags = ["/c", "%{source_file}"], 979 expand_if_available = "source_file", 980 ), 981 ], 982 ), 983 ], 984 ) 985 986 def_file_feature = feature( 987 name = "def_file", 988 flag_sets = [ 989 flag_set( 990 actions = all_link_actions, 991 flag_groups = [ 992 flag_group( 993 flags = ["/DEF:%{def_file_path}", "/ignore:4070"], 994 expand_if_available = "def_file_path", 995 ), 996 ], 997 ), 998 ], 999 ) 1000 1001 msvc_env_feature = feature( 1002 name = "msvc_env", 1003 env_sets = [ 1004 env_set( 1005 actions = [ 1006 ACTION_NAMES.c_compile, 1007 ACTION_NAMES.cpp_compile, 1008 ACTION_NAMES.cpp_module_compile, 1009 ACTION_NAMES.cpp_module_codegen, 1010 ACTION_NAMES.cpp_header_parsing, 1011 ACTION_NAMES.assemble, 1012 ACTION_NAMES.preprocess_assemble, 1013 ACTION_NAMES.cpp_link_executable, 1014 ACTION_NAMES.cpp_link_dynamic_library, 1015 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 1016 ACTION_NAMES.cpp_link_static_library, 1017 ], 1018 env_entries = [ 1019 env_entry(key = "PATH", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework64\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x64;C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86;;C:\\Windows\\system32"), 1020 env_entry(key = "TMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"), 1021 env_entry(key = "TEMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"), 1022 ], 1023 ), 1024 ], 1025 implies = ["msvc_compile_env", "msvc_link_env"], 1026 ) 1027 1028 features = [ 1029 no_legacy_features_feature, 1030 nologo_feature, 1031 has_configured_linker_path_feature, 1032 no_stripping_feature, 1033 targets_windows_feature, 1034 copy_dynamic_libraries_to_binary_feature, 1035 default_compile_flags_feature, 1036 msvc_env_feature, 1037 msvc_compile_env_feature, 1038 msvc_link_env_feature, 1039 include_paths_feature, 1040 preprocessor_defines_feature, 1041 parse_showincludes_feature, 1042 generate_pdb_file_feature, 1043 shared_flag_feature, 1044 linkstamps_feature, 1045 output_execpath_flags_feature, 1046 archiver_flags_feature, 1047 input_param_flags_feature, 1048 linker_subsystem_flag_feature, 1049 user_link_flags_feature, 1050 default_link_flags_feature, 1051 linker_param_file_feature, 1052 static_link_msvcrt_feature, 1053 static_link_msvcrt_no_debug_feature, 1054 dynamic_link_msvcrt_no_debug_feature, 1055 static_link_msvcrt_debug_feature, 1056 dynamic_link_msvcrt_debug_feature, 1057 dbg_feature, 1058 fastbuild_feature, 1059 opt_feature, 1060 frame_pointer_feature, 1061 disable_assertions_feature, 1062 determinism_feature, 1063 treat_warnings_as_errors_feature, 1064 smaller_binary_feature, 1065 ignore_noisy_warnings_feature, 1066 user_compile_flags_feature, 1067 sysroot_feature, 1068 unfiltered_compile_flags_feature, 1069 compiler_param_file_feature, 1070 compiler_output_flags_feature, 1071 compiler_input_flags_feature, 1072 def_file_feature, 1073 windows_export_all_symbols_feature, 1074 no_windows_export_all_symbols_feature, 1075 supports_dynamic_linker_feature, 1076 supports_interface_shared_libraries_feature, 1077 ] 1078 1079 artifact_name_patterns = [ 1080 artifact_name_pattern( 1081 category_name = "object_file", 1082 prefix = "", 1083 extension = ".obj", 1084 ), 1085 artifact_name_pattern( 1086 category_name = "static_library", 1087 prefix = "", 1088 extension = ".lib", 1089 ), 1090 artifact_name_pattern( 1091 category_name = "alwayslink_static_library", 1092 prefix = "", 1093 extension = ".lo.lib", 1094 ), 1095 artifact_name_pattern( 1096 category_name = "executable", 1097 prefix = "", 1098 extension = ".exe", 1099 ), 1100 artifact_name_pattern( 1101 category_name = "dynamic_library", 1102 prefix = "", 1103 extension = ".dll", 1104 ), 1105 artifact_name_pattern( 1106 category_name = "interface_library", 1107 prefix = "", 1108 extension = ".if.lib", 1109 ), 1110 ] 1111 1112 make_variables = [] 1113 1114 tool_paths = [ 1115 tool_path(name = "ar", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/lib.exe"), 1116 tool_path(name = "ml", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/ml64.exe"), 1117 tool_path(name = "cpp", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/cl.exe"), 1118 tool_path(name = "gcc", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/cl.exe"), 1119 tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"), 1120 tool_path(name = "ld", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC//bin/amd64/link.exe"), 1121 tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"), 1122 tool_path( 1123 name = "objcopy", 1124 path = "wrapper/bin/msvc_nop.bat", 1125 ), 1126 tool_path( 1127 name = "objdump", 1128 path = "wrapper/bin/msvc_nop.bat", 1129 ), 1130 tool_path( 1131 name = "strip", 1132 path = "wrapper/bin/msvc_nop.bat", 1133 ), 1134 ] 1135 1136 return cc_common.create_cc_toolchain_config_info( 1137 ctx = ctx, 1138 features = features, 1139 action_configs = action_configs, 1140 artifact_name_patterns = artifact_name_patterns, 1141 cxx_builtin_include_directories = cxx_builtin_include_directories, 1142 toolchain_identifier = toolchain_identifier, 1143 host_system_name = host_system_name, 1144 target_system_name = target_system_name, 1145 target_cpu = target_cpu, 1146 target_libc = target_libc, 1147 compiler = compiler, 1148 abi_version = abi_version, 1149 abi_libc_version = abi_libc_version, 1150 tool_paths = tool_paths, 1151 make_variables = make_variables, 1152 builtin_sysroot = builtin_sysroot, 1153 cc_target_os = None, 1154 ) 1155 1156 def _windows_msys_mingw_impl(ctx): 1157 toolchain_identifier = "msys_x64_mingw" 1158 host_system_name = "local" 1159 target_system_name = "local" 1160 target_cpu = "x64_windows" 1161 target_libc = "mingw" 1162 compiler = "mingw-gcc" 1163 abi_version = "local" 1164 abi_libc_version = "local" 1165 cc_target_os = None 1166 builtin_sysroot = None 1167 action_configs = [] 1168 1169 targets_windows_feature = feature( 1170 name = "targets_windows", 1171 implies = ["copy_dynamic_libraries_to_binary"], 1172 enabled = True, 1173 ) 1174 1175 copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary") 1176 1177 gcc_env_feature = feature( 1178 name = "gcc_env", 1179 enabled = True, 1180 env_sets = [ 1181 env_set( 1182 actions = [ 1183 ACTION_NAMES.c_compile, 1184 ACTION_NAMES.cpp_compile, 1185 ACTION_NAMES.cpp_module_compile, 1186 ACTION_NAMES.cpp_module_codegen, 1187 ACTION_NAMES.cpp_header_parsing, 1188 ACTION_NAMES.assemble, 1189 ACTION_NAMES.preprocess_assemble, 1190 ACTION_NAMES.cpp_link_executable, 1191 ACTION_NAMES.cpp_link_dynamic_library, 1192 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 1193 ACTION_NAMES.cpp_link_static_library, 1194 ], 1195 env_entries = [ 1196 env_entry(key = "PATH", value = "c:/tools/msys64/mingw64/bin"), 1197 ], 1198 ), 1199 ], 1200 ) 1201 1202 msys_mingw_flags = [ 1203 "-std=gnu++0x", 1204 ] 1205 msys_mingw_link_flags = [ 1206 "-lstdc++", 1207 ] 1208 1209 default_compile_flags_feature = feature( 1210 name = "default_compile_flags", 1211 enabled = True, 1212 flag_sets = [ 1213 flag_set( 1214 actions = [ 1215 ACTION_NAMES.assemble, 1216 ACTION_NAMES.preprocess_assemble, 1217 ACTION_NAMES.linkstamp_compile, 1218 ACTION_NAMES.c_compile, 1219 ACTION_NAMES.cpp_compile, 1220 ACTION_NAMES.cpp_header_parsing, 1221 ACTION_NAMES.cpp_module_compile, 1222 ACTION_NAMES.cpp_module_codegen, 1223 ACTION_NAMES.lto_backend, 1224 ACTION_NAMES.clif_match, 1225 ], 1226 ), 1227 flag_set( 1228 actions = [ 1229 ACTION_NAMES.linkstamp_compile, 1230 ACTION_NAMES.cpp_compile, 1231 ACTION_NAMES.cpp_header_parsing, 1232 ACTION_NAMES.cpp_module_compile, 1233 ACTION_NAMES.cpp_module_codegen, 1234 ACTION_NAMES.lto_backend, 1235 ACTION_NAMES.clif_match, 1236 ], 1237 flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []), 1238 ), 1239 ], 1240 ) 1241 1242 compiler_param_file_feature = feature( 1243 name = "compiler_param_file", 1244 ) 1245 1246 default_link_flags_feature = feature( 1247 name = "default_link_flags", 1248 enabled = True, 1249 flag_sets = [ 1250 flag_set( 1251 actions = all_link_actions, 1252 flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []), 1253 ), 1254 ], 1255 ) 1256 1257 supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) 1258 1259 features = [ 1260 targets_windows_feature, 1261 copy_dynamic_libraries_to_binary_feature, 1262 gcc_env_feature, 1263 default_compile_flags_feature, 1264 compiler_param_file_feature, 1265 default_link_flags_feature, 1266 supports_dynamic_linker_feature, 1267 ] 1268 1269 cxx_builtin_include_directories = [ 1270 # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. 1271 "C:\\botcode\\w", 1272 "c:/tools/msys64/mingw64/", 1273 "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", 1274 "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", 1275 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", 1276 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", 1277 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt", 1278 ] 1279 1280 artifact_name_patterns = [ 1281 artifact_name_pattern( 1282 category_name = "executable", 1283 prefix = "", 1284 extension = ".exe", 1285 ), 1286 ] 1287 1288 make_variables = [] 1289 tool_paths = [ 1290 tool_path(name = "ar", path = "c:/tools/msys64/mingw64/bin/ar"), 1291 tool_path(name = "compat-ld", path = "c:/tools/msys64/mingw64/bin/ld"), 1292 tool_path(name = "cpp", path = "c:/tools/msys64/mingw64/bin/cpp"), 1293 tool_path(name = "dwp", path = "c:/tools/msys64/mingw64/bin/dwp"), 1294 tool_path(name = "gcc", path = "c:/tools/msys64/mingw64/bin/gcc"), 1295 tool_path(name = "gcov", path = "c:/tools/msys64/mingw64/bin/gcov"), 1296 tool_path(name = "ld", path = "c:/tools/msys64/mingw64/bin/ld"), 1297 tool_path(name = "nm", path = "c:/tools/msys64/mingw64/bin/nm"), 1298 tool_path(name = "objcopy", path = "c:/tools/msys64/mingw64/bin/objcopy"), 1299 tool_path(name = "objdump", path = "c:/tools/msys64/mingw64/bin/objdump"), 1300 tool_path(name = "strip", path = "c:/tools/msys64/mingw64/bin/strip"), 1301 ] 1302 1303 return cc_common.create_cc_toolchain_config_info( 1304 ctx = ctx, 1305 features = features, 1306 action_configs = action_configs, 1307 artifact_name_patterns = artifact_name_patterns, 1308 cxx_builtin_include_directories = cxx_builtin_include_directories, 1309 toolchain_identifier = toolchain_identifier, 1310 host_system_name = host_system_name, 1311 target_system_name = target_system_name, 1312 target_cpu = target_cpu, 1313 target_libc = target_libc, 1314 compiler = compiler, 1315 abi_version = abi_version, 1316 abi_libc_version = abi_libc_version, 1317 tool_paths = tool_paths, 1318 make_variables = make_variables, 1319 builtin_sysroot = builtin_sysroot, 1320 cc_target_os = cc_target_os, 1321 ) 1322 1323 def _armeabi_impl(ctx): 1324 toolchain_identifier = "stub_armeabi-v7a" 1325 host_system_name = "armeabi-v7a" 1326 target_system_name = "armeabi-v7a" 1327 target_cpu = "armeabi-v7a" 1328 target_libc = "armeabi-v7a" 1329 compiler = "compiler" 1330 abi_version = "armeabi-v7a" 1331 abi_libc_version = "armeabi-v7a" 1332 cc_target_os = None 1333 builtin_sysroot = None 1334 action_configs = [] 1335 1336 supports_pic_feature = feature(name = "supports_pic", enabled = True) 1337 supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) 1338 features = [supports_dynamic_linker_feature, supports_pic_feature] 1339 1340 cxx_builtin_include_directories = [ 1341 # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. 1342 "C:\\botcode\\w", 1343 ] 1344 artifact_name_patterns = [] 1345 make_variables = [] 1346 1347 tool_paths = [ 1348 tool_path(name = "ar", path = "/bin/false"), 1349 tool_path(name = "compat-ld", path = "/bin/false"), 1350 tool_path(name = "cpp", path = "/bin/false"), 1351 tool_path(name = "dwp", path = "/bin/false"), 1352 tool_path(name = "gcc", path = "/bin/false"), 1353 tool_path(name = "gcov", path = "/bin/false"), 1354 tool_path(name = "ld", path = "/bin/false"), 1355 tool_path(name = "nm", path = "/bin/false"), 1356 tool_path(name = "objcopy", path = "/bin/false"), 1357 tool_path(name = "objdump", path = "/bin/false"), 1358 tool_path(name = "strip", path = "/bin/false"), 1359 ] 1360 1361 return cc_common.create_cc_toolchain_config_info( 1362 ctx = ctx, 1363 features = features, 1364 action_configs = action_configs, 1365 artifact_name_patterns = artifact_name_patterns, 1366 cxx_builtin_include_directories = cxx_builtin_include_directories, 1367 toolchain_identifier = toolchain_identifier, 1368 host_system_name = host_system_name, 1369 target_system_name = target_system_name, 1370 target_cpu = target_cpu, 1371 target_libc = target_libc, 1372 compiler = compiler, 1373 abi_version = abi_version, 1374 abi_libc_version = abi_libc_version, 1375 tool_paths = tool_paths, 1376 make_variables = make_variables, 1377 builtin_sysroot = builtin_sysroot, 1378 cc_target_os = cc_target_os, 1379 ) 1380 1381 def _impl(ctx): 1382 if ctx.attr.cpu == "armeabi-v7a": 1383 return _armeabi_impl(ctx) 1384 elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "msvc-cl": 1385 return _windows_msvc_impl(ctx) 1386 elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "mingw-gcc": 1387 return _windows_msys_mingw_impl(ctx) 1388 1389 tool_paths = [ 1390 tool_path(name = "ar", path = "c:/tools/msys64/usr/bin/ar"), 1391 tool_path(name = "compat-ld", path = "c:/tools/msys64/usr/bin/ld"), 1392 tool_path(name = "cpp", path = "c:/tools/msys64/usr/bin/cpp"), 1393 tool_path(name = "dwp", path = "c:/tools/msys64/usr/bin/dwp"), 1394 tool_path(name = "gcc", path = "c:/tools/msys64/usr/bin/gcc"), 1395 tool_path(name = "gcov", path = "c:/tools/msys64/usr/bin/gcov"), 1396 tool_path(name = "ld", path = "c:/tools/msys64/usr/bin/ld"), 1397 tool_path(name = "nm", path = "c:/tools/msys64/usr/bin/nm"), 1398 tool_path(name = "objcopy", path = "c:/tools/msys64/usr/bin/objcopy"), 1399 tool_path(name = "objdump", path = "c:/tools/msys64/usr/bin/objdump"), 1400 tool_path(name = "strip", path = "c:/tools/msys64/usr/bin/strip"), 1401 ] 1402 1403 cxx_builtin_include_directories = [ 1404 # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. 1405 "C:\\botcode\\w", 1406 "c:/tools/msys64/usr/", 1407 "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", 1408 "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", 1409 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", 1410 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", 1411 "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt", 1412 ] 1413 1414 action_configs = [] 1415 1416 compile_flags = [ 1417 ] 1418 1419 dbg_compile_flags = [ 1420 ] 1421 1422 opt_compile_flags = [ 1423 ] 1424 1425 cxx_flags = [ 1426 "-std=gnu++0x", 1427 ] 1428 1429 link_flags = [ 1430 "-lstdc++", 1431 ] 1432 1433 opt_link_flags = [ 1434 ] 1435 1436 unfiltered_compile_flags = [ 1437 ] 1438 1439 targets_windows_feature = feature( 1440 name = "targets_windows", 1441 implies = ["copy_dynamic_libraries_to_binary"], 1442 enabled = True, 1443 ) 1444 1445 copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary") 1446 1447 gcc_env_feature = feature( 1448 name = "gcc_env", 1449 enabled = True, 1450 env_sets = [ 1451 env_set( 1452 actions = [ 1453 ACTION_NAMES.c_compile, 1454 ACTION_NAMES.cpp_compile, 1455 ACTION_NAMES.cpp_module_compile, 1456 ACTION_NAMES.cpp_module_codegen, 1457 ACTION_NAMES.cpp_header_parsing, 1458 ACTION_NAMES.assemble, 1459 ACTION_NAMES.preprocess_assemble, 1460 ACTION_NAMES.cpp_link_executable, 1461 ACTION_NAMES.cpp_link_dynamic_library, 1462 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 1463 ACTION_NAMES.cpp_link_static_library, 1464 ], 1465 env_entries = [ 1466 env_entry(key = "PATH", value = "c:/tools/msys64/usr/bin"), 1467 ], 1468 ), 1469 ], 1470 ) 1471 1472 windows_features = [ 1473 targets_windows_feature, 1474 copy_dynamic_libraries_to_binary_feature, 1475 gcc_env_feature, 1476 ] 1477 1478 supports_pic_feature = feature( 1479 name = "supports_pic", 1480 enabled = True, 1481 ) 1482 supports_start_end_lib_feature = feature( 1483 name = "supports_start_end_lib", 1484 enabled = True, 1485 ) 1486 1487 default_compile_flags_feature = feature( 1488 name = "default_compile_flags", 1489 enabled = True, 1490 flag_sets = [ 1491 flag_set( 1492 actions = [ 1493 ACTION_NAMES.assemble, 1494 ACTION_NAMES.preprocess_assemble, 1495 ACTION_NAMES.linkstamp_compile, 1496 ACTION_NAMES.c_compile, 1497 ACTION_NAMES.cpp_compile, 1498 ACTION_NAMES.cpp_header_parsing, 1499 ACTION_NAMES.cpp_module_compile, 1500 ACTION_NAMES.cpp_module_codegen, 1501 ACTION_NAMES.lto_backend, 1502 ACTION_NAMES.clif_match, 1503 ], 1504 flag_groups = ([flag_group(flags = compile_flags)] if compile_flags else []), 1505 ), 1506 flag_set( 1507 actions = [ 1508 ACTION_NAMES.assemble, 1509 ACTION_NAMES.preprocess_assemble, 1510 ACTION_NAMES.linkstamp_compile, 1511 ACTION_NAMES.c_compile, 1512 ACTION_NAMES.cpp_compile, 1513 ACTION_NAMES.cpp_header_parsing, 1514 ACTION_NAMES.cpp_module_compile, 1515 ACTION_NAMES.cpp_module_codegen, 1516 ACTION_NAMES.lto_backend, 1517 ACTION_NAMES.clif_match, 1518 ], 1519 flag_groups = ([flag_group(flags = dbg_compile_flags)] if dbg_compile_flags else []), 1520 with_features = [with_feature_set(features = ["dbg"])], 1521 ), 1522 flag_set( 1523 actions = [ 1524 ACTION_NAMES.assemble, 1525 ACTION_NAMES.preprocess_assemble, 1526 ACTION_NAMES.linkstamp_compile, 1527 ACTION_NAMES.c_compile, 1528 ACTION_NAMES.cpp_compile, 1529 ACTION_NAMES.cpp_header_parsing, 1530 ACTION_NAMES.cpp_module_compile, 1531 ACTION_NAMES.cpp_module_codegen, 1532 ACTION_NAMES.lto_backend, 1533 ACTION_NAMES.clif_match, 1534 ], 1535 flag_groups = ([flag_group(flags = opt_compile_flags)] if opt_compile_flags else []), 1536 with_features = [with_feature_set(features = ["opt"])], 1537 ), 1538 flag_set( 1539 actions = [ 1540 ACTION_NAMES.linkstamp_compile, 1541 ACTION_NAMES.cpp_compile, 1542 ACTION_NAMES.cpp_header_parsing, 1543 ACTION_NAMES.cpp_module_compile, 1544 ACTION_NAMES.cpp_module_codegen, 1545 ACTION_NAMES.lto_backend, 1546 ACTION_NAMES.clif_match, 1547 ], 1548 flag_groups = ([flag_group(flags = cxx_flags)] if cxx_flags else []), 1549 ), 1550 ], 1551 ) 1552 1553 default_link_flags_feature = feature( 1554 name = "default_link_flags", 1555 enabled = True, 1556 flag_sets = [ 1557 flag_set( 1558 actions = all_link_actions, 1559 flag_groups = ([flag_group(flags = link_flags)] if link_flags else []), 1560 ), 1561 flag_set( 1562 actions = all_link_actions, 1563 flag_groups = ([flag_group(flags = opt_link_flags)] if opt_link_flags else []), 1564 with_features = [with_feature_set(features = ["opt"])], 1565 ), 1566 ], 1567 ) 1568 1569 dbg_feature = feature(name = "dbg") 1570 1571 opt_feature = feature(name = "opt") 1572 1573 sysroot_feature = feature( 1574 name = "sysroot", 1575 enabled = True, 1576 flag_sets = [ 1577 flag_set( 1578 actions = [ 1579 ACTION_NAMES.preprocess_assemble, 1580 ACTION_NAMES.linkstamp_compile, 1581 ACTION_NAMES.c_compile, 1582 ACTION_NAMES.cpp_compile, 1583 ACTION_NAMES.cpp_header_parsing, 1584 ACTION_NAMES.cpp_module_compile, 1585 ACTION_NAMES.cpp_module_codegen, 1586 ACTION_NAMES.lto_backend, 1587 ACTION_NAMES.clif_match, 1588 ACTION_NAMES.cpp_link_executable, 1589 ACTION_NAMES.cpp_link_dynamic_library, 1590 ACTION_NAMES.cpp_link_nodeps_dynamic_library, 1591 ], 1592 flag_groups = [ 1593 flag_group( 1594 flags = ["--sysroot=%{sysroot}"], 1595 expand_if_available = "sysroot", 1596 ), 1597 ], 1598 ), 1599 ], 1600 ) 1601 1602 fdo_optimize_feature = feature( 1603 name = "fdo_optimize", 1604 flag_sets = [ 1605 flag_set( 1606 actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], 1607 flag_groups = [ 1608 flag_group( 1609 flags = [ 1610 "-fprofile-use=%{fdo_profile_path}", 1611 "-fprofile-correction", 1612 ], 1613 expand_if_available = "fdo_profile_path", 1614 ), 1615 ], 1616 ), 1617 ], 1618 provides = ["profile"], 1619 ) 1620 1621 supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) 1622 1623 user_compile_flags_feature = feature( 1624 name = "user_compile_flags", 1625 enabled = True, 1626 flag_sets = [ 1627 flag_set( 1628 actions = [ 1629 ACTION_NAMES.assemble, 1630 ACTION_NAMES.preprocess_assemble, 1631 ACTION_NAMES.linkstamp_compile, 1632 ACTION_NAMES.c_compile, 1633 ACTION_NAMES.cpp_compile, 1634 ACTION_NAMES.cpp_header_parsing, 1635 ACTION_NAMES.cpp_module_compile, 1636 ACTION_NAMES.cpp_module_codegen, 1637 ACTION_NAMES.lto_backend, 1638 ACTION_NAMES.clif_match, 1639 ], 1640 flag_groups = [ 1641 flag_group( 1642 flags = ["%{user_compile_flags}"], 1643 iterate_over = "user_compile_flags", 1644 expand_if_available = "user_compile_flags", 1645 ), 1646 ], 1647 ), 1648 ], 1649 ) 1650 1651 unfiltered_compile_flags_feature = feature( 1652 name = "unfiltered_compile_flags", 1653 enabled = True, 1654 flag_sets = [ 1655 flag_set( 1656 actions = [ 1657 ACTION_NAMES.assemble, 1658 ACTION_NAMES.preprocess_assemble, 1659 ACTION_NAMES.linkstamp_compile, 1660 ACTION_NAMES.c_compile, 1661 ACTION_NAMES.cpp_compile, 1662 ACTION_NAMES.cpp_header_parsing, 1663 ACTION_NAMES.cpp_module_compile, 1664 ACTION_NAMES.cpp_module_codegen, 1665 ACTION_NAMES.lto_backend, 1666 ACTION_NAMES.clif_match, 1667 ], 1668 flag_groups = ([flag_group(flags = unfiltered_compile_flags)] if unfiltered_compile_flags else []), 1669 ), 1670 ], 1671 ) 1672 1673 features = windows_features + [ 1674 supports_pic_feature, 1675 default_compile_flags_feature, 1676 default_link_flags_feature, 1677 fdo_optimize_feature, 1678 supports_dynamic_linker_feature, 1679 dbg_feature, 1680 opt_feature, 1681 user_compile_flags_feature, 1682 sysroot_feature, 1683 unfiltered_compile_flags_feature, 1684 ] 1685 1686 artifact_name_patterns = [ 1687 artifact_name_pattern(category_name = "executable", prefix = "", extension = ".exe"), 1688 ] 1689 1690 make_variables = [] 1691 1692 return cc_common.create_cc_toolchain_config_info( 1693 ctx = ctx, 1694 features = features, 1695 action_configs = action_configs, 1696 artifact_name_patterns = artifact_name_patterns, 1697 cxx_builtin_include_directories = cxx_builtin_include_directories, 1698 toolchain_identifier = "msys_x64", 1699 host_system_name = "local", 1700 target_system_name = "local", 1701 target_cpu = "x64_windows", 1702 target_libc = "msys", 1703 compiler = "msys-gcc", 1704 abi_version = "local", 1705 abi_libc_version = "local", 1706 tool_paths = tool_paths, 1707 make_variables = make_variables, 1708 builtin_sysroot = "", 1709 cc_target_os = None, 1710 ) 1711 1712 cc_toolchain_config = rule( 1713 implementation = _impl, 1714 attrs = { 1715 "cpu": attr.string(mandatory = True), 1716 "compiler": attr.string(), 1717 }, 1718 provides = [CcToolchainConfigInfo], 1719 )