• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(
21    "@bazel_embedded//toolchains/tools/include_tools:defs.bzl",
22    "cc_injected_toolchain_header_library",
23    "cc_polyfill_toolchain_library",
24)
25
26package(default_visibility = ["//visibility:public"])
27
28licenses(["notice"])  # Apache License 2.0
29
30cc_injected_toolchain_header_library(
31    name = "toolchain_injected_headers",
32    hdrs = ["language_features.h"],
33)
34
35cc_polyfill_toolchain_library(
36    name = "toolchain_polyfill_overrides",
37    hdrs = [
38        "language_features.h",
39        "public_overrides/array",
40        "public_overrides/assert.h",
41        "public_overrides/bit",
42        "public_overrides/cstddef",
43        "public_overrides/iterator",
44        "public_overrides/type_traits",
45        "public_overrides/utility",
46        "standard_library_public/pw_polyfill/standard_library/array.h",
47        "standard_library_public/pw_polyfill/standard_library/assert.h",
48        "standard_library_public/pw_polyfill/standard_library/bit.h",
49        "standard_library_public/pw_polyfill/standard_library/cstddef.h",
50        "standard_library_public/pw_polyfill/standard_library/iterator.h",
51        "standard_library_public/pw_polyfill/standard_library/namespace.h",
52        "standard_library_public/pw_polyfill/standard_library/type_traits.h",
53        "standard_library_public/pw_polyfill/standard_library/utility.h",
54    ],
55    system_includes = [
56        "public_overrides",
57        "public",
58        "standard_library_public",
59    ],
60)
61
62pw_cc_library(
63    name = "pw_polyfill",
64    hdrs = [
65        "public/pw_polyfill/language_feature_macros.h",
66        "public/pw_polyfill/standard.h",
67    ],
68    includes = ["public"],
69    deps = [":standard_library"],
70)
71
72pw_cc_library(
73    name = "overrides",
74    srcs = ["language_features.h"],
75    hdrs = [
76        "public_overrides/array",
77        "public_overrides/assert.h",
78        "public_overrides/bit",
79        "public_overrides/cstddef",
80        "public_overrides/iterator",
81        "public_overrides/type_traits",
82        "public_overrides/utility",
83    ],
84    copts = [
85        "-include",
86        "language_features.h",
87    ],
88    includes = ["public_overrides"],
89    deps = [":standard_library"],
90)
91
92pw_cc_library(
93    name = "standard_library",
94    hdrs = [
95        "standard_library_public/pw_polyfill/standard_library/array.h",
96        "standard_library_public/pw_polyfill/standard_library/assert.h",
97        "standard_library_public/pw_polyfill/standard_library/bit.h",
98        "standard_library_public/pw_polyfill/standard_library/cstddef.h",
99        "standard_library_public/pw_polyfill/standard_library/iterator.h",
100        "standard_library_public/pw_polyfill/standard_library/namespace.h",
101        "standard_library_public/pw_polyfill/standard_library/type_traits.h",
102        "standard_library_public/pw_polyfill/standard_library/utility.h",
103    ],
104    includes = ["standard_library_public"],
105    visibility = ["//visibility:private"],
106)
107
108pw_cc_test(
109    name = "default_cpp_test",
110    srcs = [
111        "test.cc",
112    ],
113    deps = [
114        ":pw_polyfill",
115        ":standard_library",
116        "//pw_unit_test",
117    ],
118)
119