1# Copyright 2021 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_library", 18 "pw_cc_test", 19) 20load("@rules_cc_toolchain//cc_toolchain:cc_toolchain_import.bzl", "cc_toolchain_import") 21 22package(default_visibility = ["//visibility:public"]) 23 24licenses(["notice"]) 25 26cc_toolchain_import( 27 name = "toolchain_polyfill_overrides", 28 hdrs = [ 29 "public_overrides/bit", 30 "public_overrides/cstddef", 31 "public_overrides/iterator", 32 "public_overrides/type_traits", 33 "standard_library_public/pw_polyfill/standard_library/bit.h", 34 "standard_library_public/pw_polyfill/standard_library/cstddef.h", 35 "standard_library_public/pw_polyfill/standard_library/iterator.h", 36 "standard_library_public/pw_polyfill/standard_library/namespace.h", 37 "standard_library_public/pw_polyfill/standard_library/type_traits.h", 38 ], 39 includes = [ 40 "public", 41 "public_overrides", 42 "standard_library_public", 43 ], 44) 45 46pw_cc_library( 47 name = "pw_polyfill", 48 hdrs = [ 49 "public/pw_polyfill/language_feature_macros.h", 50 "public/pw_polyfill/standard.h", 51 ], 52 includes = ["public"], 53) 54 55# TODO(pwbug/602): Deprecate this once all users have been migrated to targeted 56# polyfill deps. 57pw_cc_library( 58 name = "overrides", 59 deps = [ 60 ":bit", 61 ":cstddef", 62 ":iterator", 63 ":span", 64 ":type_traits", 65 ], 66) 67 68# Provides <bit>'s std::endian. 69pw_cc_library( 70 name = "bit", 71 hdrs = [ 72 "public_overrides/bit", 73 "standard_library_public/pw_polyfill/standard_library/bit.h", 74 ], 75 includes = [ 76 "public_overrides", 77 "standard_library_public", 78 ], 79 deps = [":standard_library"], 80) 81 82# Provides <cstddef>'s std::byte. 83pw_cc_library( 84 name = "cstddef", 85 hdrs = [ 86 "public_overrides/cstddef", 87 "standard_library_public/pw_polyfill/standard_library/cstddef.h", 88 ], 89 includes = [ 90 "public_overrides", 91 "standard_library_public", 92 ], 93 deps = [":standard_library"], 94) 95 96# TODO(pwbug/603): Remove this polyfill. 97pw_cc_library( 98 name = "iterator", 99 hdrs = [ 100 "public_overrides/iterator", 101 "standard_library_public/pw_polyfill/standard_library/iterator.h", 102 ], 103 includes = [ 104 "public_overrides", 105 "standard_library_public", 106 ], 107 deps = [ 108 ":standard_library", 109 ":type_traits", 110 ], 111) 112 113# Provides <span>. 114pw_cc_library( 115 name = "span", 116 deps = ["//pw_span"], 117) 118 119# TODO(pwbug/603): Remove this polyfill. 120pw_cc_library( 121 name = "type_traits", 122 hdrs = [ 123 "public_overrides/type_traits", 124 "standard_library_public/pw_polyfill/standard_library/type_traits.h", 125 ], 126 includes = [ 127 "public_overrides", 128 "standard_library_public", 129 ], 130 deps = [ 131 ":cstddef", 132 ":standard_library", 133 ], 134) 135 136pw_cc_library( 137 name = "standard_library", 138 hdrs = [ 139 "standard_library_public/pw_polyfill/standard_library/namespace.h", 140 ], 141 includes = ["standard_library_public"], 142 visibility = ["//pw_span:__pkg__"], 143) 144 145pw_cc_test( 146 name = "default_cpp_test", 147 srcs = [ 148 "test.cc", 149 ], 150 deps = [ 151 ":pw_polyfill", 152 ":standard_library", 153 "//pw_unit_test", 154 ], 155) 156