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("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_perf_test:pw_cc_perf_test.bzl", "pw_cc_perf_test") 19load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 20 21package( 22 default_visibility = ["//visibility:public"], 23) 24 25licenses(["notice"]) 26 27cc_library( 28 name = "pw_checksum", 29 srcs = [ 30 "crc16_ccitt.cc", 31 "crc32.cc", 32 ], 33 hdrs = [ 34 "public/pw_checksum/crc16_ccitt.h", 35 "public/pw_checksum/crc32.h", 36 "public/pw_checksum/internal/config.h", 37 ], 38 strip_include_prefix = "public", 39 tags = ["noclangtidy"], 40 deps = [ 41 ":config_override", 42 "//pw_bytes", 43 "//pw_span", 44 ], 45) 46 47label_flag( 48 name = "config_override", 49 build_setting_default = "//pw_build:default_module_config", 50) 51 52pw_cc_test( 53 name = "crc16_ccitt_test", 54 srcs = [ 55 "crc16_ccitt_test.cc", 56 "crc16_ccitt_test_c.c", 57 ], 58 deps = [ 59 ":pw_checksum", 60 "//pw_bytes", 61 ], 62) 63 64pw_cc_test( 65 name = "crc32_test", 66 srcs = [ 67 "crc32_test.cc", 68 "crc32_test_c.c", 69 ], 70 deps = [ 71 ":pw_checksum", 72 "//pw_bytes", 73 "//pw_span", 74 ], 75) 76 77pw_cc_perf_test( 78 name = "crc32_perf_test", 79 srcs = ["crc32_perf_test.cc"], 80 deps = [ 81 ":pw_checksum", 82 "//pw_bytes", 83 "//pw_perf_test", 84 "//pw_span", 85 ], 86) 87 88pw_cc_perf_test( 89 name = "crc16_perf_test", 90 srcs = ["crc16_ccitt_perf_test.cc"], 91 deps = [ 92 ":pw_checksum", 93 "//pw_bytes", 94 "//pw_perf_test", 95 "//pw_span", 96 ], 97) 98 99sphinx_docs_library( 100 name = "docs", 101 srcs = [ 102 "Kconfig", 103 "docs.rst", 104 ], 105 prefix = "pw_checksum/", 106 target_compatible_with = incompatible_with_mcu(), 107) 108