• 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
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
26config("no_cpp_includes") {
27  cflags = [ "-nostdinc++" ]
28}
29
30config("use_minimal_cpp_stdlib") {
31  configs = [
32    ":public_include_path",
33    ":no_cpp_includes",
34  ]
35}
36
37pw_source_set("pw_minimal_cpp_stdlib") {
38  public_configs = [ ":public_include_path" ]
39  configs = [ ":no_cpp_includes" ]
40  public = [
41    "public/algorithm",
42    "public/array",
43    "public/cinttypes",
44    "public/climits",
45    "public/cmath",
46    "public/cstdarg",
47    "public/cstddef",
48    "public/cstdint",
49    "public/cstdio",
50    "public/cstring",
51    "public/initializer_list",
52    "public/iterator",
53    "public/limits",
54    "public/new",
55    "public/string_view",
56    "public/type_traits",
57    "public/utility",
58  ]
59  sources = [
60    "public/internal/algorithm.h",
61    "public/internal/array.h",
62    "public/internal/cinttypes.h",
63    "public/internal/climits.h",
64    "public/internal/cmath.h",
65    "public/internal/cstdarg.h",
66    "public/internal/cstddef.h",
67    "public/internal/cstdint.h",
68    "public/internal/cstdio.h",
69    "public/internal/cstring.h",
70    "public/internal/initializer_list.h",
71    "public/internal/iterator.h",
72    "public/internal/limits.h",
73    "public/internal/new.h",
74    "public/internal/string_view.h",
75    "public/internal/type_traits.h",
76    "public/internal/utility.h",
77  ]
78  public_deps = [ dir_pw_polyfill ]
79}
80
81pw_test_group("tests") {
82  tests = []
83  if (host_os != "win") {
84    # TODO(amontanez): pw_minimal_cpp_stdlib tests do not build on windows.
85    tests += [
86      ":minimal_cpp_stdlib_test",
87      ":standard_library_test",
88    ]
89  }
90}
91
92pw_source_set("minimal_cpp_stdlib_isolated_test") {
93  configs = [ ":no_cpp_includes" ]
94  deps = [
95    ":pw_minimal_cpp_stdlib",
96    dir_pw_polyfill,
97    dir_pw_preprocessor,
98  ]
99  sources = [ "isolated_test.cc" ]
100  visibility = [ ":*" ]
101}
102
103pw_test("minimal_cpp_stdlib_test") {
104  deps = [ ":minimal_cpp_stdlib_isolated_test" ]
105  sources = [ "test.cc" ]
106}
107
108pw_test("standard_library_test") {
109  deps = [
110    dir_pw_polyfill,
111    dir_pw_preprocessor,
112  ]
113  sources = [
114    "isolated_test.cc",
115    "test.cc",
116  ]
117}
118
119pw_doc_group("docs") {
120  sources = [ "docs.rst" ]
121}
122