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