blob: 3fcef9b1b9ef2e7a1d5f599f6ca9c9391646fb29 [file] [log] [blame]
Nathaniel Brough82cf6872021-02-16 15:51:57 +08001# Copyright 2021 The Pigweed Authors
Wyatt Heplerc542a5d2020-01-15 15:43:10 -08002#
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)
Nathaniel Broughb44d95e2021-07-15 10:39:47 +080020load("@rules_cc_toolchain//cc_toolchain:cc_toolchain_import.bzl", "cc_toolchain_import")
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080021
22package(default_visibility = ["//visibility:public"])
23
Rob Mohr5fc25412021-06-23 09:35:23 -070024licenses(["notice"])
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080025
Nathaniel Broughb44d95e2021-07-15 10:39:47 +080026cc_toolchain_import(
Nathaniel Brough82cf6872021-02-16 15:51:57 +080027 name = "toolchain_polyfill_overrides",
28 hdrs = [
Nathaniel Brough82cf6872021-02-16 15:51:57 +080029 "public_overrides/bit",
30 "public_overrides/cstddef",
31 "public_overrides/iterator",
32 "public_overrides/type_traits",
Nathaniel Brough82cf6872021-02-16 15:51:57 +080033 "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 Brough82cf6872021-02-16 15:51:57 +080038 ],
Nathaniel Broughb44d95e2021-07-15 10:39:47 +080039 includes = [
Nathaniel Brough82cf6872021-02-16 15:51:57 +080040 "public",
Nathaniel Broughb44d95e2021-07-15 10:39:47 +080041 "public_overrides",
Nathaniel Brough82cf6872021-02-16 15:51:57 +080042 "standard_library_public",
43 ],
44)
45
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080046pw_cc_library(
47 name = "pw_polyfill",
48 hdrs = [
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070049 "public/pw_polyfill/language_feature_macros.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080050 "public/pw_polyfill/standard.h",
51 ],
52 includes = ["public"],
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -080053)
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 ],
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080079 deps = [":standard_library"],
80)
81
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -080082# Provides <cstddef>'s std::byte.
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080083pw_cc_library(
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -080084 name = "cstddef",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080085 hdrs = [
86 "public_overrides/cstddef",
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -080087 "standard_library_public/pw_polyfill/standard_library/cstddef.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080088 ],
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -080089 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 ],
Ted Pudlikd0cca892022-01-26 23:09:08 +0000107 deps = [
108 ":standard_library",
109 ":type_traits",
110 ],
Ewout van Bekkuma0fc38c2022-01-14 09:15:53 -0800111)
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 ],
Ted Pudlikd0cca892022-01-26 23:09:08 +0000130 deps = [
131 ":cstddef",
132 ":standard_library",
133 ],
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800134)
135
136pw_cc_library(
137 name = "standard_library",
138 hdrs = [
Wyatt Hepler023f35b2020-07-01 09:40:50 -0700139 "standard_library_public/pw_polyfill/standard_library/namespace.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800140 ],
141 includes = ["standard_library_public"],
Ted Pudlikd0cca892022-01-26 23:09:08 +0000142 visibility = ["//pw_span:__pkg__"],
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800143)
144
145pw_cc_test(
146 name = "default_cpp_test",
147 srcs = [
148 "test.cc",
149 ],
150 deps = [
151 ":pw_polyfill",
Rob Mohrc8b55522020-04-07 07:27:31 -0700152 ":standard_library",
Rob Mohr06819482020-04-06 13:25:43 -0700153 "//pw_unit_test",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800154 ],
155)