• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_perf_test",
18    "pw_cc_test",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])
24
25cc_library(
26    name = "pw_checksum",
27    srcs = [
28        "crc16_ccitt.cc",
29        "crc32.cc",
30    ],
31    hdrs = [
32        "public/pw_checksum/crc16_ccitt.h",
33        "public/pw_checksum/crc32.h",
34        "public/pw_checksum/internal/config.h",
35    ],
36    includes = ["public"],
37    deps = [
38        ":config_override",
39        "//pw_bytes",
40        "//pw_span",
41    ],
42)
43
44label_flag(
45    name = "config_override",
46    build_setting_default = "//pw_build:default_module_config",
47)
48
49pw_cc_test(
50    name = "crc16_ccitt_test",
51    srcs = [
52        "crc16_ccitt_test.cc",
53        "crc16_ccitt_test_c.c",
54    ],
55    deps = [
56        ":pw_checksum",
57        "//pw_bytes",
58        "//pw_unit_test",
59    ],
60)
61
62pw_cc_test(
63    name = "crc32_test",
64    srcs = [
65        "crc32_test.cc",
66        "crc32_test_c.c",
67    ],
68    deps = [
69        ":pw_checksum",
70        "//pw_bytes",
71        "//pw_unit_test",
72    ],
73)
74
75pw_cc_perf_test(
76    name = "crc32_perf_test",
77    srcs = ["crc32_perf_test.cc"],
78    deps = [
79        ":pw_checksum",
80        "//pw_bytes",
81    ],
82)
83
84pw_cc_perf_test(
85    name = "crc16_perf_test",
86    srcs = ["crc16_ccitt_perf_test.cc"],
87    deps = [
88        ":pw_checksum",
89        "//pw_bytes",
90    ],
91)
92