1# Copyright 2018 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# This becomes the BUILD file for @local_config_cc// under Windows. 16 17package(default_visibility = ["//visibility:public"]) 18 19load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite", "cc_library") 20load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config") 21load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config") 22cc_library( 23 name = "malloc", 24) 25 26filegroup( 27 name = "empty", 28 srcs = [], 29) 30 31filegroup( 32 name = "mingw_compiler_files", 33 srcs = [":builtin_include_directory_paths_mingw"] 34) 35 36filegroup( 37 name = "clangcl_compiler_files", 38 srcs = [":builtin_include_directory_paths_clangcl"] 39) 40 41filegroup( 42 name = "msvc_compiler_files", 43 srcs = [":builtin_include_directory_paths_msvc"] 44) 45 46# Hardcoded toolchain, legacy behaviour. 47cc_toolchain_suite( 48 name = "toolchain", 49 toolchains = { 50 "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", 51 "x64_windows|msvc-cl": ":cc-compiler-x64_windows", 52 "x64_windows|msys-gcc": ":cc-compiler-x64_windows_msys", 53 "x64_windows|mingw-gcc": ":cc-compiler-x64_windows_mingw", 54 "x64_windows|clang-cl": ":cc-compiler-x64_windows-clang-cl", 55 "x64_windows_msys": ":cc-compiler-x64_windows_msys", 56 "x64_windows": ":cc-compiler-x64_windows", 57 "armeabi-v7a": ":cc-compiler-armeabi-v7a", 58 }, 59) 60 61cc_toolchain( 62 name = "cc-compiler-x64_windows_msys", 63 toolchain_identifier = "msys_x64", 64 toolchain_config = ":msys_x64", 65 all_files = ":empty", 66 ar_files = ":empty", 67 as_files = ":mingw_compiler_files", 68 compiler_files = ":mingw_compiler_files", 69 dwp_files = ":empty", 70 linker_files = ":empty", 71 objcopy_files = ":empty", 72 strip_files = ":empty", 73 supports_param_files = 1, 74) 75 76cc_toolchain_config( 77 name = "msys_x64", 78 cpu = "x64_windows", 79 compiler = "msys-gcc", 80 host_system_name = "local", 81 target_system_name = "local", 82 target_libc = "msys", 83 abi_version = "local", 84 abi_libc_version = "local", 85 cxx_builtin_include_directories = [%{cxx_builtin_include_directories}], 86 tool_paths = {%{tool_paths}}, 87 tool_bin_path = "%{tool_bin_path}", 88 dbg_mode_debug_flag = "%{dbg_mode_debug_flag}", 89 fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag}", 90) 91 92toolchain( 93 name = "cc-toolchain-x64_windows_msys", 94 exec_compatible_with = [ 95 "@platforms//cpu:x86_64", 96 "@platforms//os:windows", 97 "@rules_cc//cc/private/toolchain:msys", 98 ], 99 target_compatible_with = [ 100 "@platforms//cpu:x86_64", 101 "@platforms//os:windows", 102 ], 103 toolchain = ":cc-compiler-x64_windows_msys", 104 toolchain_type = "@rules_cc//cc:toolchain_type", 105) 106 107cc_toolchain( 108 name = "cc-compiler-x64_windows_mingw", 109 toolchain_identifier = "msys_x64_mingw", 110 toolchain_config = ":msys_x64_mingw", 111 all_files = ":empty", 112 ar_files = ":empty", 113 as_files = ":mingw_compiler_files", 114 compiler_files = ":mingw_compiler_files", 115 dwp_files = ":empty", 116 linker_files = ":empty", 117 objcopy_files = ":empty", 118 strip_files = ":empty", 119 supports_param_files = 0, 120) 121 122cc_toolchain_config( 123 name = "msys_x64_mingw", 124 cpu = "x64_windows", 125 compiler = "mingw-gcc", 126 host_system_name = "local", 127 target_system_name = "local", 128 target_libc = "mingw", 129 abi_version = "local", 130 abi_libc_version = "local", 131 tool_bin_path = "%{mingw_tool_bin_path}", 132 cxx_builtin_include_directories = [%{mingw_cxx_builtin_include_directories}], 133 tool_paths = {%{mingw_tool_paths}}, 134 dbg_mode_debug_flag = "%{dbg_mode_debug_flag}", 135 fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag}", 136) 137 138toolchain( 139 name = "cc-toolchain-x64_windows_mingw", 140 exec_compatible_with = [ 141 "@platforms//cpu:x86_64", 142 "@platforms//os:windows", 143 "@rules_cc//cc/private/toolchain:mingw", 144 ], 145 target_compatible_with = [ 146 "@platforms//cpu:x86_64", 147 "@platforms//os:windows", 148 ], 149 toolchain = ":cc-compiler-x64_windows_mingw", 150 toolchain_type = "@rules_cc//cc:toolchain_type", 151) 152 153cc_toolchain( 154 name = "cc-compiler-x64_windows", 155 toolchain_identifier = "msvc_x64", 156 toolchain_config = ":msvc_x64", 157 all_files = ":empty", 158 ar_files = ":empty", 159 as_files = ":msvc_compiler_files", 160 compiler_files = ":msvc_compiler_files", 161 dwp_files = ":empty", 162 linker_files = ":empty", 163 objcopy_files = ":empty", 164 strip_files = ":empty", 165 supports_param_files = 1, 166) 167 168cc_toolchain_config( 169 name = "msvc_x64", 170 cpu = "x64_windows", 171 compiler = "msvc-cl", 172 host_system_name = "local", 173 target_system_name = "local", 174 target_libc = "msvcrt", 175 abi_version = "local", 176 abi_libc_version = "local", 177 toolchain_identifier = "msvc_x64", 178 msvc_env_tmp = "%{msvc_env_tmp}", 179 msvc_env_path = "%{msvc_env_path}", 180 msvc_env_include = "%{msvc_env_include}", 181 msvc_env_lib = "%{msvc_env_lib}", 182 msvc_cl_path = "%{msvc_cl_path}", 183 msvc_ml_path = "%{msvc_ml_path}", 184 msvc_link_path = "%{msvc_link_path}", 185 msvc_lib_path = "%{msvc_lib_path}", 186 cxx_builtin_include_directories = [%{msvc_cxx_builtin_include_directories}], 187 tool_paths = { 188 "ar": "%{msvc_lib_path}", 189 "ml": "%{msvc_ml_path}", 190 "cpp": "%{msvc_cl_path}", 191 "gcc": "%{msvc_cl_path}", 192 "gcov": "wrapper/bin/msvc_nop.bat", 193 "ld": "%{msvc_link_path}", 194 "nm": "wrapper/bin/msvc_nop.bat", 195 "objcopy": "wrapper/bin/msvc_nop.bat", 196 "objdump": "wrapper/bin/msvc_nop.bat", 197 "strip": "wrapper/bin/msvc_nop.bat", 198 }, 199 default_link_flags = ["/MACHINE:X64"], 200 dbg_mode_debug_flag = "%{dbg_mode_debug_flag}", 201 fastbuild_mode_debug_flag = "%{fastbuild_mode_debug_flag}", 202) 203 204toolchain( 205 name = "cc-toolchain-x64_windows", 206 exec_compatible_with = [ 207 "@platforms//cpu:x86_64", 208 "@platforms//os:windows", 209 ], 210 target_compatible_with = [ 211 "@platforms//cpu:x86_64", 212 "@platforms//os:windows", 213 ], 214 toolchain = ":cc-compiler-x64_windows", 215 toolchain_type = "@rules_cc//cc:toolchain_type", 216) 217 218cc_toolchain( 219 name = "cc-compiler-x64_windows-clang-cl", 220 toolchain_identifier = "clang_cl_x64", 221 toolchain_config = ":clang_cl_x64", 222 all_files = ":empty", 223 ar_files = ":empty", 224 as_files = ":clangcl_compiler_files", 225 compiler_files = ":clangcl_compiler_files", 226 dwp_files = ":empty", 227 linker_files = ":empty", 228 objcopy_files = ":empty", 229 strip_files = ":empty", 230 supports_param_files = 1, 231) 232 233cc_toolchain_config( 234 name = "clang_cl_x64", 235 cpu = "x64_windows", 236 compiler = "clang-cl", 237 host_system_name = "local", 238 target_system_name = "local", 239 target_libc = "msvcrt", 240 abi_version = "local", 241 abi_libc_version = "local", 242 toolchain_identifier = "clang_cl_x64", 243 msvc_env_tmp = "%{clang_cl_env_tmp}", 244 msvc_env_path = "%{clang_cl_env_path}", 245 msvc_env_include = "%{clang_cl_env_include}", 246 msvc_env_lib = "%{clang_cl_env_lib}", 247 msvc_cl_path = "%{clang_cl_cl_path}", 248 msvc_ml_path = "%{clang_cl_ml_path}", 249 msvc_link_path = "%{clang_cl_link_path}", 250 msvc_lib_path = "%{clang_cl_lib_path}", 251 cxx_builtin_include_directories = [%{clang_cl_cxx_builtin_include_directories}], 252 tool_paths = { 253 "ar": "%{clang_cl_lib_path}", 254 "ml": "%{clang_cl_ml_path}", 255 "cpp": "%{clang_cl_cl_path}", 256 "gcc": "%{clang_cl_cl_path}", 257 "gcov": "wrapper/bin/msvc_nop.bat", 258 "ld": "%{clang_cl_link_path}", 259 "nm": "wrapper/bin/msvc_nop.bat", 260 "objcopy": "wrapper/bin/msvc_nop.bat", 261 "objdump": "wrapper/bin/msvc_nop.bat", 262 "strip": "wrapper/bin/msvc_nop.bat", 263 }, 264 default_link_flags = ["/MACHINE:X64", "/DEFAULTLIB:clang_rt.builtins-x86_64.lib"], 265 dbg_mode_debug_flag = "%{clang_cl_dbg_mode_debug_flag}", 266 fastbuild_mode_debug_flag = "%{clang_cl_fastbuild_mode_debug_flag}", 267) 268 269toolchain( 270 name = "cc-toolchain-x64_windows-clang-cl", 271 exec_compatible_with = [ 272 "@platforms//cpu:x86_64", 273 "@platforms//os:windows", 274 "@rules_cc//cc/private/toolchain:clang-cl", 275 ], 276 target_compatible_with = [ 277 "@platforms//cpu:x86_64", 278 "@platforms//os:windows", 279 ], 280 toolchain = ":cc-compiler-x64_windows-clang-cl", 281 toolchain_type = "@rules_cc//cc:toolchain_type", 282) 283 284cc_toolchain( 285 name = "cc-compiler-armeabi-v7a", 286 toolchain_identifier = "stub_armeabi-v7a", 287 toolchain_config = ":stub_armeabi-v7a", 288 all_files = ":empty", 289 ar_files = ":empty", 290 as_files = ":empty", 291 compiler_files = ":empty", 292 dwp_files = ":empty", 293 linker_files = ":empty", 294 objcopy_files = ":empty", 295 strip_files = ":empty", 296 supports_param_files = 1, 297) 298 299armeabi_cc_toolchain_config(name = "stub_armeabi-v7a") 300 301toolchain( 302 name = "cc-toolchain-armeabi-v7a", 303 exec_compatible_with = [ 304 ], 305 target_compatible_with = [ 306 "@platforms//cpu:arm", 307 "@platforms//os:android", 308 ], 309 toolchain = ":cc-compiler-armeabi-v7a", 310 toolchain_type = "@rules_cc//cc:toolchain_type", 311) 312 313filegroup( 314 name = "link_dynamic_library", 315 srcs = ["link_dynamic_library.sh"], 316) 317