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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_unit_test/test.gni") 20 21config("public_include_path") { 22 include_dirs = [ "public" ] 23 visibility = [ ":*" ] 24} 25 26pw_source_set("pw_polyfill") { 27 public_configs = [ ":public_include_path" ] 28 remove_public_deps = [ "*" ] 29 public_deps = [ ":standard_library" ] 30 public = [ 31 "public/pw_polyfill/language_feature_macros.h", 32 "public/pw_polyfill/standard.h", 33 ] 34} 35 36config("cstddef_overrides_config") { 37 include_dirs = [ "cstddef_public_overrides" ] 38 cflags = [ "-Wno-gnu-include-next" ] 39 visibility = [ ":*" ] 40} 41 42config("iterator_overrides_config") { 43 include_dirs = [ "iterator_public_overrides" ] 44 cflags = [ "-Wno-gnu-include-next" ] 45 visibility = [ ":*" ] 46} 47 48config("standard_library_public") { 49 include_dirs = [ "standard_library_public" ] 50} 51 52# Provides <cstddef>'s std::byte for C++14. 53pw_source_set("cstddef") { 54 public_configs = [ 55 ":standard_library_public", 56 ":cstddef_overrides_config", 57 ] 58 public_deps = [ ":standard_library" ] 59 remove_public_deps = [ "*" ] 60 public = [ "cstddef_public_overrides/cstddef" ] 61 sources = [ "standard_library_public/pw_polyfill/standard_library/cstddef.h" ] 62} 63 64# Provides <iterator>'s std::data and std::size for C++14. 65pw_source_set("iterator") { 66 public_configs = [ 67 ":standard_library_public", 68 ":iterator_overrides_config", 69 ] 70 public_deps = [ ":standard_library" ] 71 remove_public_deps = [ "*" ] 72 public = [ "iterator_public_overrides/iterator" ] 73 sources = 74 [ "standard_library_public/pw_polyfill/standard_library/iterator.h" ] 75} 76 77pw_source_set("standard_library") { 78 public_configs = [ ":standard_library_public" ] 79 remove_public_deps = [ "*" ] 80 public = 81 [ "standard_library_public/pw_polyfill/standard_library/namespace.h" ] 82 visibility = [ ":*" ] 83} 84 85pw_test_group("tests") { 86 tests = [ ":test" ] 87 group_deps = [ "$dir_pw_span:tests" ] 88} 89 90pw_test("test") { 91 deps = [ ":pw_polyfill" ] 92 93 # Do not depend on :cstddef and :iterator since they override library headers. 94 # Instead, add their include path and list them as sources. 95 configs = [ ":standard_library_public" ] 96 sources = [ 97 "standard_library_public/pw_polyfill/standard_library/cstddef.h", 98 "standard_library_public/pw_polyfill/standard_library/iterator.h", 99 "test.cc", 100 ] 101} 102 103pw_doc_group("docs") { 104 sources = [ "docs.rst" ] 105} 106