• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14config("gtest_private_config") {
15  visibility = [ ":*" ]
16  include_dirs = [ "googletest" ]
17}
18
19config("gtest_config") {
20  include_dirs = [ "googletest/include" ]
21}
22
23static_library("gtest") {
24  testonly = true
25  public = [
26    "googletest/include/gtest/gtest-spi.h",
27    "googletest/include/gtest/gtest.h",
28  ]
29
30  cflags = [
31    "-Wno-inconsistent-missing-override",
32
33    # "-Dprivate=public",  #allow test code access private members
34    "-fprofile-arcs",
35    "-ftest-coverage",
36    "-Wno-unused-command-line-argument",
37    "-Wno-format",
38    "-Wno-unused-const-variable",
39    "-Wno-unused-variable",
40    "-Wno-used-but-marked-unused",
41    "-Wno-exit-time-destructors",
42    "-Wno-missing-noreturn",
43    "-Wno-missing-noreturn",
44  ]
45  sources = [
46    "googletest/include/gtest/gtest-death-test.h",
47    "googletest/include/gtest/gtest-message.h",
48    "googletest/include/gtest/gtest-param-test.h",
49    "googletest/include/gtest/gtest-printers.h",
50    "googletest/include/gtest/gtest-test-part.h",
51    "googletest/include/gtest/gtest-typed-test.h",
52    "googletest/include/gtest/gtest_pred_impl.h",
53    "googletest/include/gtest/gtest_prod.h",
54    "googletest/include/gtest/hwext/gtest-ext.h",
55    "googletest/include/gtest/hwext/gtest-filter.h",
56    "googletest/include/gtest/hwext/gtest-tag.h",
57    "googletest/include/gtest/hwext/utils.h",
58    "googletest/include/gtest/internal/custom/gtest-port.h",
59    "googletest/include/gtest/internal/custom/gtest-printers.h",
60    "googletest/include/gtest/internal/custom/gtest.h",
61    "googletest/include/gtest/internal/gtest-death-test-internal.h",
62    "googletest/include/gtest/internal/gtest-filepath.h",
63    "googletest/include/gtest/internal/gtest-internal.h",
64    "googletest/include/gtest/internal/gtest-linked_ptr.h",
65    "googletest/include/gtest/internal/gtest-param-util-generated.h",
66    "googletest/include/gtest/internal/gtest-param-util.h",
67    "googletest/include/gtest/internal/gtest-port-arch.h",
68    "googletest/include/gtest/internal/gtest-port.h",
69    "googletest/include/gtest/internal/gtest-string.h",
70    "googletest/include/gtest/internal/gtest-tuple.h",
71    "googletest/include/gtest/internal/gtest-type-util.h",
72    "googletest/src/gtest-all.cc",
73    "googletest/src/gtest-death-test.cc",
74    "googletest/src/gtest-filepath.cc",
75    "googletest/src/gtest-internal-inl.h",
76    "googletest/src/gtest-port.cc",
77    "googletest/src/gtest-printers.cc",
78    "googletest/src/gtest-test-part.cc",
79    "googletest/src/gtest-typed-test.cc",
80    "googletest/src/gtest.cc",
81    "googletest/src/hwext/gtest-ext.cc",
82    "googletest/src/hwext/gtest-filter.cc",
83    "googletest/src/hwext/gtest-tag.cc",
84    "googletest/src/hwext/gtest-utils.cc",
85  ]
86  sources -= [ "googletest/src/gtest-all.cc" ]
87  public_configs = [ ":gtest_config" ]
88  configs += [ ":gtest_private_config" ]
89
90  #  configs -= ["//build/config/coverage:default_coverage"]
91}
92
93static_library("gtest_main") {
94  testonly = true
95  sources = [ "googletest/src/gtest_main.cc" ]
96
97  cflags = [
98    "-Wno-inconsistent-missing-override",
99
100    #  "-Dprivate=public",  #allow test code access private members
101    "-fprofile-arcs",
102    "-ftest-coverage",
103    "-Wno-unused-command-line-argument",
104    "-Wno-format",
105    "-Wno-unused-const-variable",
106    "-Wno-unused-variable",
107    "-Wno-used-but-marked-unused",
108    "-Wno-exit-time-destructors",
109    "-Wno-missing-noreturn",
110  ]
111  public_deps = [ ":gtest" ]
112
113  #  configs -= ["//build/config/coverage:default_coverage"]
114}
115
116config("gmock_private_config") {
117  visibility = [ ":*" ]
118  include_dirs = [ "googlemock" ]
119}
120
121config("gmock_config") {
122  include_dirs = [ "googlemock/include" ]
123
124  cflags_cc = [
125    # The MOCK_METHODn() macros do not specify "override", which triggers this
126    # warning in users: "error: 'Method' overrides a member function but is not
127    # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress
128    # these warnings until https://github.com/google/googletest/issues/533 is
129    # fixed.
130    "-Wno-inconsistent-missing-override",
131  ]
132  cflags = [
133    "-Wno-inconsistent-missing-override",
134
135    #  "-Dprivate=public",  #allow test code access private members
136    "-fprofile-arcs",
137    "-ftest-coverage",
138    "-Wno-unused-command-line-argument",
139    "-Wno-format",
140    "-Wno-unused-const-variable",
141    "-Wno-unused-variable",
142    "-Wno-used-but-marked-unused",
143    "-Wno-exit-time-destructors",
144    "-Wno-missing-noreturn",
145  ]
146}
147
148static_library("gmock") {
149  testonly = true
150  public = [ "googlemock/include/gmock/gmock.h" ]
151  cflags = [
152    "-Wno-inconsistent-missing-override",
153
154    #    "-Dprivate=public",  #allow test code access private members
155    "-fprofile-arcs",
156    "-ftest-coverage",
157    "-Wno-unused-command-line-argument",
158    "-Wno-format",
159    "-Wno-unused-const-variable",
160    "-Wno-unused-variable",
161    "-Wno-used-but-marked-unused",
162    "-Wno-exit-time-destructors",
163    "-Wno-missing-noreturn",
164  ]
165  sources = [
166    "googlemock/include/gmock/gmock-actions.h",
167    "googlemock/include/gmock/gmock-cardinalities.h",
168    "googlemock/include/gmock/gmock-generated-actions.h",
169    "googlemock/include/gmock/gmock-generated-function-mockers.h",
170    "googlemock/include/gmock/gmock-generated-matchers.h",
171    "googlemock/include/gmock/gmock-generated-nice-strict.h",
172    "googlemock/include/gmock/gmock-matchers.h",
173    "googlemock/include/gmock/gmock-more-actions.h",
174    "googlemock/include/gmock/gmock-more-matchers.h",
175    "googlemock/include/gmock/gmock-spec-builders.h",
176    "googlemock/include/gmock/internal/custom/gmock-generated-actions.h",
177    "googlemock/include/gmock/internal/custom/gmock-matchers.h",
178    "googlemock/include/gmock/internal/custom/gmock-port.h",
179    "googlemock/include/gmock/internal/gmock-generated-internal-utils.h",
180    "googlemock/include/gmock/internal/gmock-internal-utils.h",
181    "googlemock/include/gmock/internal/gmock-port.h",
182    "googlemock/src/gmock-all.cc",
183    "googlemock/src/gmock-cardinalities.cc",
184    "googlemock/src/gmock-internal-utils.cc",
185    "googlemock/src/gmock-matchers.cc",
186    "googlemock/src/gmock-spec-builders.cc",
187    "googlemock/src/gmock.cc",
188  ]
189  sources -= [ "googlemock/src/gmock-all.cc" ]
190  public_configs = [ ":gmock_config" ]
191  configs += [ ":gmock_private_config" ]
192
193  #  configs -= ["//build/config/coverage:default_coverage"]
194  deps = [ ":gtest" ]
195}
196
197static_library("gmock_main") {
198  testonly = true
199
200  cflags = [
201    "-Wno-inconsistent-missing-override",
202
203    #    "-Dprivate=public",  #allow test code access private members
204    "-fprofile-arcs",
205    "-ftest-coverage",
206    "-Wno-unused-command-line-argument",
207    "-Wno-format",
208    "-Wno-unused-const-variable",
209    "-Wno-unused-variable",
210    "-Wno-used-but-marked-unused",
211    "-Wno-exit-time-destructors",
212    "-Wno-missing-noreturn",
213  ]
214  sources = [ "googlemock/src/gmock_main.cc" ]
215  public_deps = [
216    ":gmock",
217    ":gtest",
218  ]
219
220  #  configs -= ["//build/config/coverage:default_coverage"]
221}
222