• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
2load(":cc_toolchain_config.bzl", "cc_toolchain_config")
3
4package(default_visibility = ["//visibility:public"])
5
6filegroup(name = "empty")
7
8bool_flag(
9    name = "release",
10    build_setting_default = False,
11)
12
13TOOLCHAINS = {
14    "osx-x86_64": "cc-compiler-osx-x86_64",
15    "osx-aarch_64": "cc-compiler-osx-aarch_64",
16    "linux-aarch_64": "cc-compiler-linux-aarch_64",
17    "linux-ppcle_64": "cc-compiler-linux-ppcle_64",
18    "linux-s390_64": "cc-compiler-linux-s390_64",
19    "linux-x86_32": "cc-compiler-linux-x86_32",
20    "linux-x86_64": "cc-compiler-linux-x86_64",
21    "win32": "cc-compiler-windows-x86_32",
22    "win64": "cc-compiler-windows-x86_64",
23    "k8": "cc-compiler-k8",
24}
25
26cc_toolchain_suite(
27    name = "clang_suite",
28    toolchains = TOOLCHAINS,
29)
30
31[
32    cc_toolchain(
33        name = toolchain,
34        all_files = ":empty",
35        compiler_files = ":empty",
36        dwp_files = ":empty",
37        dynamic_runtime_lib = ":empty",
38        linker_files = ":empty",
39        objcopy_files = ":empty",
40        output_licenses = ["restricted"],
41        static_runtime_lib = ":empty",
42        strip_files = ":empty",
43        toolchain_config = ":" + cpu + "-config",
44        toolchain_identifier = toolchain,
45    )
46    for cpu, toolchain in TOOLCHAINS.items()
47]
48
49cc_toolchain_config(
50    name = "k8-config",
51    linker_path = "/usr/bin/ld",
52    sysroot = "/opt/manylinux/2014/x86_64",
53    target_cpu = "x86_64",
54    target_full_name = "x86_64-linux-gnu",
55)
56
57cc_toolchain_config(
58    name = "linux-aarch_64-config",
59    linker_path = "/usr/bin/ld",
60    sysroot = "/opt/manylinux/2014/aarch64",
61    target_cpu = "aarch64",
62    target_full_name = "aarch64-linux-gnu",
63)
64
65cc_toolchain_config(
66    name = "linux-ppcle_64-config",
67    linker_path = "/usr/bin/ld",
68    sysroot = "/opt/manylinux/2014/ppc64le",
69    target_cpu = "ppc64",
70    target_full_name = "powerpc64le-linux-gnu",
71)
72
73cc_toolchain_config(
74    name = "linux-s390_64-config",
75    linker_path = "/usr/bin/ld",
76    sysroot = "/opt/manylinux/2014/s390x",
77    target_cpu = "systemz",
78    target_full_name = "s390x-linux-gnu",
79)
80
81cc_toolchain_config(
82    name = "linux-x86_32-config",
83    linker_path = "/usr/bin/ld",
84    sysroot = "/opt/manylinux/2014/i686",
85    target_cpu = "x86_32",
86    target_full_name = "i386-linux-gnu",
87)
88
89cc_toolchain_config(
90    name = "linux-x86_64-config",
91    linker_path = "/usr/bin/ld",
92    sysroot = "/opt/manylinux/2014/x86_64",
93    target_cpu = "x86_64",
94    target_full_name = "x86_64-linux-gnu",
95)
96
97cc_toolchain_config(
98    name = "osx-aarch_64-config",
99    extra_compiler_flags = [
100        "-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1",
101        "-I/usr/tools/xcode_14_0/macosx/usr/include",
102        "-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks",
103        "-Wno-error=nullability-completeness",
104        "-Wno-error=availability",
105        "-Wno-error=elaborated-enum-base",
106    ],
107    extra_linker_flags = ["-framework CoreFoundation"],
108    linker_path = "/usr/tools",
109    sysroot = "/usr/tools/xcode_14_0/macosx",
110    target_cpu = "aarch64",
111    target_full_name = "aarch64-apple-macosx10.15",
112)
113
114cc_toolchain_config(
115    name = "osx-x86_64-config",
116    extra_compiler_flags = [
117        "-I/usr/tools/xcode_14_0/macosx/usr/include/c++/v1",
118        "-I/usr/tools/xcode_14_0/macosx/usr/include",
119        "-F/usr/tools/xcode_14_0/macosx/System/Library/Frameworks",
120        "-Wno-error=nullability-completeness",
121        "-Wno-error=availability",
122        "-Wno-error=elaborated-enum-base",
123    ],
124    extra_linker_flags = ["-framework CoreFoundation"],
125    linker_path = "/usr/tools",
126    sysroot = "/usr/tools/xcode_14_0/macosx",
127    target_cpu = "x86_64",
128    target_full_name = "x86_64-apple-macosx10.15",
129)
130
131cc_toolchain_config(
132    name = "win32-config",
133    extra_compiler_flags = [
134        "-isystem/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++",
135        "-isystem/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++/i686-w64-mingw32",
136    ],
137    extra_include = "/usr/lib/gcc/i686-w64-mingw32",
138    extra_linker_flags = [
139        "-L/usr/lib/gcc/i686-w64-mingw32/10-posix",
140        "-ldbghelp",
141        "-pthread",
142    ],
143    linker_path = "/usr/bin/ld",
144    sysroot = "/usr/i686-w64-mingw32",
145    target_cpu = "x86_32",
146    target_full_name = "i686-w64-mingw32",
147)
148
149cc_toolchain_config(
150    name = "win64-config",
151    extra_compiler_flags = [
152        "-isystem/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/",
153        "-isystem/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include/c++/x86_64-w64-mingw32",
154    ],
155    extra_include = "/usr/lib/gcc/x86_64-w64-mingw32/10-posix/include",
156    extra_linker_flags = [
157        "-L/usr/lib/gcc/x86_64-w64-mingw32/10-posix",
158        "-ldbghelp",
159    ],
160    linker_path = "/usr/bin/ld",
161    sysroot = "/usr/x86_64-w64-mingw32",
162    target_cpu = "x86_64",
163    target_full_name = "x86_64-w64-mingw32",
164)
165