Austin Schuh | 8611071 | 2022-09-16 15:40:54 -0700 | [diff] [blame^] | 1 | load("@org_frc971//tools/build_rules:select.bzl", "compiler_select") |
| 2 | |
| 3 | cc_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 | |
| 16 | genrule( |
| 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 | |
| 23 | cc_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 = [ |
| 53 | "-DAWS_SDK_VERSION_MAJOR=19", |
| 54 | "-DAWS_SDK_VERSION_MINOR=0", |
| 55 | "-DAWS_SDK_VERSION_PATCH=\"\\\"0-RC1\"\\\"", |
| 56 | "-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 | |
| 75 | genrule( |
| 76 | name = "gen_Config", |
| 77 | outs = ["crt/aws-crt-cpp/include/aws/crt/Config.h"], |
| 78 | cmd = "echo '#define AWS_CRT_CPP_VERSION \"19.0.0-RC1\"' > $@", |
| 79 | target_compatible_with = ["@platforms//os:linux"], |
| 80 | ) |
| 81 | |
| 82 | cc_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", |
| 91 | ], |
| 92 | includes = ["crt/aws-crt-cpp/include"], |
| 93 | target_compatible_with = ["@platforms//os:linux"], |
| 94 | deps = [ |
| 95 | ":aws-c-auth", |
| 96 | ":aws-c-common", |
| 97 | ":aws-c-event-stream", |
| 98 | ":aws-c-mqtt", |
| 99 | ":aws-c-s3", |
| 100 | ], |
| 101 | ) |
| 102 | |
| 103 | genrule( |
| 104 | name = "gen_config", |
| 105 | outs = ["crt/aws-crt-cpp/crt/aws-c-common/include/aws/common/config.h"], |
| 106 | cmd = "\n".join([ |
| 107 | "cat >$@ <<END", |
| 108 | "#define AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS 1", |
| 109 | "#define AWS_HAVE_GCC_INLINE_ASM 1", |
| 110 | "#undef AWS_HAVE_MSVC_MULX", |
| 111 | "#define AWS_HAVE_EXECINFO 1", |
| 112 | "END", |
| 113 | ]), |
| 114 | target_compatible_with = ["@platforms//os:linux"], |
| 115 | ) |
| 116 | |
| 117 | cc_library( |
| 118 | name = "aws-c-common", |
| 119 | srcs = glob([ |
| 120 | "crt/aws-crt-cpp/crt/aws-c-common/source/*.c", |
| 121 | "crt/aws-crt-cpp/crt/aws-c-common/source/posix/*.c", |
| 122 | ]) + [ |
| 123 | ":gen_config", |
| 124 | ] + select({ |
| 125 | # See the paths in crt/aws-crt-cpp/crt/aws-c-common/CMakeLists.txt for the appropriate globs for each architecture. |
| 126 | "@//tools:cpu_k8": glob( |
| 127 | include = [ |
| 128 | "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/*.c", |
| 129 | "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/asm/*.c", |
| 130 | ], |
| 131 | exclude = [ |
| 132 | # 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. |
| 133 | "crt/aws-crt-cpp/crt/aws-c-common/source/arch/intel/encoding_avx2.c", |
| 134 | ], |
| 135 | ), |
| 136 | "@//tools:cpu_arm64": glob([ |
| 137 | "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c", |
| 138 | ]), |
| 139 | "@//tools:cpu_armv7": glob([ |
| 140 | "crt/aws-crt-cpp/crt/aws-c-common/source/arch/arm/asm/*.c", |
| 141 | ]), |
| 142 | "//conditions:default": [], |
| 143 | }), |
| 144 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.h"]), |
| 145 | copts = [ |
| 146 | "-Wno-cast-align", |
| 147 | "-Wno-cast-qual", |
| 148 | "-Wno-sign-compare", |
| 149 | "-Wno-format-nonliteral", |
| 150 | ] + compiler_select({ |
| 151 | "clang": [], |
| 152 | "gcc": [ |
| 153 | "-Wno-old-style-declaration", |
| 154 | ], |
| 155 | }), |
| 156 | includes = ["crt/aws-crt-cpp/crt/aws-c-common/include"], |
| 157 | target_compatible_with = ["@platforms//os:linux"], |
| 158 | textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-common/include/**/*.inl"]), |
| 159 | ) |
| 160 | |
| 161 | # -march=armv8-a+crc |
| 162 | cc_library( |
| 163 | name = "aws-c-event-stream", |
| 164 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/*.c"]) + select({ |
| 165 | "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/intel/asm/*.c"]), |
| 166 | "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]), |
| 167 | "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/source/arm/*.c"]), |
| 168 | "//conditions:default": [], |
| 169 | }), |
| 170 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-event-stream/include/**/*.h"]), |
| 171 | copts = [ |
| 172 | "-Wno-cast-align", |
| 173 | "-Wno-cast-qual", |
| 174 | ], |
| 175 | includes = ["crt/aws-crt-cpp/crt/aws-c-event-stream/include"], |
| 176 | deps = [ |
| 177 | ":aws-c-common", |
| 178 | ":aws-c-io", |
| 179 | ":aws-checksums", |
| 180 | ], |
| 181 | ) |
| 182 | |
| 183 | cc_library( |
| 184 | name = "aws-checksums", |
| 185 | srcs = glob(["crt/aws-crt-cpp/crt/aws-checksums/source/*.c"]) + select({ |
| 186 | "@//tools:cpu_k8": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/intel/asm/*.c"]), |
| 187 | "@//tools:cpu_arm64": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]), |
| 188 | "@//tools:cpu_armv7": glob(["crt/aws-crt-cpp/crt/aws-checksums/source/arm/*.c"]), |
| 189 | "//conditions:default": [], |
| 190 | }), |
| 191 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-checksums/include/**/*.h"]), |
| 192 | copts = [ |
| 193 | "-Wno-cast-qual", |
| 194 | "-Wno-cast-align", |
| 195 | "-Wno-implicit-function-declaration", |
| 196 | ], |
| 197 | includes = ["crt/aws-crt-cpp/crt/aws-checksums/include"], |
| 198 | target_compatible_with = ["@platforms//os:linux"], |
| 199 | deps = [ |
| 200 | ":aws-c-common", |
| 201 | ], |
| 202 | ) |
| 203 | |
| 204 | cc_library( |
| 205 | name = "aws-c-cal", |
| 206 | srcs = glob([ |
| 207 | "crt/aws-crt-cpp/crt/aws-c-cal/source/*.c", |
| 208 | "crt/aws-crt-cpp/crt/aws-c-cal/source/unix/*.c", |
| 209 | ]), |
| 210 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-cal/include/**/*.h"]), |
| 211 | copts = [ |
| 212 | "-Wno-incompatible-pointer-types", |
| 213 | "-Wno-unused-function", |
| 214 | "-Wno-cast-align", |
| 215 | "-Wno-cast-qual", |
| 216 | ], |
| 217 | includes = ["crt/aws-crt-cpp/crt/aws-c-cal/include"], |
| 218 | target_compatible_with = ["@platforms//os:linux"], |
| 219 | deps = [ |
| 220 | ":aws-c-common", |
| 221 | "@boringssl//:crypto", |
| 222 | ], |
| 223 | ) |
| 224 | |
| 225 | cc_library( |
| 226 | name = "aws-c-s3", |
| 227 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/source/**/*.c"]), |
| 228 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-s3/include/**/*.h"]), |
| 229 | copts = [ |
| 230 | "-Wno-cast-align", |
| 231 | "-Wno-cast-qual", |
| 232 | ], |
| 233 | includes = ["crt/aws-crt-cpp/crt/aws-c-s3/include"], |
| 234 | target_compatible_with = ["@platforms//os:linux"], |
| 235 | deps = [ |
| 236 | ":aws-c-auth", |
| 237 | ":aws-c-common", |
| 238 | ], |
| 239 | ) |
| 240 | |
| 241 | cc_library( |
| 242 | name = "aws-c-compression", |
| 243 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/source/*.c"]), |
| 244 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-compression/include/**/*.h"]), |
| 245 | includes = ["crt/aws-crt-cpp/crt/aws-c-compression/include"], |
| 246 | target_compatible_with = ["@platforms//os:linux"], |
| 247 | deps = [ |
| 248 | ":aws-c-common", |
| 249 | ], |
| 250 | ) |
| 251 | |
| 252 | cc_library( |
| 253 | name = "aws-c-http", |
| 254 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-http/source/**/*.c"]), |
| 255 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.h"]), |
| 256 | copts = [ |
| 257 | "-Wno-unused-but-set-variable", |
| 258 | "-Wno-cast-align", |
| 259 | "-Wno-cast-qual", |
| 260 | ], |
| 261 | includes = ["crt/aws-crt-cpp/crt/aws-c-http/include"], |
| 262 | target_compatible_with = ["@platforms//os:linux"], |
| 263 | textual_hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-http/include/**/*.def"]), |
| 264 | deps = [ |
| 265 | ":aws-c-common", |
| 266 | ":aws-c-compression", |
| 267 | ":aws-c-io", |
| 268 | ], |
| 269 | ) |
| 270 | |
| 271 | cc_library( |
| 272 | name = "aws-c-auth", |
| 273 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/source/**/*.c"]), |
| 274 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-auth/include/**/*.h"]), |
| 275 | copts = [ |
| 276 | "-Wno-cast-align", |
| 277 | "-Wno-cast-qual", |
| 278 | ], |
| 279 | includes = ["crt/aws-crt-cpp/crt/aws-c-auth/include"], |
| 280 | target_compatible_with = ["@platforms//os:linux"], |
| 281 | deps = [ |
| 282 | ":aws-c-common", |
| 283 | ":aws-c-http", |
| 284 | ":aws-c-io", |
| 285 | ], |
| 286 | ) |
| 287 | |
| 288 | cc_library( |
| 289 | name = "aws-c-mqtt", |
| 290 | srcs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/source/**/*.c"]), |
| 291 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-mqtt/include/**/*.h"]), |
| 292 | copts = [ |
| 293 | "-Wno-cast-qual", |
| 294 | "-Wno-cast-align", |
| 295 | ], |
| 296 | includes = ["crt/aws-crt-cpp/crt/aws-c-mqtt/include"], |
| 297 | target_compatible_with = ["@platforms//os:linux"], |
| 298 | deps = [ |
| 299 | ":aws-c-common", |
| 300 | ":aws-c-io", |
| 301 | ], |
| 302 | ) |
| 303 | |
| 304 | cc_library( |
| 305 | name = "aws-c-io", |
| 306 | srcs = glob([ |
| 307 | "crt/aws-crt-cpp/crt/aws-c-io/source/*.c", |
| 308 | "crt/aws-crt-cpp/crt/aws-c-io/source/linux/*.c", |
| 309 | "crt/aws-crt-cpp/crt/aws-c-io/source/s2n/*.c", |
| 310 | "crt/aws-crt-cpp/crt/aws-c-io/source/posix/*.c", |
| 311 | ]), |
| 312 | hdrs = glob(["crt/aws-crt-cpp/crt/aws-c-io/include/**/*.h"]), |
| 313 | copts = [ |
| 314 | "-DAWS_USE_EPOLL", |
| 315 | "-Wno-cast-align", |
| 316 | "-Wno-cast-qual", |
| 317 | "-Wno-sign-compare", |
| 318 | "-Wno-unused-parameter", |
| 319 | ], |
| 320 | includes = ["crt/aws-crt-cpp/crt/aws-c-io/include"], |
| 321 | target_compatible_with = ["@platforms//os:linux"], |
| 322 | deps = [ |
| 323 | ":aws-c-cal", |
| 324 | ":aws-c-common", |
| 325 | ":s2n", |
| 326 | ], |
| 327 | ) |
| 328 | |
| 329 | cc_library( |
| 330 | name = "s2n", |
| 331 | srcs = glob([ |
| 332 | "crt/aws-crt-cpp/crt/s2n/**/*.h", |
| 333 | "crt/aws-crt-cpp/crt/s2n/tls/**/*.c", |
| 334 | "crt/aws-crt-cpp/crt/s2n/error/**/*.c", |
| 335 | "crt/aws-crt-cpp/crt/s2n/utils/**/*.c", |
| 336 | "crt/aws-crt-cpp/crt/s2n/stuffer/**/*.c", |
| 337 | "crt/aws-crt-cpp/crt/s2n/crypto/**/*.c", |
| 338 | ]), |
| 339 | hdrs = ["crt/aws-crt-cpp/crt/s2n/api/s2n.h"], |
| 340 | copts = [ |
| 341 | "-Iexternal/aws_sdk/crt/aws-crt-cpp/crt/s2n", |
| 342 | "-DS2N_NO_PQ", |
| 343 | "-Wno-unknown-pragmas", |
| 344 | "-Wno-cast-align", |
| 345 | "-Wno-cast-qual", |
| 346 | "-Wno-unused-parameter", |
| 347 | "-Wno-sign-compare", |
| 348 | ], |
| 349 | includes = ["crt/aws-crt-cpp/crt/s2n/api"], |
| 350 | target_compatible_with = ["@platforms//os:linux"], |
| 351 | deps = [ |
| 352 | "@boringssl//:crypto", |
| 353 | ], |
| 354 | ) |