-
Notifications
You must be signed in to change notification settings - Fork 120
/
BUILD.bazel
174 lines (161 loc) · 3.38 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@tensorstore//bazel:utils.bzl", "emit_os_cpu_compiler_group")
package(default_visibility = ["//visibility:public"])
exports_files(glob(["*"]))
# Config settings. Aliases can be imported into a BUILD file via a list
# comprehension like:
#
#[
# alias(
# name = name,
# actual = "@tensorstore//:{target}".format(target = name),
# )
# for name in [
# "arm64_clang",
# "arm64_gcc_or_clang",
# "arm64_gcc",
# "arm64_mingw_gcc",
# "arm64_msvc",
#
# "linux_arm64_clang",
# "linux_arm64_gcc_or_clang",
# "linux_arm64_gcc",
# "linux_clang",
# "linux_gcc_or_clang",
# "linux_gcc",
# "linux_x86_64_clang",
# "linux_x86_64_gcc_or_clang",
# "linux_x86_64_gcc",
#
# "macos_arm64_clang",
# "macos_clang",
# "macos_x86_64_clang",
#
# "windows_arm64_mingw_gcc",
# "windows_arm64_msvc",
# "windows_mingw_gcc",
# "windows_msvc",
# "windows_x86_64_mingw_gcc",
# "windows_x86_64_msvc",
#
# "x86_64_clang",
# "x86_64_gcc_or_clang",
# "x86_64_gcc",
# "x86_64_mingw_gcc",
# "x86_64_msvc",
#
# "compiler_msvc",
# "compiler_clang",
# "compiler_regular_gcc",
# "compiler_mingw_gcc",
# "compiler_unknown",
# "compiler_gcc",
# "compiler_gcc_or_clang",
# ]
#]
#
[
emit_os_cpu_compiler_group(os, cpu, compiler)
for os in [
"macos",
None,
]
for cpu in [
"x86_64",
"arm64",
None,
]
for compiler in [
"clang",
None,
]
]
[
emit_os_cpu_compiler_group(os, cpu, compiler)
for os in [
"linux",
None,
]
for cpu in [
"x86_64",
"arm64",
None,
]
for compiler in [
"clang",
"gcc",
"gcc_or_clang",
None,
]
]
[
emit_os_cpu_compiler_group(os, cpu, compiler)
for os in [
"windows",
None,
]
for cpu in [
"x86_64",
"arm64",
None,
]
for compiler in [
"msvc",
"mingw_gcc",
None,
]
]
# Compiler selection
#
# :compiler_msvc
# :compiler_clang
# :compiler_regular_gcc
# :compiler_mingw_gcc
# :compiler_gcc
config_setting(
name = "compiler_msvc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
},
)
config_setting(
name = "compiler_clang",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "clang",
},
)
config_setting(
name = "compiler_regular_gcc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "gcc",
},
)
config_setting(
name = "compiler_mingw_gcc",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "mingw-gcc",
},
)
config_setting(
name = "compiler_unknown",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "compiler",
},
)
selects.config_setting_group(
name = "compiler_gcc",
match_any = [
":compiler_regular_gcc",
":compiler_mingw_gcc",
# To workaround https://github.com/bazelbuild/bazel/issues/17794, assume
# any unknown compiler is GCC.
":compiler_unknown",
],
)
selects.config_setting_group(
name = "compiler_gcc_or_clang",
match_any = [
":compiler_gcc",
":compiler_clang",
],
)