Wyatt Hepler | 7abd8cc | 2021-01-19 16:49:33 -0800 | [diff] [blame] | 1 | # Copyright 2021 The Pigweed Authors |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 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 Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 17 | import("$dir_pw_build/target_types.gni") |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 18 | import("$dir_pw_docgen/docs.gni") |
| 19 | import("$dir_pw_unit_test/test.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 20 | |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 21 | config("public") { |
| 22 | include_dirs = [ "public" ] |
Wyatt Hepler | 6c331ae | 2020-08-04 10:05:11 -0700 | [diff] [blame] | 23 | visibility = [ ":*" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 24 | } |
| 25 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 26 | pw_source_set("pw_polyfill") { |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 27 | public_configs = [ ":public" ] |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 28 | remove_public_deps = [ "*" ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 29 | public_deps = [ ":standard_library" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 30 | public = [ |
Wyatt Hepler | 6c331ae | 2020-08-04 10:05:11 -0700 | [diff] [blame] | 31 | "public/pw_polyfill/language_feature_macros.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 32 | "public/pw_polyfill/standard.h", |
| 33 | ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | config("overrides_config") { |
| 37 | include_dirs = [ "public_overrides" ] |
Wyatt Hepler | 6c331ae | 2020-08-04 10:05:11 -0700 | [diff] [blame] | 38 | 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 Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 46 | } |
| 47 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 48 | pw_source_set("overrides") { |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 49 | public_configs = [ ":overrides_config" ] |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 50 | remove_public_deps = [ "*" ] |
Wyatt Hepler | 7abd8cc | 2021-01-19 16:49:33 -0800 | [diff] [blame] | 51 | public_deps = [ |
| 52 | ":standard_library", |
Wyatt Hepler | 97a068c | 2021-01-19 16:50:04 -0800 | [diff] [blame] | 53 | "$dir_pw_span:polyfill", |
Wyatt Hepler | 7abd8cc | 2021-01-19 16:49:33 -0800 | [diff] [blame] | 54 | ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 55 | inputs = [ |
Wyatt Hepler | 8e59f4d | 2020-08-27 10:34:21 -0700 | [diff] [blame] | 56 | "public_overrides/array", |
Wyatt Hepler | ac6cdf2 | 2020-01-24 13:35:09 -0800 | [diff] [blame] | 57 | "public_overrides/assert.h", |
Wyatt Hepler | ecf1923 | 2020-09-02 14:35:09 -0700 | [diff] [blame] | 58 | "public_overrides/bit", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 59 | "public_overrides/cstddef", |
| 60 | "public_overrides/iterator", |
| 61 | "public_overrides/type_traits", |
Wyatt Hepler | 8e59f4d | 2020-08-27 10:34:21 -0700 | [diff] [blame] | 62 | "public_overrides/utility", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 63 | ] |
Wyatt Hepler | 6c331ae | 2020-08-04 10:05:11 -0700 | [diff] [blame] | 64 | sources = [ "language_features.h" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | config("standard_library_public") { |
| 68 | include_dirs = [ "standard_library_public" ] |
| 69 | } |
| 70 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 71 | pw_source_set("standard_library") { |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 72 | public_configs = [ ":standard_library_public" ] |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 73 | remove_public_deps = [ "*" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 74 | public = [ |
Wyatt Hepler | 8e59f4d | 2020-08-27 10:34:21 -0700 | [diff] [blame] | 75 | "standard_library_public/pw_polyfill/standard_library/array.h", |
Wyatt Hepler | ac6cdf2 | 2020-01-24 13:35:09 -0800 | [diff] [blame] | 76 | "standard_library_public/pw_polyfill/standard_library/assert.h", |
Wyatt Hepler | ecf1923 | 2020-09-02 14:35:09 -0700 | [diff] [blame] | 77 | "standard_library_public/pw_polyfill/standard_library/bit.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 78 | "standard_library_public/pw_polyfill/standard_library/cstddef.h", |
| 79 | "standard_library_public/pw_polyfill/standard_library/iterator.h", |
Wyatt Hepler | 023f35b | 2020-07-01 09:40:50 -0700 | [diff] [blame] | 80 | "standard_library_public/pw_polyfill/standard_library/namespace.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 81 | "standard_library_public/pw_polyfill/standard_library/type_traits.h", |
Wyatt Hepler | 8e59f4d | 2020-08-27 10:34:21 -0700 | [diff] [blame] | 82 | "standard_library_public/pw_polyfill/standard_library/utility.h", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 83 | ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 84 | visibility = [ |
| 85 | ":overrides", |
| 86 | ":pw_polyfill", |
| 87 | ] |
| 88 | } |
| 89 | |
| 90 | pw_test_group("tests") { |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 91 | tests = [ |
| 92 | ":default_cpp_test", |
| 93 | ":cpp11_test", |
| 94 | ":cpp14_test", |
| 95 | ] |
Wyatt Hepler | 7abd8cc | 2021-01-19 16:49:33 -0800 | [diff] [blame] | 96 | group_deps = [ "$dir_pw_span:tests" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | pw_test("default_cpp_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 100 | deps = [ ":pw_polyfill" ] |
| 101 | sources = [ "test.cc" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 102 | } |
| 103 | |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 104 | pw_test("cpp11_test") { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 105 | remove_configs = [ "$dir_pw_build:cpp17" ] |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 106 | configs = [ "$dir_pw_build:cpp11" ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 107 | sources = [ "test.cc" ] |
| 108 | deps = [ ":pw_polyfill" ] |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | pw_test("cpp14_test") { |
Alexei Frolov | 844ff0f | 2020-05-06 12:15:29 -0700 | [diff] [blame] | 112 | remove_configs = [ "$dir_pw_build:cpp17" ] |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 113 | configs = [ "$dir_pw_build:cpp14" ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 114 | sources = [ "test.cc" ] |
| 115 | deps = [ ":pw_polyfill" ] |
Wyatt Hepler | 818e331 | 2020-01-16 14:19:21 -0800 | [diff] [blame] | 116 | } |
| 117 | |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 118 | pw_doc_group("docs") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 119 | sources = [ "docs.rst" ] |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 120 | } |