1 # Copyright 2021 The Pigweed Authors
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
7 # https://www.apache.org/licenses/LICENSE-2.0
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
15 import("//build_overrides/pigweed.gni")
17 import("$dir_pw_build/target_types.gni")
18 import("googletest.gni")
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 != "") {
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",
33 # Fix some compiler warnings.
34 cflags = [ "-Wno-undef" ]
37 pw_source_set("googletest") {
38 public_configs = [ ":includes" ]
40 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock.h",
41 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest.h",
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",
47 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-generated-actions.h",
48 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-matchers.h",
49 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-more-actions.h",
50 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-more-matchers.h",
51 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-nice-strict.h",
52 "$dir_pw_third_party_googletest/googlemock/include/gmock/gmock-spec-builders.h",
53 "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-internal-utils.h",
54 "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-port.h",
55 "$dir_pw_third_party_googletest/googlemock/include/gmock/internal/gmock-pp.h",
56 "$dir_pw_third_party_googletest/googlemock/src/gmock-cardinalities.cc",
57 "$dir_pw_third_party_googletest/googlemock/src/gmock-internal-utils.cc",
58 "$dir_pw_third_party_googletest/googlemock/src/gmock-matchers.cc",
59 "$dir_pw_third_party_googletest/googlemock/src/gmock-spec-builders.cc",
60 "$dir_pw_third_party_googletest/googlemock/src/gmock.cc",
61 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-death-test.h",
62 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-matchers.h",
63 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-message.h",
64 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-param-test.h",
65 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-printers.h",
66 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-spi.h",
67 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-test-part.h",
68 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest-typed-test.h",
69 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest_pred_impl.h",
70 "$dir_pw_third_party_googletest/googletest/include/gtest/gtest_prod.h",
71 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-death-test-internal.h",
72 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-filepath.h",
73 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-internal.h",
74 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-param-util.h",
75 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-port-arch.h",
76 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-port.h",
77 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-string.h",
78 "$dir_pw_third_party_googletest/googletest/include/gtest/internal/gtest-type-util.h",
79 "$dir_pw_third_party_googletest/googletest/src/gtest-death-test.cc",
80 "$dir_pw_third_party_googletest/googletest/src/gtest-filepath.cc",
81 "$dir_pw_third_party_googletest/googletest/src/gtest-internal-inl.h",
82 "$dir_pw_third_party_googletest/googletest/src/gtest-matchers.cc",
83 "$dir_pw_third_party_googletest/googletest/src/gtest-port.cc",
84 "$dir_pw_third_party_googletest/googletest/src/gtest-printers.cc",
85 "$dir_pw_third_party_googletest/googletest/src/gtest-test-part.cc",
86 "$dir_pw_third_party_googletest/googletest/src/gtest-typed-test.cc",
87 "$dir_pw_third_party_googletest/googletest/src/gtest.cc",
91 pw_source_set("gtest_main") {
92 public_deps = [ ":googletest" ]
93 sources = [ "$dir_pw_third_party_googletest/googlemock/src/gtest_main.cc" ]
96 pw_source_set("gmock_main") {
97 public_deps = [ ":googletest" ]
98 sources = [ "$dir_pw_third_party_googletest/googlemock/src/gmock_main.cc" ]
101 group("googletest") {