• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_library", "cc_toolchain", "cc_toolchain_suite")
20load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config")
21load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config")
22
23cc_library(
24    name = "malloc",
25)
26
27filegroup(
28    name = "empty",
29    srcs = [],
30)
31
32filegroup(
33    name = "mingw_compiler_files",
34    srcs = [":builtin_include_directory_paths_mingw"],
35)
36
37filegroup(
38    name = "clangcl_compiler_files",
39    srcs = [":builtin_include_directory_paths_clangcl"],
40)
41
42filegroup(
43    name = "msvc_compiler_files",
44    srcs = [":builtin_include_directory_paths_msvc"],
45)
46
47# Hardcoded toolchain, legacy behaviour.
48cc_toolchain_suite(
49    name = "toolchain",
50    toolchains = {
51        "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
52        "x64_windows|msvc-cl": ":cc-compiler-x64_windows",
53        "x64_windows|msys-gcc": ":cc-compiler-x64_windows_msys",
54        "x64_windows|mingw-gcc": ":cc-compiler-x64_windows_mingw",
55        "x64_windows|clang-cl": ":cc-compiler-x64_windows-clang-cl",
56        "x64_windows_msys": ":cc-compiler-x64_windows_msys",
57        "x64_windows": ":cc-compiler-x64_windows",
58        "armeabi-v7a": ":cc-compiler-armeabi-v7a",
59    },
60)
61
62cc_toolchain(
63    name = "cc-compiler-x64_windows_msys",
64    all_files = ":empty",
65    ar_files = ":empty",
66    as_files = ":mingw_compiler_files",
67    compiler_files = ":mingw_compiler_files",
68    dwp_files = ":empty",
69    linker_files = ":empty",
70    objcopy_files = ":empty",
71    strip_files = ":empty",
72    supports_param_files = 1,
73    toolchain_config = ":msys_x64",
74    toolchain_identifier = "msys_x64",
75)
76
77cc_toolchain_config(
78    name = "msys_x64",
79    abi_libc_version = "local",
80    abi_version = "local",
81    compiler = "msys-gcc",
82    cpu = "x64_windows",
83    cxx_builtin_include_directories = [
84        "c:/tools/msys64/usr/",
85    ],
86    dbg_mode_debug_flag = "/DEBUG:FULL",
87    fastbuild_mode_debug_flag = "/DEBUG:FASTLINK",
88    host_system_name = "local",
89    target_libc = "msys",
90    target_system_name = "local",
91    tool_bin_path = "c:/tools/msys64/usr/bin",
92    tool_paths = {
93        "ar": "c:/tools/msys64/usr/bin/ar",
94        "compat-ld": "c:/tools/msys64/usr/bin/compat-ld",
95        "cpp": "c:/tools/msys64/usr/bin/cpp",
96        "dwp": "c:/tools/msys64/usr/bin/dwp",
97        "gcc": "c:/tools/msys64/usr/bin/gcc",
98        "gcov": "c:/tools/msys64/usr/bin/gcov",
99        "ld": "c:/tools/msys64/usr/bin/ld",
100        "nm": "c:/tools/msys64/usr/bin/nm",
101        "objcopy": "c:/tools/msys64/usr/bin/objcopy",
102        "objdump": "c:/tools/msys64/usr/bin/objdump",
103        "strip": "c:/tools/msys64/usr/bin/strip",
104    },
105)
106
107toolchain(
108    name = "cc-toolchain-x64_windows_msys",
109    exec_compatible_with = [
110        "@platforms//cpu:x86_64",
111        "@platforms//os:windows",
112        "@bazel_tools//tools/cpp:msys",
113    ],
114    target_compatible_with = [
115        "@platforms//cpu:x86_64",
116        "@platforms//os:windows",
117    ],
118    toolchain = ":cc-compiler-x64_windows_msys",
119    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
120)
121
122cc_toolchain(
123    name = "cc-compiler-x64_windows_mingw",
124    all_files = ":empty",
125    ar_files = ":empty",
126    as_files = ":mingw_compiler_files",
127    compiler_files = ":mingw_compiler_files",
128    dwp_files = ":empty",
129    linker_files = ":empty",
130    objcopy_files = ":empty",
131    strip_files = ":empty",
132    supports_param_files = 0,
133    toolchain_config = ":msys_x64_mingw",
134    toolchain_identifier = "msys_x64_mingw",
135)
136
137cc_toolchain_config(
138    name = "msys_x64_mingw",
139    abi_libc_version = "local",
140    abi_version = "local",
141    compiler = "mingw-gcc",
142    cpu = "x64_windows",
143    cxx_builtin_include_directories = [
144        "c:/tools/msys64/mingw64/",
145    ],
146    dbg_mode_debug_flag = "/DEBUG:FULL",
147    fastbuild_mode_debug_flag = "/DEBUG:FASTLINK",
148    host_system_name = "local",
149    target_libc = "mingw",
150    target_system_name = "local",
151    tool_bin_path = "c:/tools/msys64/mingw64/bin",
152    tool_paths = {
153        "ar": "c:/tools/msys64/mingw64/bin/ar",
154        "compat-ld": "c:/tools/msys64/mingw64/bin/compat-ld",
155        "cpp": "c:/tools/msys64/mingw64/bin/cpp",
156        "dwp": "c:/tools/msys64/mingw64/bin/dwp",
157        "gcc": "c:/tools/msys64/mingw64/bin/gcc",
158        "gcov": "c:/tools/msys64/mingw64/bin/gcov",
159        "ld": "c:/tools/msys64/mingw64/bin/ld",
160        "nm": "c:/tools/msys64/mingw64/bin/nm",
161        "objcopy": "c:/tools/msys64/mingw64/bin/objcopy",
162        "objdump": "c:/tools/msys64/mingw64/bin/objdump",
163        "strip": "c:/tools/msys64/mingw64/bin/strip",
164    },
165)
166
167toolchain(
168    name = "cc-toolchain-x64_windows_mingw",
169    exec_compatible_with = [
170        "@platforms//cpu:x86_64",
171        "@platforms//os:windows",
172        "@bazel_tools//tools/cpp:mingw",
173    ],
174    target_compatible_with = [
175        "@platforms//cpu:x86_64",
176        "@platforms//os:windows",
177    ],
178    toolchain = ":cc-compiler-x64_windows_mingw",
179    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
180)
181
182cc_toolchain(
183    name = "cc-compiler-x64_windows",
184    all_files = ":empty",
185    ar_files = ":empty",
186    as_files = ":msvc_compiler_files",
187    compiler_files = ":msvc_compiler_files",
188    dwp_files = ":empty",
189    linker_files = ":empty",
190    objcopy_files = ":empty",
191    strip_files = ":empty",
192    supports_param_files = 1,
193    toolchain_config = ":msvc_x64",
194    toolchain_identifier = "msvc_x64",
195)
196
197cc_toolchain_config(
198    name = "msvc_x64",
199    abi_libc_version = "local",
200    abi_version = "local",
201    compiler = "msvc-cl",
202    cpu = "x64_windows",
203    cxx_builtin_include_directories = [
204        "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.25.28610\\include",
205        "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um",
206        "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\ucrt",
207        "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\shared",
208        "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\um",
209        "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\winrt",
210        "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\cppwinrt",
211    ],
212    dbg_mode_debug_flag = "/DEBUG:FULL",
213    default_link_flags = ["/MACHINE:X64"],
214    fastbuild_mode_debug_flag = "/DEBUG:FASTLINK",
215    host_system_name = "local",
216    msvc_cl_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/cl.exe",
217    msvc_env_include = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.25.28610\\include;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.17763.0\\cppwinrt",
218    msvc_env_lib = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.25.28610\\lib\\x64;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.17763.0\\um\\x64;",
219    msvc_env_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX64\\x64;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\Common7\\IDE\\VC\\VCPackages;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.8 Tools\\x64\\;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\\\MSBuild\\Current\\Bin;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\Common7\\IDE\\;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\Common7\\Tools\\;;C:\\Windows\\system32",
220    msvc_env_tmp = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp",
221    msvc_lib_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/lib.exe",
222    msvc_link_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/link.exe",
223    msvc_ml_path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/ml64.exe",
224    target_libc = "msvcrt",
225    target_system_name = "local",
226    tool_paths = {
227        "ar": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/lib.exe",
228        "ml": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/ml64.exe",
229        "cpp": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/cl.exe",
230        "gcc": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/cl.exe",
231        "gcov": "wrapper/bin/msvc_nop.bat",
232        "ld": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/link.exe",
233        "nm": "wrapper/bin/msvc_nop.bat",
234        "objcopy": "wrapper/bin/msvc_nop.bat",
235        "objdump": "wrapper/bin/msvc_nop.bat",
236        "strip": "wrapper/bin/msvc_nop.bat",
237    },
238    toolchain_identifier = "msvc_x64",
239)
240
241toolchain(
242    name = "cc-toolchain-x64_windows",
243    exec_compatible_with = [
244        "@platforms//cpu:x86_64",
245        "@platforms//os:windows",
246    ],
247    target_compatible_with = [
248        "@platforms//cpu:x86_64",
249        "@platforms//os:windows",
250    ],
251    toolchain = ":cc-compiler-x64_windows",
252    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
253)
254
255cc_toolchain(
256    name = "cc-compiler-x64_windows-clang-cl",
257    all_files = ":empty",
258    ar_files = ":empty",
259    as_files = ":clangcl_compiler_files",
260    compiler_files = ":clangcl_compiler_files",
261    dwp_files = ":empty",
262    linker_files = ":empty",
263    objcopy_files = ":empty",
264    strip_files = ":empty",
265    supports_param_files = 1,
266    toolchain_config = ":clang_cl_x64",
267    toolchain_identifier = "clang_cl_x64",
268)
269
270cc_toolchain_config(
271    name = "clang_cl_x64",
272    abi_libc_version = "local",
273    abi_version = "local",
274    compiler = "clang-cl",
275    cpu = "x64_windows",
276    cxx_builtin_include_directories = [],
277    dbg_mode_debug_flag = "/DEBUG",
278    default_link_flags = [
279        "/MACHINE:X64",
280        "/DEFAULTLIB:clang_rt.builtins-x86_64.lib",
281    ],
282    fastbuild_mode_debug_flag = "/DEBUG",
283    host_system_name = "local",
284    msvc_cl_path = "clang_installation_error.bat",
285    msvc_env_include = "clang_cl_not_found",
286    msvc_env_lib = "clang_cl_not_found",
287    msvc_env_path = "clang_cl_not_found",
288    msvc_env_tmp = "clang_cl_not_found",
289    msvc_lib_path = "clang_installation_error.bat",
290    msvc_link_path = "clang_installation_error.bat",
291    msvc_ml_path = "clang_installation_error.bat",
292    target_libc = "msvcrt",
293    target_system_name = "local",
294    tool_paths = {
295        "ar": "clang_installation_error.bat",
296        "ml": "clang_installation_error.bat",
297        "cpp": "clang_installation_error.bat",
298        "gcc": "clang_installation_error.bat",
299        "gcov": "wrapper/bin/msvc_nop.bat",
300        "ld": "clang_installation_error.bat",
301        "nm": "wrapper/bin/msvc_nop.bat",
302        "objcopy": "wrapper/bin/msvc_nop.bat",
303        "objdump": "wrapper/bin/msvc_nop.bat",
304        "strip": "wrapper/bin/msvc_nop.bat",
305    },
306    toolchain_identifier = "clang_cl_x64",
307)
308
309toolchain(
310    name = "cc-toolchain-x64_windows-clang-cl",
311    exec_compatible_with = [
312        "@platforms//cpu:x86_64",
313        "@platforms//os:windows",
314        "@bazel_tools//tools/cpp:clang-cl",
315    ],
316    target_compatible_with = [
317        "@platforms//cpu:x86_64",
318        "@platforms//os:windows",
319    ],
320    toolchain = ":cc-compiler-x64_windows-clang-cl",
321    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
322)
323
324cc_toolchain(
325    name = "cc-compiler-armeabi-v7a",
326    all_files = ":empty",
327    ar_files = ":empty",
328    as_files = ":empty",
329    compiler_files = ":empty",
330    dwp_files = ":empty",
331    linker_files = ":empty",
332    objcopy_files = ":empty",
333    strip_files = ":empty",
334    supports_param_files = 1,
335    toolchain_config = ":stub_armeabi-v7a",
336    toolchain_identifier = "stub_armeabi-v7a",
337)
338
339armeabi_cc_toolchain_config(name = "stub_armeabi-v7a")
340
341toolchain(
342    name = "cc-toolchain-armeabi-v7a",
343    exec_compatible_with = [
344    ],
345    target_compatible_with = [
346        "@platforms//cpu:arm",
347        "@platforms//os:android",
348    ],
349    toolchain = ":cc-compiler-armeabi-v7a",
350    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
351)
352
353filegroup(
354    name = "link_dynamic_library",
355    srcs = ["link_dynamic_library.sh"],
356)
357