blob: 1b2f74d1e41e6ab48d2ed0e391e3b3d42eb4cce1 [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 Brough82cf6872021-02-16 15:51:57 +080020load(
21 "@bazel_embedded//toolchains/tools/include_tools:defs.bzl",
22 "cc_injected_toolchain_header_library",
23 "cc_polyfill_toolchain_library",
24)
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080025
26package(default_visibility = ["//visibility:public"])
27
28licenses(["notice"]) # Apache License 2.0
29
Nathaniel Brough82cf6872021-02-16 15:51:57 +080030cc_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
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080062pw_cc_library(
63 name = "pw_polyfill",
64 hdrs = [
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070065 "public/pw_polyfill/language_feature_macros.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080066 "public/pw_polyfill/standard.h",
67 ],
68 includes = ["public"],
69 deps = [":standard_library"],
70)
71
72pw_cc_library(
73 name = "overrides",
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070074 srcs = ["language_features.h"],
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080075 hdrs = [
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070076 "public_overrides/array",
Wyatt Heplerac6cdf22020-01-24 13:35:09 -080077 "public_overrides/assert.h",
Wyatt Heplerecf19232020-09-02 14:35:09 -070078 "public_overrides/bit",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080079 "public_overrides/cstddef",
80 "public_overrides/iterator",
81 "public_overrides/type_traits",
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070082 "public_overrides/utility",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080083 ],
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070084 copts = [
85 "-include",
86 "language_features.h",
87 ],
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080088 includes = ["public_overrides"],
89 deps = [":standard_library"],
90)
91
92pw_cc_library(
93 name = "standard_library",
94 hdrs = [
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070095 "standard_library_public/pw_polyfill/standard_library/array.h",
Wyatt Heplerac6cdf22020-01-24 13:35:09 -080096 "standard_library_public/pw_polyfill/standard_library/assert.h",
Wyatt Heplerecf19232020-09-02 14:35:09 -070097 "standard_library_public/pw_polyfill/standard_library/bit.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080098 "standard_library_public/pw_polyfill/standard_library/cstddef.h",
99 "standard_library_public/pw_polyfill/standard_library/iterator.h",
Wyatt Hepler023f35b2020-07-01 09:40:50 -0700100 "standard_library_public/pw_polyfill/standard_library/namespace.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800101 "standard_library_public/pw_polyfill/standard_library/type_traits.h",
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -0700102 "standard_library_public/pw_polyfill/standard_library/utility.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800103 ],
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",
Rob Mohrc8b55522020-04-07 07:27:31 -0700115 ":standard_library",
Rob Mohr06819482020-04-06 13:25:43 -0700116 "//pw_unit_test",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800117 ],
118)