• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 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
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16
17pw_add_module_library(pw_polyfill
18  HEADERS
19    public/pw_polyfill/language_feature_macros.h
20    public/pw_polyfill/standard.h
21  PUBLIC_INCLUDES
22    public
23)
24if(Zephyr_FOUND AND CONFIG_PIGWEED_POLYFILL)
25  zephyr_link_libraries(pw_polyfill)
26endif()
27
28# TODO(pwbug/602): Remove this overrides target by migrating all users to
29# explicitly depend on the polyfill(s) they require.
30pw_add_module_library(pw_polyfill.overrides
31  PUBLIC_DEPS
32    pw_polyfill.bit
33    pw_polyfill.cstddef
34    pw_polyfill.iterator
35    pw_polyfill.span
36    pw_polyfill.type_traits
37)
38if(Zephyr_FOUND AND CONFIG_PIGWEED_POLYFILL_OVERRIDES)
39  zephyr_link_libraries(pw_polyfill.overrides)
40endif()
41
42# Provides <bit>'s std::endian.
43pw_add_module_library(pw_polyfill.bit
44  HEADERS
45    public_overrides/bit
46    standard_library_public/pw_polyfill/standard_library/bit.h
47  PUBLIC_INCLUDES
48    public_overrides
49    standard_library_public
50  PUBLIC_DEPS
51    pw_polyfill.standard_library
52)
53
54# Provides <cstddef>'s std::byte.
55pw_add_module_library(pw_polyfill.cstddef
56  HEADERS
57    public_overrides/cstddef
58    standard_library_public/pw_polyfill/standard_library/cstddef.h
59  PUBLIC_INCLUDES
60    public_overrides
61    standard_library_public
62  PUBLIC_DEPS
63    pw_polyfill.standard_library
64)
65
66# TODO(pwbug/603): Remove this polyfill.
67pw_add_module_library(pw_polyfill.iterator
68  HEADERS
69    public_overrides/iterator
70    standard_library_public/pw_polyfill/standard_library/iterator.h
71  PUBLIC_INCLUDES
72    public_overrides
73    standard_library_public
74  PUBLIC_DEPS
75    pw_polyfill.standard_library
76)
77
78# Provides <span>.
79pw_add_module_library(pw_polyfill.span
80  PUBLIC_DEPS
81    pw_span
82)
83
84# TODO(pwbug/603): Remove this polyfill.
85pw_add_module_library(pw_polyfill.type_traits
86  HEADERS
87    public_overrides/type_traits
88    standard_library_public/pw_polyfill/standard_library/type_traits.h
89  PUBLIC_INCLUDES
90    public_overrides
91    standard_library_public
92  PUBLIC_DEPS
93    pw_polyfill.standard_library
94)
95
96pw_add_module_library(pw_polyfill.standard_library
97  HEADERS
98    standard_library_public/pw_polyfill/standard_library/namespace.h
99  PUBLIC_INCLUDES
100    standard_library_public
101)
102