Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 1 | # Copyright 2021 The Pigweed Authors |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | "pw_cc_test", |
| 19 | ) |
Nathaniel Brough | b44d95e | 2021-07-15 10:39:47 +0800 | [diff] [blame] | 20 | load("@rules_cc_toolchain//cc_toolchain:cc_toolchain_import.bzl", "cc_toolchain_import") |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 21 | |
| 22 | package(default_visibility = ["//visibility:public"]) |
| 23 | |
Rob Mohr | 5fc2541 | 2021-06-23 09:35:23 -0700 | [diff] [blame] | 24 | licenses(["notice"]) |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 25 | |
Nathaniel Brough | b44d95e | 2021-07-15 10:39:47 +0800 | [diff] [blame] | 26 | cc_toolchain_import( |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 27 | name = "toolchain_polyfill_overrides", |
| 28 | hdrs = [ |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 29 | "public_overrides/bit", |
| 30 | "public_overrides/cstddef", |
| 31 | "public_overrides/iterator", |
| 32 | "public_overrides/type_traits", |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 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", |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 38 | ], |
Nathaniel Brough | b44d95e | 2021-07-15 10:39:47 +0800 | [diff] [blame] | 39 | includes = [ |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 40 | "public", |
Nathaniel Brough | b44d95e | 2021-07-15 10:39:47 +0800 | [diff] [blame] | 41 | "public_overrides", |
Nathaniel Brough | 82cf687 | 2021-02-16 15:51:57 +0800 | [diff] [blame] | 42 | "standard_library_public", |
| 43 | ], |
| 44 | ) |
| 45 | |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 46 | pw_cc_library( |
| 47 | name = "pw_polyfill", |
| 48 | hdrs = [ |
Wyatt Hepler | 6c331ae | 2020-08-04 10:05:11 -0700 | [diff] [blame] | 49 | "public/pw_polyfill/language_feature_macros.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 50 | "public/pw_polyfill/standard.h", |
| 51 | ], |
| 52 | includes = ["public"], |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 53 | ) |
| 54 | |
| 55 | # TODO(pwbug/602): Deprecate this once all users have been migrated to targeted |
| 56 | # polyfill deps. |
| 57 | pw_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. |
| 69 | pw_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 | ], |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 79 | deps = [":standard_library"], |
| 80 | ) |
| 81 | |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 82 | # Provides <cstddef>'s std::byte. |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 83 | pw_cc_library( |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 84 | name = "cstddef", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 85 | hdrs = [ |
| 86 | "public_overrides/cstddef", |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 87 | "standard_library_public/pw_polyfill/standard_library/cstddef.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 88 | ], |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 89 | includes = [ |
| 90 | "public_overrides", |
| 91 | "standard_library_public", |
| 92 | ], |
| 93 | deps = [":standard_library"], |
| 94 | ) |
| 95 | |
| 96 | # TODO(pwbug/603): Remove this polyfill. |
| 97 | pw_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 | ], |
Ted Pudlik | d0cca89 | 2022-01-26 23:09:08 +0000 | [diff] [blame] | 107 | deps = [ |
| 108 | ":standard_library", |
| 109 | ":type_traits", |
| 110 | ], |
Ewout van Bekkum | a0fc38c | 2022-01-14 09:15:53 -0800 | [diff] [blame] | 111 | ) |
| 112 | |
| 113 | # Provides <span>. |
| 114 | pw_cc_library( |
| 115 | name = "span", |
| 116 | deps = ["//pw_span"], |
| 117 | ) |
| 118 | |
| 119 | # TODO(pwbug/603): Remove this polyfill. |
| 120 | pw_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 | ], |
Ted Pudlik | d0cca89 | 2022-01-26 23:09:08 +0000 | [diff] [blame] | 130 | deps = [ |
| 131 | ":cstddef", |
| 132 | ":standard_library", |
| 133 | ], |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 134 | ) |
| 135 | |
| 136 | pw_cc_library( |
| 137 | name = "standard_library", |
| 138 | hdrs = [ |
Wyatt Hepler | 023f35b | 2020-07-01 09:40:50 -0700 | [diff] [blame] | 139 | "standard_library_public/pw_polyfill/standard_library/namespace.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 140 | ], |
| 141 | includes = ["standard_library_public"], |
Ted Pudlik | d0cca89 | 2022-01-26 23:09:08 +0000 | [diff] [blame] | 142 | visibility = ["//pw_span:__pkg__"], |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 143 | ) |
| 144 | |
| 145 | pw_cc_test( |
| 146 | name = "default_cpp_test", |
| 147 | srcs = [ |
| 148 | "test.cc", |
| 149 | ], |
| 150 | deps = [ |
| 151 | ":pw_polyfill", |
Rob Mohr | c8b5552 | 2020-04-07 07:27:31 -0700 | [diff] [blame] | 152 | ":standard_library", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 153 | "//pw_unit_test", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 154 | ], |
| 155 | ) |