blob: 73da37d0a24b10aa2568d8734fc7ac41a05a602f [file] [log] [blame]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -08001# 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
Armando Montanezfb3d3fb2020-06-09 18:12:12 -070015# gn-format disable
16import("//build_overrides/pigweed.gni")
17
Alexei Frolovedd2f142020-06-09 19:11:27 -070018import("$dir_pw_build/target_types.gni")
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080019import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080021config("public") {
22 include_dirs = [ "public" ]
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070023 visibility = [ ":*" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080024}
25
Alexei Frolovedd2f142020-06-09 19:11:27 -070026pw_source_set("pw_polyfill") {
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080027 public_configs = [ ":public" ]
Alexei Frolov844ff0f2020-05-06 12:15:29 -070028 remove_public_deps = [ "*" ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080029 public_deps = [ ":standard_library" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080030 public = [
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070031 "public/pw_polyfill/language_feature_macros.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080032 "public/pw_polyfill/standard.h",
33 ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080034}
35
36config("overrides_config") {
37 include_dirs = [ "public_overrides" ]
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070038 cflags_cc = [
39 # Use -include to include the language features header in dependent files,
40 # without requiring a #include. This allows the use of newer C++ language
41 # features in older C++ versions without an explicit include.
42 "-include",
43 rebase_path("language_features.h"),
44 ]
45 visibility = [ ":*" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080046}
47
Alexei Frolovedd2f142020-06-09 19:11:27 -070048pw_source_set("overrides") {
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080049 public_configs = [ ":overrides_config" ]
Alexei Frolov844ff0f2020-05-06 12:15:29 -070050 remove_public_deps = [ "*" ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080051 public_deps = [ ":standard_library" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080052 inputs = [
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070053 "public_overrides/array",
Wyatt Heplerac6cdf22020-01-24 13:35:09 -080054 "public_overrides/assert.h",
Wyatt Heplerecf19232020-09-02 14:35:09 -070055 "public_overrides/bit",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080056 "public_overrides/cstddef",
57 "public_overrides/iterator",
58 "public_overrides/type_traits",
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070059 "public_overrides/utility",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080060 ]
Wyatt Hepler6c331ae2020-08-04 10:05:11 -070061 sources = [ "language_features.h" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080062}
63
64config("standard_library_public") {
65 include_dirs = [ "standard_library_public" ]
66}
67
Alexei Frolovedd2f142020-06-09 19:11:27 -070068pw_source_set("standard_library") {
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080069 public_configs = [ ":standard_library_public" ]
Alexei Frolov844ff0f2020-05-06 12:15:29 -070070 remove_public_deps = [ "*" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080071 public = [
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070072 "standard_library_public/pw_polyfill/standard_library/array.h",
Wyatt Heplerac6cdf22020-01-24 13:35:09 -080073 "standard_library_public/pw_polyfill/standard_library/assert.h",
Wyatt Heplerecf19232020-09-02 14:35:09 -070074 "standard_library_public/pw_polyfill/standard_library/bit.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080075 "standard_library_public/pw_polyfill/standard_library/cstddef.h",
76 "standard_library_public/pw_polyfill/standard_library/iterator.h",
Wyatt Hepler023f35b2020-07-01 09:40:50 -070077 "standard_library_public/pw_polyfill/standard_library/namespace.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080078 "standard_library_public/pw_polyfill/standard_library/type_traits.h",
Wyatt Hepler8e59f4d2020-08-27 10:34:21 -070079 "standard_library_public/pw_polyfill/standard_library/utility.h",
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080080 ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080081 visibility = [
82 ":overrides",
83 ":pw_polyfill",
84 ]
85}
86
87pw_test_group("tests") {
Wyatt Hepler818e3312020-01-16 14:19:21 -080088 tests = [
89 ":default_cpp_test",
90 ":cpp11_test",
91 ":cpp14_test",
92 ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080093}
94
95pw_test("default_cpp_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080096 deps = [ ":pw_polyfill" ]
97 sources = [ "test.cc" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -080098}
99
Wyatt Hepler818e3312020-01-16 14:19:21 -0800100pw_test("cpp11_test") {
Alexei Frolov844ff0f2020-05-06 12:15:29 -0700101 remove_configs = [ "$dir_pw_build:cpp17" ]
Wyatt Hepler818e3312020-01-16 14:19:21 -0800102 configs = [ "$dir_pw_build:cpp11" ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800103 sources = [ "test.cc" ]
104 deps = [ ":pw_polyfill" ]
Wyatt Hepler818e3312020-01-16 14:19:21 -0800105}
106
107pw_test("cpp14_test") {
Alexei Frolov844ff0f2020-05-06 12:15:29 -0700108 remove_configs = [ "$dir_pw_build:cpp17" ]
Wyatt Hepler818e3312020-01-16 14:19:21 -0800109 configs = [ "$dir_pw_build:cpp14" ]
Rob Mohra0ba54f2020-02-27 11:43:49 -0800110 sources = [ "test.cc" ]
111 deps = [ ":pw_polyfill" ]
Wyatt Hepler818e3312020-01-16 14:19:21 -0800112}
113
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800114pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -0800115 sources = [ "docs.rst" ]
Wyatt Heplerc542a5d2020-01-15 15:43:10 -0800116}