blob: b5b261928f7ba3551c1b60bb48d39b3d3569d61b [file] [log] [blame]
Austin Schuh86110712022-09-16 15:40:54 -07001load("@org_frc971//tools/build_rules:select.bzl", "compiler_select")
2
Austin Schuh8f99c822024-05-05 22:43:40 -07003common_copts = [
4 "-DPLATFORM_LINUX",
5 "-DINTEL_NO_ITTNOTIFY_API",
6 "-Wno-cast-align",
7 "-Wno-cast-qual",
8]
9
Austin Schuh86110712022-09-16 15:40:54 -070010cc_library(
11 name = "s3",
Austin Schuh8f99c822024-05-05 22:43:40 -070012 srcs = glob(["generated/src/aws-cpp-sdk-s3/source/**/*.cpp"]),
13 hdrs = glob(["generated/src/aws-cpp-sdk-s3/include/**/*.h"]),
14 copts = common_copts,
15 includes = ["generated/src/aws-cpp-sdk-s3/include"],
Austin Schuh86110712022-09-16 15:40:54 -070016 target_compatible_with = ["@platforms//os:linux"],
17 visibility = ["//visibility:public"],
18 deps = [
19 ":aws-c-auth",
20 ":core",
21 ],
22)
23
24genrule(
25 name = "gen_SDKConfig",
Austin Schuh8f99c822024-05-05 22:43:40 -070026 outs = ["src/aws-cpp-sdk-core/include/aws/core/SDKConfig.h"],
Austin Schuh86110712022-09-16 15:40:54 -070027 cmd = "echo '#undef USE_AWS_MEMORY_MANAGEMENT' > $@",
28 target_compatible_with = ["@platforms//os:linux"],
29)
30
31cc_library(
32 name = "core",
33 srcs = glob(
Austin Schuh8f99c822024-05-05 22:43:40 -070034 include = ["src/aws-cpp-sdk-core/source/**/*.cpp"],
Austin Schuh86110712022-09-16 15:40:54 -070035 exclude = [
Austin Schuh8f99c822024-05-05 22:43:40 -070036 "src/aws-cpp-sdk-core/source/utils/crypto/*/*.cpp",
37 "src/aws-cpp-sdk-core/source/platform/**/*.cpp",
38 "src/aws-cpp-sdk-core/source/platform/windows/**/*.cpp",
Austin Schuh86110712022-09-16 15:40:54 -070039 # net/*.cpp is for not-(linux or windows), so exclude everything in there.
Austin Schuh8f99c822024-05-05 22:43:40 -070040 "src/aws-cpp-sdk-core/source/net/**/*.cpp",
41 "src/aws-cpp-sdk-core/source/http/windows/**/*.cpp",
Austin Schuh86110712022-09-16 15:40:54 -070042 ],
43 ) + glob([
Austin Schuh8f99c822024-05-05 22:43:40 -070044 "src/aws-cpp-sdk-core/source/utils/crypto/openssl/*.cpp",
45 "src/aws-cpp-sdk-core/source/utils/crypto/factory/*.cpp",
46 "src/aws-cpp-sdk-core/source/platform/linux-shared/**/*.cpp",
47 "src/aws-cpp-sdk-core/source/net/linux-shared/*.cpp",
Austin Schuh86110712022-09-16 15:40:54 -070048 ]) + [
49 ":gen_SDKConfig",
50 ],
51 hdrs = glob(
Austin Schuh8f99c822024-05-05 22:43:40 -070052 include = ["src/aws-cpp-sdk-core/include/**/*.h"],
Austin Schuh86110712022-09-16 15:40:54 -070053 exclude = [
Austin Schuh8f99c822024-05-05 22:43:40 -070054 "src/aws-cpp-sdk-core/include/aws/core/utils/crypto/*/*.h",
55 "src/aws-cpp-sdk-core/include/aws/core/http/windows/**/*.h",
Austin Schuh86110712022-09-16 15:40:54 -070056 ],
57 ) + glob([
Austin Schuh8f99c822024-05-05 22:43:40 -070058 "src/aws-cpp-sdk-core/include/aws/core/utils/crypto/openssl/*.h",
Austin Schuh86110712022-09-16 15:40:54 -070059 ]),
Austin Schuh8f99c822024-05-05 22:43:40 -070060 copts = common_copts + [
James Kuszmaulb0931ac2023-01-24 14:23:13 -080061 "-DAWS_SDK_VERSION_MAJOR=10",
62 "-DAWS_SDK_VERSION_MINOR=34",
63 "-DAWS_SDK_VERSION_PATCH=\"\\\"BRT\"\\\"",
Austin Schuh86110712022-09-16 15:40:54 -070064 "-DENABLE_OPENSSL_ENCRYPTION",
65 "-DENABLE_CURL_CLIENT",
Austin Schuh86110712022-09-16 15:40:54 -070066 "-Wno-format-nonliteral",
67 ],
Austin Schuh8f99c822024-05-05 22:43:40 -070068 includes = ["src/aws-cpp-sdk-core/include"],
Austin Schuh86110712022-09-16 15:40:54 -070069 target_compatible_with = ["@platforms//os:linux"],
70 visibility = ["//visibility:public"],
71 deps = [
72 ":aws-c-auth",
73 ":aws-c-common",
74 ":aws-c-http",
75 ":crt",
76 "@boringssl//:crypto",
77 "@com_github_curl_curl//:curl",
Austin Schuh8f99c822024-05-05 22:43:40 -070078 "@io_opentelemetry_cpp//api",
79 "@io_opentelemetry_cpp//exporters/ostream:ostream_metric_exporter",
80 "@io_opentelemetry_cpp//exporters/ostream:ostream_span_exporter",
81 "@io_opentelemetry_cpp//sdk:headers",
Austin Schuh86110712022-09-16 15:40:54 -070082 ],
83)
84
85genrule(
86 name = "gen_Config",
87 outs = ["crt/aws-crt-cpp/include/aws/crt/Config.h"],
Austin Schuh8f99c822024-05-05 22:43:40 -070088 cmd = "; ".join([
89 "echo '#define AWS_CRT_CPP_VERSION \"1.11.321\"' > $@",
90 "echo '#define AWS_CRT_CPP_VERSION_MAJOR 1' >> $@",
91 "echo '#define AWS_CRT_CPP_VERSION_MINOR 11' >> $@",
92 "echo '#define AWS_CRT_CPP_VERSION_PATCH 321' >> $@",
93 ]),
Austin Schuh86110712022-09-16 15:40:54 -070094 target_compatible_with = ["@platforms//os:linux"],
95)
96
97cc_library(
98 name = "crt",
99 srcs = glob(["crt/aws-crt-cpp/source/**/*.cpp"]),
100 hdrs = glob(["crt/aws-crt-cpp/include/**/*.h"]) + [
101 ":gen_Config",
102 ],
Austin Schuh8f99c822024-05-05 22:43:40 -0700103 copts = common_copts + [
Austin Schuh86110712022-09-16 15:40:54 -0700104 "-Wno-sign-compare",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800105 "-Wno-tautological-type-limit-compare",
106 "-Wno-missing-field-initializers",
Austin Schuh86110712022-09-16 15:40:54 -0700107 ],
108 includes = ["crt/aws-crt-cpp/include"],
109 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800110 visibility = ["//visibility:public"],
Austin Schuh86110712022-09-16 15:40:54 -0700111 deps = [
112 ":aws-c-auth",
113 ":aws-c-common",
114 ":aws-c-event-stream",
115 ":aws-c-mqtt",
116 ":aws-c-s3",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800117 ":aws-c-sdkutils",
Austin Schuh86110712022-09-16 15:40:54 -0700118 ],
119)
120
121genrule(
122 name = "gen_config",
123 outs = ["crt/aws-crt-cpp/crt/aws-c-common/include/aws/common/config.h"],
124 cmd = "\n".join([
125 "cat >$@ <<END",
126 "#define AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS 1",
127 "#define AWS_HAVE_GCC_INLINE_ASM 1",
128 "#undef AWS_HAVE_MSVC_MULX",
129 "#define AWS_HAVE_EXECINFO 1",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800130 "#define AWS_AFFINITY_METHOD 0",
Austin Schuh86110712022-09-16 15:40:54 -0700131 "END",
132 ]),
133 target_compatible_with = ["@platforms//os:linux"],
134)
135
136cc_library(
137 name = "aws-c-common",
138 srcs = glob([
139 "crt/aws-crt-cpp/crt/aws-c-common/source/*.c",
Austin Schuh8f99c822024-05-05 22:43:40 -0700140 "crt/aws-crt-cpp/crt/aws-c-common/source/linux/*.c",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800141 "crt/aws-crt-cpp/crt/aws-c-common/source/external/*.c",
Austin Schuh86110712022-09-16 15:40:54 -0700142 "crt/aws-crt-cpp/crt/aws-c-common/source/posix/*.c",
143 ]) + [
144 ":gen_config",
145 ] + select({
146 # See the paths in crt/aws-crt-cpp/crt/aws-c-common/CMakeLists.txt for the appropriate globs for each architecture.
147 "@//tools:cpu_k8": glob(
148 include = [
149 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/*.c",
150 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/asm/*.c",
151 ],
152 exclude = [
153 # 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.
154 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/encoding_avx2.c",
155 ],
156 ),
157 "@//tools:cpu_arm64": glob([
158 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c",
159 ]),
160 "@//tools:cpu_armv7": glob([
161 "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c",
162 ]),
163 "//conditions:default": [],
164 }),
Austin Schuh8f99c822024-05-05 22:43:40 -0700165 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.h"]) + ["crt/aws-crt-cpp/crt/aws-c-common/source/external/cJSON.h"],
166 copts = common_copts + [
Austin Schuh86110712022-09-16 15:40:54 -0700167 "-Wno-sign-compare",
168 "-Wno-format-nonliteral",
169 ] + compiler_select({
170 "clang": [],
171 "gcc": [
172 "-Wno-old-style-declaration",
173 ],
174 }),
Austin Schuh8f99c822024-05-05 22:43:40 -0700175 includes = [
176 "crt/aws-crt-cpp/crt/aws-c-common/include",
177 "crt/aws-crt-cpp/crt/aws-c-common/source",
178 ],
Austin Schuh86110712022-09-16 15:40:54 -0700179 target_compatible_with = ["@platforms//os:linux"],
180 textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.inl"]),
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800181 visibility = ["//visibility:public"],
Austin Schuh86110712022-09-16 15:40:54 -0700182)
183
184# -march=armv8-a+crc
185cc_library(
186 name = "aws-c-event-stream",
187 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/*.c"]) + select({
188 "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/intel/asm/*.c"]),
189 "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]),
190 "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]),
191 "//conditions:default": [],
192 }),
193 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700194 copts = common_copts,
Austin Schuh86110712022-09-16 15:40:54 -0700195 includes = ["crt/aws-crt-cpp/crt/aws-c-event-stream/include"],
196 deps = [
197 ":aws-c-common",
198 ":aws-c-io",
199 ":aws-checksums",
200 ],
201)
202
203cc_library(
204 name = "aws-checksums",
205 srcs = glob(["crt/aws-crt-cpp/crt/aws-checksums/source/*.c"]) + select({
206 "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/intel/asm/*.c"]),
207 "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]),
208 "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]),
209 "//conditions:default": [],
210 }),
211 hdrs = glob(["crt/aws-crt-cpp/crt/aws-checksums/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700212 copts = common_copts + [
Austin Schuh86110712022-09-16 15:40:54 -0700213 "-Wno-implicit-function-declaration",
214 ],
215 includes = ["crt/aws-crt-cpp/crt/aws-checksums/include"],
216 target_compatible_with = ["@platforms//os:linux"],
217 deps = [
218 ":aws-c-common",
219 ],
220)
221
222cc_library(
223 name = "aws-c-cal",
224 srcs = glob([
225 "crt/aws-crt-cpp/crt/aws-c-cal/source/*.c",
226 "crt/aws-crt-cpp/crt/aws-c-cal/source/unix/*.c",
227 ]),
228 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-cal/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700229 copts = common_copts + [
230 #"-DOPENSSL_IS_AWSLC",
Austin Schuh86110712022-09-16 15:40:54 -0700231 "-Wno-incompatible-pointer-types",
232 "-Wno-unused-function",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800233 "-Wno-unused-parameter",
Austin Schuh86110712022-09-16 15:40:54 -0700234 ],
235 includes = ["crt/aws-crt-cpp/crt/aws-c-cal/include"],
236 target_compatible_with = ["@platforms//os:linux"],
237 deps = [
238 ":aws-c-common",
239 "@boringssl//:crypto",
240 ],
241)
242
243cc_library(
244 name = "aws-c-s3",
245 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/source/**/*.c"]),
246 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700247 copts = common_copts,
Austin Schuh86110712022-09-16 15:40:54 -0700248 includes = ["crt/aws-crt-cpp/crt/aws-c-s3/include"],
249 target_compatible_with = ["@platforms//os:linux"],
250 deps = [
251 ":aws-c-auth",
252 ":aws-c-common",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800253 ":aws-checksums",
Austin Schuh86110712022-09-16 15:40:54 -0700254 ],
255)
256
257cc_library(
258 name = "aws-c-compression",
259 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/source/*.c"]),
260 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700261 copts = common_copts,
Austin Schuh86110712022-09-16 15:40:54 -0700262 includes = ["crt/aws-crt-cpp/crt/aws-c-compression/include"],
263 target_compatible_with = ["@platforms//os:linux"],
264 deps = [
265 ":aws-c-common",
266 ],
267)
268
269cc_library(
270 name = "aws-c-http",
271 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-http/source/**/*.c"]),
272 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700273 copts = common_copts + [
Austin Schuh86110712022-09-16 15:40:54 -0700274 "-Wno-unused-but-set-variable",
Austin Schuh86110712022-09-16 15:40:54 -0700275 ],
276 includes = ["crt/aws-crt-cpp/crt/aws-c-http/include"],
277 target_compatible_with = ["@platforms//os:linux"],
278 textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.def"]),
279 deps = [
280 ":aws-c-common",
281 ":aws-c-compression",
282 ":aws-c-io",
283 ],
284)
285
286cc_library(
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800287 name = "aws-c-sdkutils",
288 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-sdkutils/source/**/*.c"]),
289 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-sdkutils/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700290 copts = common_copts,
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800291 includes = ["crt/aws-crt-cpp/crt/aws-c-sdkutils/include"],
292 target_compatible_with = ["@platforms//os:linux"],
293 deps = [
294 ":aws-c-common",
295 ],
296)
297
298cc_library(
Austin Schuh86110712022-09-16 15:40:54 -0700299 name = "aws-c-auth",
300 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/source/**/*.c"]),
301 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700302 copts = common_copts,
Austin Schuh86110712022-09-16 15:40:54 -0700303 includes = ["crt/aws-crt-cpp/crt/aws-c-auth/include"],
304 target_compatible_with = ["@platforms//os:linux"],
305 deps = [
306 ":aws-c-common",
307 ":aws-c-http",
308 ":aws-c-io",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800309 ":aws-c-sdkutils",
Austin Schuh86110712022-09-16 15:40:54 -0700310 ],
311)
312
313cc_library(
314 name = "aws-c-mqtt",
315 srcs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/source/**/*.c"]),
316 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/include/**/*.h"]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700317 copts = common_copts + [
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800318 "-DAWS_MQTT_WITH_WEBSOCKETS",
Austin Schuh86110712022-09-16 15:40:54 -0700319 ],
320 includes = ["crt/aws-crt-cpp/crt/aws-c-mqtt/include"],
321 target_compatible_with = ["@platforms//os:linux"],
322 deps = [
323 ":aws-c-common",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800324 ":aws-c-http",
Austin Schuh86110712022-09-16 15:40:54 -0700325 ":aws-c-io",
326 ],
327)
328
329cc_library(
330 name = "aws-c-io",
331 srcs = glob([
332 "crt/aws-crt-cpp/crt/aws-c-io/source/*.c",
333 "crt/aws-crt-cpp/crt/aws-c-io/source/linux/*.c",
334 "crt/aws-crt-cpp/crt/aws-c-io/source/s2n/*.c",
335 "crt/aws-crt-cpp/crt/aws-c-io/source/posix/*.c",
336 ]),
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800337 hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-io/include/**/*.h"]) + [
338 "crt/aws-crt-cpp/crt/aws-c-io/source/pkcs11_private.h",
339 ] + glob([
340 "crt/aws-crt-cpp/crt/aws-c-io/source/pkcs11/v2.40/*.h",
341 ]),
Austin Schuh8f99c822024-05-05 22:43:40 -0700342 copts = common_copts + [
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800343 "-DUSE_S2N",
Austin Schuh86110712022-09-16 15:40:54 -0700344 "-DAWS_USE_EPOLL",
Austin Schuh86110712022-09-16 15:40:54 -0700345 "-Wno-sign-compare",
346 "-Wno-unused-parameter",
347 ],
348 includes = ["crt/aws-crt-cpp/crt/aws-c-io/include"],
349 target_compatible_with = ["@platforms//os:linux"],
350 deps = [
351 ":aws-c-cal",
352 ":aws-c-common",
353 ":s2n",
354 ],
355)
356
357cc_library(
358 name = "s2n",
359 srcs = glob([
360 "crt/aws-crt-cpp/crt/s2n/**/*.h",
361 "crt/aws-crt-cpp/crt/s2n/tls/**/*.c",
362 "crt/aws-crt-cpp/crt/s2n/error/**/*.c",
363 "crt/aws-crt-cpp/crt/s2n/utils/**/*.c",
364 "crt/aws-crt-cpp/crt/s2n/stuffer/**/*.c",
365 "crt/aws-crt-cpp/crt/s2n/crypto/**/*.c",
James Kuszmaulb0931ac2023-01-24 14:23:13 -0800366 "crt/aws-crt-cpp/crt/s2n/pq-crypto/*.c",
Austin Schuh86110712022-09-16 15:40:54 -0700367 ]),
368 hdrs = ["crt/aws-crt-cpp/crt/s2n/api/s2n.h"],
Austin Schuh8f99c822024-05-05 22:43:40 -0700369 copts = common_copts + [
Austin Schuh86110712022-09-16 15:40:54 -0700370 "-Iexternal/aws_sdk/crt/aws-crt-cpp/crt/s2n",
371 "-DS2N_NO_PQ",
372 "-Wno-unknown-pragmas",
Austin Schuh86110712022-09-16 15:40:54 -0700373 "-Wno-unused-parameter",
374 "-Wno-sign-compare",
375 ],
376 includes = ["crt/aws-crt-cpp/crt/s2n/api"],
377 target_compatible_with = ["@platforms//os:linux"],
378 deps = [
379 "@boringssl//:crypto",
380 ],
381)