Kevin Zeng | 84e80e3 | 2021-01-21 11:30:07 -0800 | [diff] [blame] | 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 | |
| 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
| 17 | import("$dir_pw_build/target_types.gni") |
| 18 | import("googletest.gni") |
| 19 | |
| 20 | # This file defines a GN source_set for an external installation of googletest. |
| 21 | # To use, checkout the googletest source into a directory, then set the build |
| 22 | # arg dir_pw_third_party_googletest to point to that directory. The googletest |
| 23 | # library will be available in GN at "$dir_pw_third_party/googletest". |
| 24 | if (dir_pw_third_party_googletest != "") { |
| 25 | config("includes") { |
| 26 | include_dirs = [ |
| 27 | "$dir_pw_third_party_googletest/googletest", |
| 28 | "$dir_pw_third_party_googletest/googletest/include", |
| 29 | "$dir_pw_third_party_googletest/googlemock", |
| 30 | "$dir_pw_third_party_googletest/googlemock/include", |
| 31 | ] |
| 32 | |
| 33 | # Fix some compiler warnings. |
| 34 | cflags = [ "-Wno-undef" ] |
| 35 | } |
| 36 | |
| 37 | pw_source_set("googletest") { |
| 38 | public_configs = [ ":includes" ] |
| 39 | public = [ |
| 40 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock.h", |
| 41 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest.h", |
| 42 | ] |
| 43 | sources = [ |
| 44 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-actions.h", |
| 45 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-cardinalities.h", |
| 46 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-function-mocker.h", |
Kevin Zeng | 84e80e3 | 2021-01-21 11:30:07 -0800 | [diff] [blame] | 47 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-matchers.h", |
| 48 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-more-actions.h", |
| 49 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-more-matchers.h", |
| 50 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-nice-strict.h", |
| 51 | "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-spec-builders.h", |
Rob Mohr | 9045c3f | 2021-06-01 13:48:36 -0700 | [diff] [blame] | 52 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h", |
| 53 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h", |
| 54 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/custom/gmock-port.h", |
Kevin Zeng | 84e80e3 | 2021-01-21 11:30:07 -0800 | [diff] [blame] | 55 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h", |
| 56 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-port.h", |
| 57 | "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-pp.h", |
| 58 | "$dir_pw_third_party_googletest/googlemock/src/gmock-cardinalities.cc", |
| 59 | "$dir_pw_third_party_googletest/googlemock/src/gmock-internal-utils.cc", |
| 60 | "$dir_pw_third_party_googletest/googlemock/src/gmock-matchers.cc", |
| 61 | "$dir_pw_third_party_googletest/googlemock/src/gmock-spec-builders.cc", |
| 62 | "$dir_pw_third_party_googletest/googlemock/src/gmock.cc", |
| 63 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-death-test.h", |
| 64 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-matchers.h", |
| 65 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-message.h", |
| 66 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-param-test.h", |
| 67 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-printers.h", |
| 68 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-spi.h", |
| 69 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-test-part.h", |
| 70 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-typed-test.h", |
| 71 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest_pred_impl.h", |
| 72 | "$dir_pw_third_party_googletest/googletest/include/gtest/gtest_prod.h", |
Rob Mohr | 9045c3f | 2021-06-01 13:48:36 -0700 | [diff] [blame] | 73 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/custom/gtest-port.h", |
| 74 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/custom/gtest-printers.h", |
| 75 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/custom/gtest.h", |
Kevin Zeng | 84e80e3 | 2021-01-21 11:30:07 -0800 | [diff] [blame] | 76 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-death-test-internal.h", |
| 77 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-filepath.h", |
| 78 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-internal.h", |
| 79 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-param-util.h", |
| 80 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-port-arch.h", |
| 81 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-port.h", |
| 82 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-string.h", |
| 83 | "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-type-util.h", |
| 84 | "$dir_pw_third_party_googletest/googletest/src/gtest-death-test.cc", |
| 85 | "$dir_pw_third_party_googletest/googletest/src/gtest-filepath.cc", |
| 86 | "$dir_pw_third_party_googletest/googletest/src/gtest-internal-inl.h", |
| 87 | "$dir_pw_third_party_googletest/googletest/src/gtest-matchers.cc", |
| 88 | "$dir_pw_third_party_googletest/googletest/src/gtest-port.cc", |
| 89 | "$dir_pw_third_party_googletest/googletest/src/gtest-printers.cc", |
| 90 | "$dir_pw_third_party_googletest/googletest/src/gtest-test-part.cc", |
| 91 | "$dir_pw_third_party_googletest/googletest/src/gtest-typed-test.cc", |
| 92 | "$dir_pw_third_party_googletest/googletest/src/gtest.cc", |
| 93 | ] |
| 94 | } |
| 95 | |
| 96 | pw_source_set("gtest_main") { |
| 97 | public_deps = [ ":googletest" ] |
| 98 | sources = [ "$dir_pw_third_party_googletest/googlemock/src/gtest_main.cc" ] |
| 99 | } |
| 100 | |
| 101 | pw_source_set("gmock_main") { |
| 102 | public_deps = [ ":googletest" ] |
| 103 | sources = [ "$dir_pw_third_party_googletest/googlemock/src/gmock_main.cc" ] |
| 104 | } |
| 105 | } else { |
| 106 | group("googletest") { |
| 107 | } |
| 108 | } |