12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718 |
- # Copyright 2019 The Bazel Authors. All rights reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- """A Starlark cc_toolchain configuration rule"""
- load(
- "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
- "action_config",
- "artifact_name_pattern",
- "env_entry",
- "env_set",
- "feature",
- "feature_set",
- "flag_group",
- "flag_set",
- "make_variable",
- "tool",
- "tool_path",
- "variable_with_value",
- "with_feature_set",
- )
- load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
- all_compile_actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.clif_match,
- ACTION_NAMES.lto_backend,
- ]
- all_cpp_compile_actions = [
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.clif_match,
- ]
- preprocessor_compile_actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.clif_match,
- ]
- codegen_compile_actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ]
- all_link_actions = [
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ]
- def _windows_msvc_impl(ctx):
- toolchain_identifier = "msvc_x64"
- host_system_name = "local"
- target_system_name = "local"
- target_cpu = "x64_windows"
- target_libc = "msvcrt"
- compiler = "msvc-cl"
- abi_version = "local"
- abi_libc_version = "local"
- cc_target_os = None
- builtin_sysroot = None
- cxx_builtin_include_directories = [
- # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087.
- "C:\\botcode\\w",
- "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",
- ]
- cpp_link_nodeps_dynamic_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- implies = [
- "nologo",
- "shared_flag",
- "linkstamps",
- "output_execpath_flags",
- "input_param_flags",
- "user_link_flags",
- "default_link_flags",
- "linker_subsystem_flag",
- "linker_param_file",
- "msvc_env",
- "no_stripping",
- "has_configured_linker_path",
- "def_file",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")],
- )
- cpp_link_static_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_static_library,
- implies = [
- "nologo",
- "archiver_flags",
- "input_param_flags",
- "linker_param_file",
- "msvc_env",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/lib.exe")],
- )
- assemble_action = action_config(
- action_name = ACTION_NAMES.assemble,
- implies = [
- "compiler_input_flags",
- "compiler_output_flags",
- "nologo",
- "msvc_env",
- "sysroot",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe")],
- )
- preprocess_assemble_action = action_config(
- action_name = ACTION_NAMES.preprocess_assemble,
- implies = [
- "compiler_input_flags",
- "compiler_output_flags",
- "nologo",
- "msvc_env",
- "sysroot",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe")],
- )
- c_compile_action = action_config(
- action_name = ACTION_NAMES.c_compile,
- implies = [
- "compiler_input_flags",
- "compiler_output_flags",
- "default_compile_flags",
- "nologo",
- "msvc_env",
- "parse_showincludes",
- "user_compile_flags",
- "sysroot",
- "unfiltered_compile_flags",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")],
- )
- cpp_compile_action = action_config(
- action_name = ACTION_NAMES.cpp_compile,
- implies = [
- "compiler_input_flags",
- "compiler_output_flags",
- "default_compile_flags",
- "nologo",
- "msvc_env",
- "parse_showincludes",
- "user_compile_flags",
- "sysroot",
- "unfiltered_compile_flags",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")],
- )
- cpp_link_executable_action = action_config(
- action_name = ACTION_NAMES.cpp_link_executable,
- implies = [
- "nologo",
- "linkstamps",
- "output_execpath_flags",
- "input_param_flags",
- "user_link_flags",
- "default_link_flags",
- "linker_subsystem_flag",
- "linker_param_file",
- "msvc_env",
- "no_stripping",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")],
- )
- cpp_link_dynamic_library_action = action_config(
- action_name = ACTION_NAMES.cpp_link_dynamic_library,
- implies = [
- "nologo",
- "shared_flag",
- "linkstamps",
- "output_execpath_flags",
- "input_param_flags",
- "user_link_flags",
- "default_link_flags",
- "linker_subsystem_flag",
- "linker_param_file",
- "msvc_env",
- "no_stripping",
- "has_configured_linker_path",
- "def_file",
- ],
- tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")],
- )
- action_configs = [
- assemble_action,
- preprocess_assemble_action,
- c_compile_action,
- cpp_compile_action,
- cpp_link_executable_action,
- cpp_link_dynamic_library_action,
- cpp_link_nodeps_dynamic_library_action,
- cpp_link_static_library_action,
- ]
- msvc_link_env_feature = feature(
- name = "msvc_link_env",
- env_sets = [
- env_set(
- actions = all_link_actions +
- [ACTION_NAMES.cpp_link_static_library],
- 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;")],
- ),
- ],
- )
- shared_flag_feature = feature(
- name = "shared_flag",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ],
- flag_groups = [flag_group(flags = ["/DLL"])],
- ),
- ],
- )
- determinism_feature = feature(
- name = "determinism",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [
- flag_group(
- flags = [
- "/wd4117",
- "-D__DATE__=\"redacted\"",
- "-D__TIMESTAMP__=\"redacted\"",
- "-D__TIME__=\"redacted\"",
- ],
- ),
- ],
- ),
- ],
- )
- sysroot_feature = feature(
- name = "sysroot",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ],
- flag_groups = [
- flag_group(
- flags = ["--sysroot=%{sysroot}"],
- iterate_over = "sysroot",
- expand_if_available = "sysroot",
- ),
- ],
- ),
- ],
- )
- unfiltered_compile_flags_feature = feature(
- name = "unfiltered_compile_flags",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ],
- flag_groups = [
- flag_group(
- flags = ["%{unfiltered_compile_flags}"],
- iterate_over = "unfiltered_compile_flags",
- expand_if_available = "unfiltered_compile_flags",
- ),
- ],
- ),
- ],
- )
- compiler_param_file_feature = feature(
- name = "compiler_param_file",
- )
- copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
- input_param_flags_feature = feature(
- name = "input_param_flags",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ],
- flag_groups = [
- flag_group(
- flags = ["/IMPLIB:%{interface_library_output_path}"],
- expand_if_available = "interface_library_output_path",
- ),
- ],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["%{libopts}"],
- iterate_over = "libopts",
- expand_if_available = "libopts",
- ),
- ],
- ),
- flag_set(
- actions = all_link_actions +
- [ACTION_NAMES.cpp_link_static_library],
- flag_groups = [
- flag_group(
- iterate_over = "libraries_to_link",
- flag_groups = [
- flag_group(
- iterate_over = "libraries_to_link.object_files",
- flag_groups = [flag_group(flags = ["%{libraries_to_link.object_files}"])],
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "object_file_group",
- ),
- ),
- flag_group(
- flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "object_file",
- ),
- ),
- flag_group(
- flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "interface_library",
- ),
- ),
- flag_group(
- flag_groups = [
- flag_group(
- flags = ["%{libraries_to_link.name}"],
- expand_if_false = "libraries_to_link.is_whole_archive",
- ),
- flag_group(
- flags = ["/WHOLEARCHIVE:%{libraries_to_link.name}"],
- expand_if_true = "libraries_to_link.is_whole_archive",
- ),
- ],
- expand_if_equal = variable_with_value(
- name = "libraries_to_link.type",
- value = "static_library",
- ),
- ),
- ],
- expand_if_available = "libraries_to_link",
- ),
- ],
- ),
- ],
- )
- fastbuild_feature = feature(
- name = "fastbuild",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["/DEBUG:FASTLINK", "/INCREMENTAL:NO"],
- ),
- ],
- ),
- ],
- implies = ["generate_pdb_file"],
- )
- user_compile_flags_feature = feature(
- name = "user_compile_flags",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ],
- flag_groups = [
- flag_group(
- flags = ["%{user_compile_flags}"],
- iterate_over = "user_compile_flags",
- expand_if_available = "user_compile_flags",
- ),
- ],
- ),
- ],
- )
- archiver_flags_feature = feature(
- name = "archiver_flags",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.cpp_link_static_library],
- flag_groups = [
- flag_group(
- flags = ["/OUT:%{output_execpath}"],
- expand_if_available = "output_execpath",
- ),
- flag_group(
- flags = ["/MACHINE:X64"],
- ),
- ],
- ),
- ],
- )
- default_link_flags_feature = feature(
- name = "default_link_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/MACHINE:X64"])],
- ),
- ],
- )
- static_link_msvcrt_feature = feature(name = "static_link_msvcrt")
- dynamic_link_msvcrt_debug_feature = feature(
- name = "dynamic_link_msvcrt_debug",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/MDd"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrtd.lib"])],
- ),
- ],
- requires = [feature_set(features = ["dbg"])],
- )
- dbg_feature = feature(
- name = "dbg",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["/DEBUG:FULL", "/INCREMENTAL:NO"],
- ),
- ],
- ),
- ],
- implies = ["generate_pdb_file"],
- )
- opt_feature = feature(
- name = "opt",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/O2"])],
- ),
- ],
- implies = ["frame_pointer"],
- )
- supports_interface_shared_libraries_feature = feature(
- name = "supports_interface_shared_libraries",
- enabled = True,
- )
- user_link_flags_feature = feature(
- name = "user_link_flags",
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["%{user_link_flags}"],
- iterate_over = "user_link_flags",
- expand_if_available = "user_link_flags",
- ),
- ],
- ),
- ],
- )
- default_compile_flags_feature = feature(
- name = "default_compile_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = [
- flag_group(
- flags = [
- "/DCOMPILER_MSVC",
- "/DNOMINMAX",
- "/D_WIN32_WINNT=0x0601",
- "/D_CRT_SECURE_NO_DEPRECATE",
- "/D_CRT_SECURE_NO_WARNINGS",
- "/bigobj",
- "/Zm500",
- "/EHsc",
- "/wd4351",
- "/wd4291",
- "/wd4250",
- "/wd4996",
- ],
- ),
- ],
- ),
- ],
- )
- msvc_compile_env_feature = feature(
- name = "msvc_compile_env",
- env_sets = [
- env_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ],
- 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;")],
- ),
- ],
- )
- preprocessor_defines_feature = feature(
- name = "preprocessor_defines",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ],
- flag_groups = [
- flag_group(
- flags = ["/D%{preprocessor_defines}"],
- iterate_over = "preprocessor_defines",
- ),
- ],
- ),
- ],
- )
- generate_pdb_file_feature = feature(
- name = "generate_pdb_file",
- requires = [
- feature_set(features = ["dbg"]),
- feature_set(features = ["fastbuild"]),
- ],
- )
- output_execpath_flags_feature = feature(
- name = "output_execpath_flags",
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["/OUT:%{output_execpath}"],
- expand_if_available = "output_execpath",
- ),
- ],
- ),
- ],
- )
- dynamic_link_msvcrt_no_debug_feature = feature(
- name = "dynamic_link_msvcrt_no_debug",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/MD"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrt.lib"])],
- ),
- ],
- requires = [
- feature_set(features = ["fastbuild"]),
- feature_set(features = ["opt"]),
- ],
- )
- disable_assertions_feature = feature(
- name = "disable_assertions",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/DNDEBUG"])],
- with_features = [with_feature_set(features = ["opt"])],
- ),
- ],
- )
- has_configured_linker_path_feature = feature(name = "has_configured_linker_path")
- supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
- no_stripping_feature = feature(name = "no_stripping")
- linker_param_file_feature = feature(
- name = "linker_param_file",
- flag_sets = [
- flag_set(
- actions = all_link_actions +
- [ACTION_NAMES.cpp_link_static_library],
- flag_groups = [
- flag_group(
- flags = ["@%{linker_param_file}"],
- expand_if_available = "linker_param_file",
- ),
- ],
- ),
- ],
- )
- ignore_noisy_warnings_feature = feature(
- name = "ignore_noisy_warnings",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.cpp_link_static_library],
- flag_groups = [flag_group(flags = ["/ignore:4221"])],
- ),
- ],
- )
- no_legacy_features_feature = feature(name = "no_legacy_features")
- parse_showincludes_feature = feature(
- name = "parse_showincludes",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_header_parsing,
- ],
- flag_groups = [flag_group(flags = ["/showIncludes"])],
- ),
- ],
- )
- static_link_msvcrt_no_debug_feature = feature(
- name = "static_link_msvcrt_no_debug",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/MT"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmt.lib"])],
- ),
- ],
- requires = [
- feature_set(features = ["fastbuild"]),
- feature_set(features = ["opt"]),
- ],
- )
- treat_warnings_as_errors_feature = feature(
- name = "treat_warnings_as_errors",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/WX"])],
- ),
- ],
- )
- windows_export_all_symbols_feature = feature(name = "windows_export_all_symbols")
- no_windows_export_all_symbols_feature = feature(name = "no_windows_export_all_symbols")
- include_paths_feature = feature(
- name = "include_paths",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ],
- flag_groups = [
- flag_group(
- flags = ["/I%{quote_include_paths}"],
- iterate_over = "quote_include_paths",
- ),
- flag_group(
- flags = ["/I%{include_paths}"],
- iterate_over = "include_paths",
- ),
- flag_group(
- flags = ["/I%{system_include_paths}"],
- iterate_over = "system_include_paths",
- ),
- ],
- ),
- ],
- )
- linkstamps_feature = feature(
- name = "linkstamps",
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["%{linkstamp_paths}"],
- iterate_over = "linkstamp_paths",
- expand_if_available = "linkstamp_paths",
- ),
- ],
- ),
- ],
- )
- targets_windows_feature = feature(
- name = "targets_windows",
- enabled = True,
- implies = ["copy_dynamic_libraries_to_binary"],
- )
- linker_subsystem_flag_feature = feature(
- name = "linker_subsystem_flag",
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/SUBSYSTEM:CONSOLE"])],
- ),
- ],
- )
- static_link_msvcrt_debug_feature = feature(
- name = "static_link_msvcrt_debug",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/MTd"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmtd.lib"])],
- ),
- ],
- requires = [feature_set(features = ["dbg"])],
- )
- frame_pointer_feature = feature(
- name = "frame_pointer",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/Oy-"])],
- ),
- ],
- )
- compiler_output_flags_feature = feature(
- name = "compiler_output_flags",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.assemble],
- flag_groups = [
- flag_group(
- flag_groups = [
- flag_group(
- flags = ["/Fo%{output_file}", "/Zi"],
- expand_if_available = "output_file",
- expand_if_not_available = "output_assembly_file",
- ),
- ],
- expand_if_not_available = "output_preprocess_file",
- ),
- ],
- ),
- flag_set(
- actions = [
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ],
- flag_groups = [
- flag_group(
- flag_groups = [
- flag_group(
- flags = ["/Fo%{output_file}"],
- expand_if_not_available = "output_preprocess_file",
- ),
- ],
- expand_if_available = "output_file",
- expand_if_not_available = "output_assembly_file",
- ),
- flag_group(
- flag_groups = [
- flag_group(
- flags = ["/Fa%{output_file}"],
- expand_if_available = "output_assembly_file",
- ),
- ],
- expand_if_available = "output_file",
- ),
- flag_group(
- flag_groups = [
- flag_group(
- flags = ["/P", "/Fi%{output_file}"],
- expand_if_available = "output_preprocess_file",
- ),
- ],
- expand_if_available = "output_file",
- ),
- ],
- ),
- ],
- )
- nologo_feature = feature(
- name = "nologo",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ACTION_NAMES.cpp_link_static_library,
- ],
- flag_groups = [flag_group(flags = ["/nologo"])],
- ),
- ],
- )
- smaller_binary_feature = feature(
- name = "smaller_binary",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [flag_group(flags = ["/Gy", "/Gw"])],
- with_features = [with_feature_set(features = ["opt"])],
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = [flag_group(flags = ["/OPT:ICF", "/OPT:REF"])],
- with_features = [with_feature_set(features = ["opt"])],
- ),
- ],
- )
- compiler_input_flags_feature = feature(
- name = "compiler_input_flags",
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ],
- flag_groups = [
- flag_group(
- flags = ["/c", "%{source_file}"],
- expand_if_available = "source_file",
- ),
- ],
- ),
- ],
- )
- def_file_feature = feature(
- name = "def_file",
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = [
- flag_group(
- flags = ["/DEF:%{def_file_path}", "/ignore:4070"],
- expand_if_available = "def_file_path",
- ),
- ],
- ),
- ],
- )
- msvc_env_feature = feature(
- name = "msvc_env",
- env_sets = [
- env_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ACTION_NAMES.cpp_link_static_library,
- ],
- env_entries = [
- 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"),
- env_entry(key = "TMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"),
- env_entry(key = "TEMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"),
- ],
- ),
- ],
- implies = ["msvc_compile_env", "msvc_link_env"],
- )
- features = [
- no_legacy_features_feature,
- nologo_feature,
- has_configured_linker_path_feature,
- no_stripping_feature,
- targets_windows_feature,
- copy_dynamic_libraries_to_binary_feature,
- default_compile_flags_feature,
- msvc_env_feature,
- msvc_compile_env_feature,
- msvc_link_env_feature,
- include_paths_feature,
- preprocessor_defines_feature,
- parse_showincludes_feature,
- generate_pdb_file_feature,
- shared_flag_feature,
- linkstamps_feature,
- output_execpath_flags_feature,
- archiver_flags_feature,
- input_param_flags_feature,
- linker_subsystem_flag_feature,
- user_link_flags_feature,
- default_link_flags_feature,
- linker_param_file_feature,
- static_link_msvcrt_feature,
- static_link_msvcrt_no_debug_feature,
- dynamic_link_msvcrt_no_debug_feature,
- static_link_msvcrt_debug_feature,
- dynamic_link_msvcrt_debug_feature,
- dbg_feature,
- fastbuild_feature,
- opt_feature,
- frame_pointer_feature,
- disable_assertions_feature,
- determinism_feature,
- treat_warnings_as_errors_feature,
- smaller_binary_feature,
- ignore_noisy_warnings_feature,
- user_compile_flags_feature,
- sysroot_feature,
- unfiltered_compile_flags_feature,
- compiler_param_file_feature,
- compiler_output_flags_feature,
- compiler_input_flags_feature,
- def_file_feature,
- windows_export_all_symbols_feature,
- no_windows_export_all_symbols_feature,
- supports_dynamic_linker_feature,
- supports_interface_shared_libraries_feature,
- ]
- artifact_name_patterns = [
- artifact_name_pattern(
- category_name = "object_file",
- prefix = "",
- extension = ".obj",
- ),
- artifact_name_pattern(
- category_name = "static_library",
- prefix = "",
- extension = ".lib",
- ),
- artifact_name_pattern(
- category_name = "alwayslink_static_library",
- prefix = "",
- extension = ".lo.lib",
- ),
- artifact_name_pattern(
- category_name = "executable",
- prefix = "",
- extension = ".exe",
- ),
- artifact_name_pattern(
- category_name = "dynamic_library",
- prefix = "",
- extension = ".dll",
- ),
- artifact_name_pattern(
- category_name = "interface_library",
- prefix = "",
- extension = ".if.lib",
- ),
- ]
- make_variables = []
- tool_paths = [
- tool_path(name = "ar", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/lib.exe"),
- tool_path(name = "ml", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe"),
- tool_path(name = "cpp", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"),
- tool_path(name = "gcc", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"),
- tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"),
- tool_path(name = "ld", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe"),
- tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"),
- tool_path(
- name = "objcopy",
- path = "wrapper/bin/msvc_nop.bat",
- ),
- tool_path(
- name = "objdump",
- path = "wrapper/bin/msvc_nop.bat",
- ),
- tool_path(
- name = "strip",
- path = "wrapper/bin/msvc_nop.bat",
- ),
- ]
- return cc_common.create_cc_toolchain_config_info(
- ctx = ctx,
- features = features,
- action_configs = action_configs,
- artifact_name_patterns = artifact_name_patterns,
- cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = toolchain_identifier,
- host_system_name = host_system_name,
- target_system_name = target_system_name,
- target_cpu = target_cpu,
- target_libc = target_libc,
- compiler = compiler,
- abi_version = abi_version,
- abi_libc_version = abi_libc_version,
- tool_paths = tool_paths,
- make_variables = make_variables,
- builtin_sysroot = builtin_sysroot,
- cc_target_os = None,
- )
- def _windows_msys_mingw_impl(ctx):
- toolchain_identifier = "msys_x64_mingw"
- host_system_name = "local"
- target_system_name = "local"
- target_cpu = "x64_windows"
- target_libc = "mingw"
- compiler = "mingw-gcc"
- abi_version = "local"
- abi_libc_version = "local"
- cc_target_os = None
- builtin_sysroot = None
- action_configs = []
- targets_windows_feature = feature(
- name = "targets_windows",
- implies = ["copy_dynamic_libraries_to_binary"],
- enabled = True,
- )
- copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
- gcc_env_feature = feature(
- name = "gcc_env",
- enabled = True,
- env_sets = [
- env_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ACTION_NAMES.cpp_link_static_library,
- ],
- env_entries = [
- env_entry(key = "PATH", value = "c:/tools/msys64/mingw64/bin"),
- ],
- ),
- ],
- )
- msys_mingw_flags = [
- "-std=gnu++0x",
- ]
- msys_mingw_link_flags = [
- "-lstdc++",
- ]
- default_compile_flags_feature = feature(
- name = "default_compile_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- ),
- flag_set(
- actions = [
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []),
- ),
- ],
- )
- compiler_param_file_feature = feature(
- name = "compiler_param_file",
- )
- default_link_flags_feature = feature(
- name = "default_link_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []),
- ),
- ],
- )
- supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
- features = [
- targets_windows_feature,
- copy_dynamic_libraries_to_binary_feature,
- gcc_env_feature,
- default_compile_flags_feature,
- compiler_param_file_feature,
- default_link_flags_feature,
- supports_dynamic_linker_feature,
- ]
- cxx_builtin_include_directories = [
- # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087.
- "C:\\botcode\\w",
- "c:/tools/msys64/mingw64/",
- "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",
- ]
- artifact_name_patterns = [
- artifact_name_pattern(
- category_name = "executable",
- prefix = "",
- extension = ".exe",
- ),
- ]
- make_variables = []
- tool_paths = [
- tool_path(name = "ar", path = "c:/tools/msys64/mingw64/bin/ar"),
- tool_path(name = "compat-ld", path = "c:/tools/msys64/mingw64/bin/ld"),
- tool_path(name = "cpp", path = "c:/tools/msys64/mingw64/bin/cpp"),
- tool_path(name = "dwp", path = "c:/tools/msys64/mingw64/bin/dwp"),
- tool_path(name = "gcc", path = "c:/tools/msys64/mingw64/bin/gcc"),
- tool_path(name = "gcov", path = "c:/tools/msys64/mingw64/bin/gcov"),
- tool_path(name = "ld", path = "c:/tools/msys64/mingw64/bin/ld"),
- tool_path(name = "nm", path = "c:/tools/msys64/mingw64/bin/nm"),
- tool_path(name = "objcopy", path = "c:/tools/msys64/mingw64/bin/objcopy"),
- tool_path(name = "objdump", path = "c:/tools/msys64/mingw64/bin/objdump"),
- tool_path(name = "strip", path = "c:/tools/msys64/mingw64/bin/strip"),
- ]
- return cc_common.create_cc_toolchain_config_info(
- ctx = ctx,
- features = features,
- action_configs = action_configs,
- artifact_name_patterns = artifact_name_patterns,
- cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = toolchain_identifier,
- host_system_name = host_system_name,
- target_system_name = target_system_name,
- target_cpu = target_cpu,
- target_libc = target_libc,
- compiler = compiler,
- abi_version = abi_version,
- abi_libc_version = abi_libc_version,
- tool_paths = tool_paths,
- make_variables = make_variables,
- builtin_sysroot = builtin_sysroot,
- cc_target_os = cc_target_os,
- )
- def _armeabi_impl(ctx):
- toolchain_identifier = "stub_armeabi-v7a"
- host_system_name = "armeabi-v7a"
- target_system_name = "armeabi-v7a"
- target_cpu = "armeabi-v7a"
- target_libc = "armeabi-v7a"
- compiler = "compiler"
- abi_version = "armeabi-v7a"
- abi_libc_version = "armeabi-v7a"
- cc_target_os = None
- builtin_sysroot = None
- action_configs = []
- supports_pic_feature = feature(name = "supports_pic", enabled = True)
- supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
- features = [supports_dynamic_linker_feature, supports_pic_feature]
- cxx_builtin_include_directories = [
- # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087.
- "C:\\botcode\\w",
- ]
- artifact_name_patterns = []
- make_variables = []
- tool_paths = [
- tool_path(name = "ar", path = "/bin/false"),
- tool_path(name = "compat-ld", path = "/bin/false"),
- tool_path(name = "cpp", path = "/bin/false"),
- tool_path(name = "dwp", path = "/bin/false"),
- tool_path(name = "gcc", path = "/bin/false"),
- tool_path(name = "gcov", path = "/bin/false"),
- tool_path(name = "ld", path = "/bin/false"),
- tool_path(name = "nm", path = "/bin/false"),
- tool_path(name = "objcopy", path = "/bin/false"),
- tool_path(name = "objdump", path = "/bin/false"),
- tool_path(name = "strip", path = "/bin/false"),
- ]
- return cc_common.create_cc_toolchain_config_info(
- ctx = ctx,
- features = features,
- action_configs = action_configs,
- artifact_name_patterns = artifact_name_patterns,
- cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = toolchain_identifier,
- host_system_name = host_system_name,
- target_system_name = target_system_name,
- target_cpu = target_cpu,
- target_libc = target_libc,
- compiler = compiler,
- abi_version = abi_version,
- abi_libc_version = abi_libc_version,
- tool_paths = tool_paths,
- make_variables = make_variables,
- builtin_sysroot = builtin_sysroot,
- cc_target_os = cc_target_os,
- )
- def _impl(ctx):
- if ctx.attr.cpu == "armeabi-v7a":
- return _armeabi_impl(ctx)
- elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "msvc-cl":
- return _windows_msvc_impl(ctx)
- elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "mingw-gcc":
- return _windows_msys_mingw_impl(ctx)
- tool_paths = [
- tool_path(name = "ar", path = "c:/tools/msys64/usr/bin/ar"),
- tool_path(name = "compat-ld", path = "c:/tools/msys64/usr/bin/ld"),
- tool_path(name = "cpp", path = "c:/tools/msys64/usr/bin/cpp"),
- tool_path(name = "dwp", path = "c:/tools/msys64/usr/bin/dwp"),
- tool_path(name = "gcc", path = "c:/tools/msys64/usr/bin/gcc"),
- tool_path(name = "gcov", path = "c:/tools/msys64/usr/bin/gcov"),
- tool_path(name = "ld", path = "c:/tools/msys64/usr/bin/ld"),
- tool_path(name = "nm", path = "c:/tools/msys64/usr/bin/nm"),
- tool_path(name = "objcopy", path = "c:/tools/msys64/usr/bin/objcopy"),
- tool_path(name = "objdump", path = "c:/tools/msys64/usr/bin/objdump"),
- tool_path(name = "strip", path = "c:/tools/msys64/usr/bin/strip"),
- ]
- cxx_builtin_include_directories = [
- # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087.
- "C:\\botcode\\w",
- "c:/tools/msys64/usr/",
- "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",
- ]
- action_configs = []
- compile_flags = [
- ]
- dbg_compile_flags = [
- ]
- opt_compile_flags = [
- ]
- cxx_flags = [
- "-std=gnu++0x",
- ]
- link_flags = [
- "-lstdc++",
- ]
- opt_link_flags = [
- ]
- unfiltered_compile_flags = [
- ]
- targets_windows_feature = feature(
- name = "targets_windows",
- implies = ["copy_dynamic_libraries_to_binary"],
- enabled = True,
- )
- copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
- gcc_env_feature = feature(
- name = "gcc_env",
- enabled = True,
- env_sets = [
- env_set(
- actions = [
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ACTION_NAMES.cpp_link_static_library,
- ],
- env_entries = [
- env_entry(key = "PATH", value = "c:/tools/msys64/usr/bin"),
- ],
- ),
- ],
- )
- windows_features = [
- targets_windows_feature,
- copy_dynamic_libraries_to_binary_feature,
- gcc_env_feature,
- ]
- supports_pic_feature = feature(
- name = "supports_pic",
- enabled = True,
- )
- supports_start_end_lib_feature = feature(
- name = "supports_start_end_lib",
- enabled = True,
- )
- default_compile_flags_feature = feature(
- name = "default_compile_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = compile_flags)] if compile_flags else []),
- ),
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = dbg_compile_flags)] if dbg_compile_flags else []),
- with_features = [with_feature_set(features = ["dbg"])],
- ),
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = opt_compile_flags)] if opt_compile_flags else []),
- with_features = [with_feature_set(features = ["opt"])],
- ),
- flag_set(
- actions = [
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = cxx_flags)] if cxx_flags else []),
- ),
- ],
- )
- default_link_flags_feature = feature(
- name = "default_link_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = all_link_actions,
- flag_groups = ([flag_group(flags = link_flags)] if link_flags else []),
- ),
- flag_set(
- actions = all_link_actions,
- flag_groups = ([flag_group(flags = opt_link_flags)] if opt_link_flags else []),
- with_features = [with_feature_set(features = ["opt"])],
- ),
- ],
- )
- dbg_feature = feature(name = "dbg")
- opt_feature = feature(name = "opt")
- sysroot_feature = feature(
- name = "sysroot",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ACTION_NAMES.cpp_link_executable,
- ACTION_NAMES.cpp_link_dynamic_library,
- ACTION_NAMES.cpp_link_nodeps_dynamic_library,
- ],
- flag_groups = [
- flag_group(
- flags = ["--sysroot=%{sysroot}"],
- expand_if_available = "sysroot",
- ),
- ],
- ),
- ],
- )
- fdo_optimize_feature = feature(
- name = "fdo_optimize",
- flag_sets = [
- flag_set(
- actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
- flag_groups = [
- flag_group(
- flags = [
- "-fprofile-use=%{fdo_profile_path}",
- "-fprofile-correction",
- ],
- expand_if_available = "fdo_profile_path",
- ),
- ],
- ),
- ],
- provides = ["profile"],
- )
- supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
- user_compile_flags_feature = feature(
- name = "user_compile_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = [
- flag_group(
- flags = ["%{user_compile_flags}"],
- iterate_over = "user_compile_flags",
- expand_if_available = "user_compile_flags",
- ),
- ],
- ),
- ],
- )
- unfiltered_compile_flags_feature = feature(
- name = "unfiltered_compile_flags",
- enabled = True,
- flag_sets = [
- flag_set(
- actions = [
- ACTION_NAMES.assemble,
- ACTION_NAMES.preprocess_assemble,
- ACTION_NAMES.linkstamp_compile,
- ACTION_NAMES.c_compile,
- ACTION_NAMES.cpp_compile,
- ACTION_NAMES.cpp_header_parsing,
- ACTION_NAMES.cpp_module_compile,
- ACTION_NAMES.cpp_module_codegen,
- ACTION_NAMES.lto_backend,
- ACTION_NAMES.clif_match,
- ],
- flag_groups = ([flag_group(flags = unfiltered_compile_flags)] if unfiltered_compile_flags else []),
- ),
- ],
- )
- features = windows_features + [
- supports_pic_feature,
- default_compile_flags_feature,
- default_link_flags_feature,
- fdo_optimize_feature,
- supports_dynamic_linker_feature,
- dbg_feature,
- opt_feature,
- user_compile_flags_feature,
- sysroot_feature,
- unfiltered_compile_flags_feature,
- ]
- artifact_name_patterns = [
- artifact_name_pattern(category_name = "executable", prefix = "", extension = ".exe"),
- ]
- make_variables = []
- return cc_common.create_cc_toolchain_config_info(
- ctx = ctx,
- features = features,
- action_configs = action_configs,
- artifact_name_patterns = artifact_name_patterns,
- cxx_builtin_include_directories = cxx_builtin_include_directories,
- toolchain_identifier = "msys_x64",
- host_system_name = "local",
- target_system_name = "local",
- target_cpu = "x64_windows",
- target_libc = "msys",
- compiler = "msys-gcc",
- abi_version = "local",
- abi_libc_version = "local",
- tool_paths = tool_paths,
- make_variables = make_variables,
- builtin_sysroot = "",
- cc_target_os = None,
- )
- cc_toolchain_config = rule(
- implementation = _impl,
- attrs = {
- "cpu": attr.string(mandatory = True),
- "compiler": attr.string(),
- },
- provides = [CcToolchainConfigInfo],
- )
|