xref: /aosp_15_r20/external/pigweed/pw_checksum/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("//pw_perf_test:pw_cc_perf_test.bzl", "pw_cc_perf_test")
16load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
17
18package(default_visibility = ["//visibility:public"])
19
20licenses(["notice"])
21
22cc_library(
23    name = "pw_checksum",
24    srcs = [
25        "crc16_ccitt.cc",
26        "crc32.cc",
27    ],
28    hdrs = [
29        "public/pw_checksum/crc16_ccitt.h",
30        "public/pw_checksum/crc32.h",
31        "public/pw_checksum/internal/config.h",
32    ],
33    strip_include_prefix = "public",
34    deps = [
35        ":config_override",
36        "//pw_bytes",
37        "//pw_span",
38    ],
39)
40
41label_flag(
42    name = "config_override",
43    build_setting_default = "//pw_build:default_module_config",
44)
45
46pw_cc_test(
47    name = "crc16_ccitt_test",
48    srcs = [
49        "crc16_ccitt_test.cc",
50        "crc16_ccitt_test_c.c",
51    ],
52    deps = [
53        ":pw_checksum",
54        "//pw_bytes",
55        "//pw_unit_test",
56    ],
57)
58
59pw_cc_test(
60    name = "crc32_test",
61    srcs = [
62        "crc32_test.cc",
63        "crc32_test_c.c",
64    ],
65    deps = [
66        ":pw_checksum",
67        "//pw_bytes",
68        "//pw_unit_test",
69    ],
70)
71
72pw_cc_perf_test(
73    name = "crc32_perf_test",
74    srcs = ["crc32_perf_test.cc"],
75    deps = [
76        ":pw_checksum",
77        "//pw_bytes",
78    ],
79)
80
81pw_cc_perf_test(
82    name = "crc16_perf_test",
83    srcs = ["crc16_ccitt_perf_test.cc"],
84    deps = [
85        ":pw_checksum",
86        "//pw_bytes",
87    ],
88)
89