1# This file is expanded from a template by cuda_configure.bzl
2# Update cuda_configure.bzl#verify_build_defines when adding new variables.
3
4load(":cc_toolchain_config.bzl", "cc_toolchain_config")
5
6licenses(["restricted"])
7
8package(default_visibility = ["//visibility:public"])
9
10toolchain(
11    name = "toolchain-linux-x86_64",
12    exec_compatible_with = [
13        "@bazel_tools//platforms:linux",
14        "@bazel_tools//platforms:x86_64",
15    ],
16    target_compatible_with = [
17        "@bazel_tools//platforms:linux",
18        "@bazel_tools//platforms:x86_64",
19    ],
20    toolchain = ":cc-compiler-local",
21    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
22)
23
24cc_toolchain_suite(
25    name = "toolchain",
26    toolchains = {
27        "local|compiler": ":cc-compiler-local",
28        "darwin|compiler": ":cc-compiler-darwin",
29        "x64_windows|msvc-cl": ":cc-compiler-windows",
30        "x64_windows": ":cc-compiler-windows",
31        "arm": ":cc-compiler-local",
32        "aarch64": ":cc-compiler-local",
33        "k8": ":cc-compiler-local",
34        "piii": ":cc-compiler-local",
35        "ppc": ":cc-compiler-local",
36        "darwin": ":cc-compiler-darwin",
37    },
38)
39
40cc_toolchain(
41    name = "cc-compiler-local",
42    all_files = "%{compiler_deps}",
43    compiler_files = "%{compiler_deps}",
44    ar_files = "%{compiler_deps}",
45    as_files = "%{compiler_deps}",
46    dwp_files = ":empty",
47    linker_files = "%{compiler_deps}",
48    objcopy_files = ":empty",
49    strip_files = ":empty",
50    # To support linker flags that need to go to the start of command line
51    # we need the toolchain to support parameter files. Parameter files are
52    # last on the command line and contain all shared libraries to link, so all
53    # regular options will be left of them.
54    supports_param_files = 1,
55    toolchain_identifier = "local_linux",
56    toolchain_config = ":cc-compiler-local-config",
57)
58
59cc_toolchain_config(
60    name = "cc-compiler-local-config",
61    cpu = "local",
62    builtin_include_directories = [%{cxx_builtin_include_directories}],
63    extra_no_canonical_prefixes_flags = [%{extra_no_canonical_prefixes_flags}],
64    host_compiler_path = "%{host_compiler_path}",
65    host_compiler_prefix = "%{host_compiler_prefix}",
66    host_compiler_warnings = [%{host_compiler_warnings}],
67    host_unfiltered_compile_flags = [%{unfiltered_compile_flags}],
68    linker_bin_path = "%{linker_bin_path}",
69    builtin_sysroot = "%{builtin_sysroot}",
70    cuda_path = "%{cuda_toolkit_path}",
71    compiler = "%{compiler}",
72)
73
74cc_toolchain(
75    name = "cc-compiler-darwin",
76    all_files = "%{compiler_deps}",
77    compiler_files = "%{compiler_deps}",
78    ar_files = "%{compiler_deps}",
79    as_files = "%{compiler_deps}",
80    dwp_files = ":empty",
81    linker_files = "%{compiler_deps}",
82    objcopy_files = ":empty",
83    strip_files = ":empty",
84    supports_param_files = 0,
85    toolchain_identifier = "local_darwin",
86    toolchain_config = ":cc-compiler-local-darwin",
87)
88
89cc_toolchain_config(
90    name = "cc-compiler-local-darwin",
91    cpu = "darwin",
92    builtin_include_directories = [%{cxx_builtin_include_directories}],
93    extra_no_canonical_prefixes_flags = [%{extra_no_canonical_prefixes_flags}],
94    host_compiler_path = "%{host_compiler_path}",
95    host_compiler_prefix = "%{host_compiler_prefix}",
96    host_compiler_warnings = [%{host_compiler_warnings}],
97    host_unfiltered_compile_flags = [%{unfiltered_compile_flags}],
98    linker_bin_path = "%{linker_bin_path}",
99)
100
101cc_toolchain(
102    name = "cc-compiler-windows",
103    all_files = "%{win_compiler_deps}",
104    compiler_files = "%{win_compiler_deps}",
105    ar_files = "%{win_compiler_deps}",
106    as_files = "%{win_compiler_deps}",
107    dwp_files = ":empty",
108    linker_files = "%{win_compiler_deps}",
109    objcopy_files = ":empty",
110    strip_files = ":empty",
111    supports_param_files = 1,
112    toolchain_identifier = "local_windows",
113    toolchain_config = ":cc-compiler-windows-config",
114)
115
116cc_toolchain_config(
117    name = "cc-compiler-windows-config",
118    cpu = "x64_windows",
119    builtin_include_directories = [%{cxx_builtin_include_directories}],
120    msvc_cl_path = "%{msvc_cl_path}",
121    msvc_env_include = "%{msvc_env_include}",
122    msvc_env_lib = "%{msvc_env_lib}",
123    msvc_env_path = "%{msvc_env_path}",
124    msvc_env_tmp = "%{msvc_env_tmp}",
125    msvc_lib_path = "%{msvc_lib_path}",
126    msvc_link_path = "%{msvc_link_path}",
127    msvc_ml_path = "%{msvc_ml_path}",
128    compiler = "msvc",
129)
130
131filegroup(
132    name = "empty",
133    srcs = [],
134)
135
136filegroup(
137    name = "crosstool_wrapper_driver_is_not_gcc",
138    srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"],
139)
140
141filegroup(
142    name = "windows_msvc_wrapper_files",
143    srcs = glob(["windows/msvc_*"]),
144)
145