blob: 46ac3759ef1515ce7df49f274141b7d407d6ee6f [file] [log] [blame]
Austin Schuh86110712022-09-16 15:40:54 -07001load("@org_frc971//tools/build_rules:select.bzl", "compiler_select")
2
3cc_library(
4 name = "s3",
5 srcs = glob(["aws-cpp-sdk-s3/source/**/*.cpp"]),
6 hdrs = glob(["aws-cpp-sdk-s3/include/**/*.h"]),
7 includes = ["aws-cpp-sdk-s3/include"],
8 target_compatible_with = ["@platforms//os:linux"],
9 visibility = ["//visibility:public"],
10 deps = [
11 ":aws-c-auth",
12 ":core",
13 ],
14)
15
16genrule(
17 name = "gen_SDKConfig",
18 outs = ["aws-cpp-sdk-core/include/aws/core/SDKConfig.h"],
19 cmd = "echo '#undef USE_AWS_MEMORY_MANAGEMENT' > $@",
20 target_compatible_with = ["@platforms//os:linux"],
21)
22
23cc_library(
24 name = "core",
25 srcs = glob(
26 include = ["aws-cpp-sdk-core/source/**/*.cpp"],
27 exclude = [
28 "aws-cpp-sdk-core/source/utils/crypto/*/*.cpp",
29 "aws-cpp-sdk-core/source/platform/**/*.cpp",
30 "aws-cpp-sdk-core/source/platform/windows/**/*.cpp",
31 # net/*.cpp is for not-(linux or windows), so exclude everything in there.
32 "aws-cpp-sdk-core/source/net/**/*.cpp",
33 "aws-cpp-sdk-core/source/http/windows/**/*.cpp",
34 ],
35 ) + glob([
36 "aws-cpp-sdk-core/source/utils/crypto/openssl/*.cpp",
37 "aws-cpp-sdk-core/source/utils/crypto/factory/*.cpp",
38 "aws-cpp-sdk-core/source/platform/linux-shared/**/*.cpp",
39 "aws-cpp-sdk-core/source/net/linux-shared/*.cpp",
40 ]) + [
41 ":gen_SDKConfig",
42 ],
43 hdrs = glob(
44 include = ["aws-cpp-sdk-core/include/**/*.h"],
45 exclude = [
46 "aws-cpp-sdk-core/include/aws/core/utils/crypto/*/*.h",
47 "aws-cpp-sdk-core/include/aws/core/http/windows/**/*.h",
48 ],
49 ) + glob([
50 "aws-cpp-sdk-core/include/aws/core/utils/crypto/openssl/*.h",
51 ]),
52 copts = [
James Kuszmaulb0931ac2023-01-24 14:23:13 -080053 "-DAWS_SDK_VERSION_MAJOR=10",
54 "-DAWS_SDK_VERSION_MINOR=34",
55 "-DAWS_SDK_VERSION_PATCH=\"\\\"BRT\"\\\"",
Austin Schuh86110712022-09-16 15:40:54 -070056 "-DENABLE_OPENSSL_ENCRYPTION",
57 "-DENABLE_CURL_CLIENT",
58 "-Wno-cast-align",
59 "-Wno-cast-qual",
60 "-Wno-format-nonliteral",
61 ],
62 includes = ["aws-cpp-sdk-core/include"],
63 target_compatible_with = ["@platforms//os:linux"],
64 visibility = ["//visibility:public"],
65 deps = [
66 ":aws-c-auth",
67 ":aws-c-common",
68 ":aws-c-http",
69 ":crt",
70 "@boringssl//:crypto",
71 "@com_github_curl_curl//:curl",
72 ],
73)
74
75genrule(
76 name = "gen_Config",
77 outs = ["crt/aws-crt-cpp/include/aws/crt/Config.h"],
James Kuszmaulb0931ac2023-01-24 14:23:13 -080078 cmd = "echo '#define AWS_CRT_CPP_VERSION \"1.10.34\"' > $@",
Austin Schuh86110712022-09-16 15:40:54 -070079 target_compatible_with = ["@platforms//os:linux"],
80)
81
82cc_library(
83 name = "crt",
84 srcs = glob(["crt/aws-crt-cpp/source/**/*.cpp"]),
85 hdrs = glob(["crt/aws-crt-cpp/include/**/*.h"]) + [
86 ":gen_Config",
87 ],
88 copts = [
89 "-Wno-sign-compare",
90 "-Wno-cast-qual",
James Kuszmaulb0931ac2023-01-24 14:23:13 -080091 "-Wno-tautological-type-limit-compare",
92 "-Wno-missing-field-initializers",
Austin Schuh86110712022-09-16 15:40:54 -070093 ],
94 includes = ["crt/aws-crt-cpp/include"],
95 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulb0931ac2023-01-24 14:23:13 -080096 visibility = ["//visibility:public"],
Austin Schuh86110712022-09-16 15:40:54 -070097 deps = [
98 ":aws-c-auth",
99 ":aws-c-common",
100 ":aws-c-event-stream",
101 ":aws-c-mqtt",
102 ":aws-c-s3",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800103 ":aws-c-sdkutils",
Austin Schuh86110712022-09-16 15:40:54 -0700104 ],
105)
106
107genrule(
108 name = "gen_config",
109 outs = ["crt/aws-crt-cpp/crt/aws-c-common/include/aws/common/config.h"],
110 cmd = "\n".join([
111 "cat >$@ <<END",
112 "#define AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS 1",
113 "#define AWS_HAVE_GCC_INLINE_ASM 1",
114 "#undef AWS_HAVE_MSVC_MULX",
115 "#define AWS_HAVE_EXECINFO 1",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800116 "#define AWS_AFFINITY_METHOD 0",
Austin Schuh86110712022-09-16 15:40:54 -0700117 "END",
118 ]),
119 target_compatible_with = ["@platforms//os:linux"],
120)
121
122cc_library(
123 name = "aws-c-common",
124 srcs = glob([
125 "crt/aws-crt-cpp/crt/aws-c-common/source/*.c",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800126 "crt/aws-crt-cpp/crt/aws-c-common/source/external/*.c",
Austin Schuh86110712022-09-16 15:40:54 -0700127 "crt/aws-crt-cpp/crt/aws-c-common/source/posix/*.c",
128 ]) + [
129 ":gen_config",
130 ] + select({
131 # See the paths in crt/aws-crt-cpp/crt/aws-c-common/CMakeLists.txt for the appropriate globs for each architecture.
132 "@//tools:cpu_k8": glob(
133 include = [
134 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/*.c",
135 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/asm/*.c",
136 ],
137 exclude = [
138 # We don't build with AVX, see crt/aws-crt-cpp/crt/aws-c-common/CMakeLists.txt for details of the macros that need to be set if this is enabled.
139 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/encoding_avx2.c",
140 ],
141 ),
142 "@//tools:cpu_arm64": glob([
143 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c",
144 ]),
145 "@//tools:cpu_armv7": glob([
146 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c",
147 ]),
148 "//conditions:default": [],
149 }),
150 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.h"]),
151 copts = [
152 "-Wno-cast-align",
153 "-Wno-cast-qual",
154 "-Wno-sign-compare",
155 "-Wno-format-nonliteral",
156 ] + compiler_select({
157 "clang": [],
158 "gcc": [
159 "-Wno-old-style-declaration",
160 ],
161 }),
162 includes = ["crt/aws-crt-cpp/crt/aws-c-common/include"],
163 target_compatible_with = ["@platforms//os:linux"],
164 textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.inl"]),
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800165 visibility = ["//visibility:public"],
Austin Schuh86110712022-09-16 15:40:54 -0700166)
167
168# -march=armv8-a+crc
169cc_library(
170 name = "aws-c-event-stream",
171 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/*.c"]) + select({
172 "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/intel/asm/*.c"]),
173 "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]),
174 "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]),
175 "//conditions:default": [],
176 }),
177 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/include/**/*.h"]),
178 copts = [
179 "-Wno-cast-align",
180 "-Wno-cast-qual",
181 ],
182 includes = ["crt/aws-crt-cpp/crt/aws-c-event-stream/include"],
183 deps = [
184 ":aws-c-common",
185 ":aws-c-io",
186 ":aws-checksums",
187 ],
188)
189
190cc_library(
191 name = "aws-checksums",
192 srcs = glob(["crt/aws-crt-cpp/crt/aws-checksums/source/*.c"]) + select({
193 "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/intel/asm/*.c"]),
194 "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]),
195 "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]),
196 "//conditions:default": [],
197 }),
198 hdrs = glob(["crt/aws-crt-cpp/crt/aws-checksums/include/**/*.h"]),
199 copts = [
200 "-Wno-cast-qual",
201 "-Wno-cast-align",
202 "-Wno-implicit-function-declaration",
203 ],
204 includes = ["crt/aws-crt-cpp/crt/aws-checksums/include"],
205 target_compatible_with = ["@platforms//os:linux"],
206 deps = [
207 ":aws-c-common",
208 ],
209)
210
211cc_library(
212 name = "aws-c-cal",
213 srcs = glob([
214 "crt/aws-crt-cpp/crt/aws-c-cal/source/*.c",
215 "crt/aws-crt-cpp/crt/aws-c-cal/source/unix/*.c",
216 ]),
217 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-cal/include/**/*.h"]),
218 copts = [
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800219 "-DOPENSSL_IS_AWSLC",
Austin Schuh86110712022-09-16 15:40:54 -0700220 "-Wno-incompatible-pointer-types",
221 "-Wno-unused-function",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800222 "-Wno-unused-parameter",
Austin Schuh86110712022-09-16 15:40:54 -0700223 "-Wno-cast-align",
224 "-Wno-cast-qual",
225 ],
226 includes = ["crt/aws-crt-cpp/crt/aws-c-cal/include"],
227 target_compatible_with = ["@platforms//os:linux"],
228 deps = [
229 ":aws-c-common",
230 "@boringssl//:crypto",
231 ],
232)
233
234cc_library(
235 name = "aws-c-s3",
236 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/source/**/*.c"]),
237 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/include/**/*.h"]),
238 copts = [
239 "-Wno-cast-align",
240 "-Wno-cast-qual",
241 ],
242 includes = ["crt/aws-crt-cpp/crt/aws-c-s3/include"],
243 target_compatible_with = ["@platforms//os:linux"],
244 deps = [
245 ":aws-c-auth",
246 ":aws-c-common",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800247 ":aws-checksums",
Austin Schuh86110712022-09-16 15:40:54 -0700248 ],
249)
250
251cc_library(
252 name = "aws-c-compression",
253 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/source/*.c"]),
254 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/include/**/*.h"]),
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800255 copts = ["-Wno-cast-qual"],
Austin Schuh86110712022-09-16 15:40:54 -0700256 includes = ["crt/aws-crt-cpp/crt/aws-c-compression/include"],
257 target_compatible_with = ["@platforms//os:linux"],
258 deps = [
259 ":aws-c-common",
260 ],
261)
262
263cc_library(
264 name = "aws-c-http",
265 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-http/source/**/*.c"]),
266 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.h"]),
267 copts = [
268 "-Wno-unused-but-set-variable",
269 "-Wno-cast-align",
270 "-Wno-cast-qual",
271 ],
272 includes = ["crt/aws-crt-cpp/crt/aws-c-http/include"],
273 target_compatible_with = ["@platforms//os:linux"],
274 textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.def"]),
275 deps = [
276 ":aws-c-common",
277 ":aws-c-compression",
278 ":aws-c-io",
279 ],
280)
281
282cc_library(
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800283 name = "aws-c-sdkutils",
284 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-sdkutils/source/**/*.c"]),
285 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-sdkutils/include/**/*.h"]),
286 copts = [
287 "-Wno-cast-align",
288 "-Wno-cast-qual",
289 ],
290 includes = ["crt/aws-crt-cpp/crt/aws-c-sdkutils/include"],
291 target_compatible_with = ["@platforms//os:linux"],
292 deps = [
293 ":aws-c-common",
294 ],
295)
296
297cc_library(
Austin Schuh86110712022-09-16 15:40:54 -0700298 name = "aws-c-auth",
299 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/source/**/*.c"]),
300 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/include/**/*.h"]),
301 copts = [
302 "-Wno-cast-align",
303 "-Wno-cast-qual",
304 ],
305 includes = ["crt/aws-crt-cpp/crt/aws-c-auth/include"],
306 target_compatible_with = ["@platforms//os:linux"],
307 deps = [
308 ":aws-c-common",
309 ":aws-c-http",
310 ":aws-c-io",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800311 ":aws-c-sdkutils",
Austin Schuh86110712022-09-16 15:40:54 -0700312 ],
313)
314
315cc_library(
316 name = "aws-c-mqtt",
317 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/source/**/*.c"]),
318 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/include/**/*.h"]),
319 copts = [
320 "-Wno-cast-qual",
321 "-Wno-cast-align",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800322 "-DAWS_MQTT_WITH_WEBSOCKETS",
Austin Schuh86110712022-09-16 15:40:54 -0700323 ],
324 includes = ["crt/aws-crt-cpp/crt/aws-c-mqtt/include"],
325 target_compatible_with = ["@platforms//os:linux"],
326 deps = [
327 ":aws-c-common",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800328 ":aws-c-http",
Austin Schuh86110712022-09-16 15:40:54 -0700329 ":aws-c-io",
330 ],
331)
332
333cc_library(
334 name = "aws-c-io",
335 srcs = glob([
336 "crt/aws-crt-cpp/crt/aws-c-io/source/*.c",
337 "crt/aws-crt-cpp/crt/aws-c-io/source/linux/*.c",
338 "crt/aws-crt-cpp/crt/aws-c-io/source/s2n/*.c",
339 "crt/aws-crt-cpp/crt/aws-c-io/source/posix/*.c",
340 ]),
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800341 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-io/include/**/*.h"]) + [
342 "crt/aws-crt-cpp/crt/aws-c-io/source/pkcs11_private.h",
343 ] + glob([
344 "crt/aws-crt-cpp/crt/aws-c-io/source/pkcs11/v2.40/*.h",
345 ]),
Austin Schuh86110712022-09-16 15:40:54 -0700346 copts = [
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800347 "-DUSE_S2N",
Austin Schuh86110712022-09-16 15:40:54 -0700348 "-DAWS_USE_EPOLL",
349 "-Wno-cast-align",
350 "-Wno-cast-qual",
351 "-Wno-sign-compare",
352 "-Wno-unused-parameter",
353 ],
354 includes = ["crt/aws-crt-cpp/crt/aws-c-io/include"],
355 target_compatible_with = ["@platforms//os:linux"],
356 deps = [
357 ":aws-c-cal",
358 ":aws-c-common",
359 ":s2n",
360 ],
361)
362
363cc_library(
364 name = "s2n",
365 srcs = glob([
366 "crt/aws-crt-cpp/crt/s2n/**/*.h",
367 "crt/aws-crt-cpp/crt/s2n/tls/**/*.c",
368 "crt/aws-crt-cpp/crt/s2n/error/**/*.c",
369 "crt/aws-crt-cpp/crt/s2n/utils/**/*.c",
370 "crt/aws-crt-cpp/crt/s2n/stuffer/**/*.c",
371 "crt/aws-crt-cpp/crt/s2n/crypto/**/*.c",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800372 "crt/aws-crt-cpp/crt/s2n/pq-crypto/*.c",
Austin Schuh86110712022-09-16 15:40:54 -0700373 ]),
374 hdrs = ["crt/aws-crt-cpp/crt/s2n/api/s2n.h"],
375 copts = [
376 "-Iexternal/aws_sdk/crt/aws-crt-cpp/crt/s2n",
377 "-DS2N_NO_PQ",
378 "-Wno-unknown-pragmas",
379 "-Wno-cast-align",
380 "-Wno-cast-qual",
381 "-Wno-unused-parameter",
382 "-Wno-sign-compare",
383 ],
384 includes = ["crt/aws-crt-cpp/crt/s2n/api"],
385 target_compatible_with = ["@platforms//os:linux"],
386 deps = [
387 "@boringssl//:crypto",
388 ],
389)