11# Description:
22# AWS C Common
33
4+ load("@bazel_skylib//rules:write_file.bzl", "write_file")
5+
46package(default_visibility = ["//visibility:public"])
57
68licenses(["notice"]) # Apache 2.0
79
810exports_files(["LICENSE"])
911
12+ write_file(
13+ name = "write_config_h",
14+ out = "include/aws/common/config.h",
15+ newline = "auto",
16+
17+ content = [
18+ "#ifndef AWS_COMMON_CONFIG_H",
19+ "#define AWS_COMMON_CONFIG_H",
20+ "",
21+ "#define AWS_HAVE_GCC_OVERFLOW_MATH_EXTENSIONS",
22+ "#define AWS_HAVE_GCC_INLINE_ASM",
23+ "#define AWS_HAVE_POSIX_LARGE_FILE_SUPPORT",
24+ ] + select({
25+ "@platforms//os:linux": [
26+ "#define AWS_HAVE_EXECINFO",
27+ "#define AWS_HAVE_LINUX_IF_LINK_H",
28+ ],
29+ "@platforms//os:windows": [
30+ "#define AWS_HAVE_WINAPI_DESKTOP",
31+ ],
32+ }) + [
33+ "#undef AWS_HAVE_WINAPI_DESKTOP",
34+ # TODO: improve with logic from AwsSIMD.cmake
35+ # but this strictly requires configure style tests...
36+ "#undef AWS_USE_CPU_EXTENSIONS",
37+ "#undef AWS_HAVE_MSVC_INTRINSICS_X64",
38+ "#undef AWS_HAVE_AVX2_INTRINSICS",
39+ "#undef AWS_HAVE_AVX512_INTRINSICS",
40+ "#undef AWS_HAVE_MM256_EXTRACT_EPI64",
41+ "#undef AWS_HAVE_CLMUL",
42+ "#undef AWS_HAVE_ARM32_CRC",
43+ "#undef AWS_HAVE_ARMv8_1",
44+ "#undef AWS_ARCH_ARM64",
45+ "#undef AWS_ARCH_INTEL",
46+ "#undef AWS_ARCH_INTEL_X64",
47+ "",
48+ "#endif"
49+ ]
50+ )
51+
1052cc_library(
1153 name = "aws_c_common",
1254 srcs = glob([
1355 "include/aws/common/*.h",
56+ "include/aws/common/external/*.h",
1457 "include/aws/common/private/*.h",
1558 "source/*.c",
59+ "source/arch/generic/*.c",
60+ "source/external/**/*.h",
61+ "source/external/**/*.c",
1662 ]) + select({
1763 "@platforms//os:windows": glob([
1864 "source/windows/*.c",
1965 ]),
20- "//conditions:default": glob([
66+ "@platforms//os:linux": glob([
67+ "source/linux/*.c",
2168 "source/posix/*.c",
2269 ]),
70+ "@platforms//os:osx": glob([
71+ "source/posix/*.c",
72+ ])
2373 }),
24- hdrs = [
25- "include/aws/common/config.h",
74+ hdrs = glob([
75+ "include/aws/common/*.h",
76+ "include/aws/common/private/*.h",
77+ ]) + [
78+ ":write_config_h"
79+ ],
80+ defines = [
81+ # TODO: improve this with logic from AwsThreadAffinity.cmake
82+ "AWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE",
83+ # Disable macro tracing API
84+ "INTEL_NO_ITTNOTIFY_API",
2685 ],
27- defines = [],
2886 includes = [
2987 "include",
88+ "source/external",
89+ "source/external/libcbor"
3090 ],
3191 textual_hdrs = glob([
3292 "include/**/*.inl",
3393 ]),
3494 deps = [],
3595)
3696
37- genrule(
38- name = "config_h",
39- srcs = [
40- "include/aws/common/config.h.in",
41- ],
42- outs = [
43- "include/aws/common/config.h",
44- ],
45- cmd = "sed 's/cmakedefine/undef/g' $< > $@",
46- )
0 commit comments