• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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
14googletest_dir = "//third_party/googletest/googletest"
15googlemock_dir = "//third_party/googletest/googlemock"
16
17config("gtest_private_config") {
18  visibility = [ ":*" ]
19  include_dirs = [ "$googletest_dir" ]
20}
21
22config("gtest_config") {
23  include_dirs = [ "$googletest_dir/include" ]
24  if (is_mingw) {
25    cflags_cc = [
26      "-Wno-unused-const-variable",
27      "-Wno-unused-private-field",
28    ]
29  }
30}
31
32static_library("gtest") {
33  testonly = true
34  public = [
35    "$googletest_dir/include/gtest/gtest-spi.h",
36    "$googletest_dir/include/gtest/gtest.h",
37  ]
38  sources = [
39    "$googletest_dir/include/gtest/gtest-death-test.h",
40    "$googletest_dir/include/gtest/gtest-matchers.h",
41    "$googletest_dir/include/gtest/gtest-message.h",
42    "$googletest_dir/include/gtest/gtest-param-test.h",
43    "$googletest_dir/include/gtest/gtest-printers.h",
44    "$googletest_dir/include/gtest/gtest-test-part.h",
45    "$googletest_dir/include/gtest/gtest-typed-test.h",
46    "$googletest_dir/include/gtest/gtest_pred_impl.h",
47    "$googletest_dir/include/gtest/gtest_prod.h",
48    "$googletest_dir/include/gtest/hwext/gtest-ext.h",
49    "$googletest_dir/include/gtest/hwext/gtest-filter.h",
50    "$googletest_dir/include/gtest/hwext/gtest-tag.h",
51    "$googletest_dir/include/gtest/hwext/utils.h",
52    "$googletest_dir/include/gtest/internal/custom/gtest-port.h",
53    "$googletest_dir/include/gtest/internal/custom/gtest-printers.h",
54    "$googletest_dir/include/gtest/internal/custom/gtest.h",
55    "$googletest_dir/include/gtest/internal/gtest-death-test-internal.h",
56    "$googletest_dir/include/gtest/internal/gtest-filepath.h",
57    "$googletest_dir/include/gtest/internal/gtest-internal.h",
58    "$googletest_dir/include/gtest/internal/gtest-param-util.h",
59    "$googletest_dir/include/gtest/internal/gtest-port-arch.h",
60    "$googletest_dir/include/gtest/internal/gtest-port.h",
61    "$googletest_dir/include/gtest/internal/gtest-string.h",
62    "$googletest_dir/include/gtest/internal/gtest-type-util.h",
63    "$googletest_dir/src/gtest-all.cc",
64    "$googletest_dir/src/gtest-death-test.cc",
65    "$googletest_dir/src/gtest-filepath.cc",
66    "$googletest_dir/src/gtest-internal-inl.h",
67    "$googletest_dir/src/gtest-matchers.cc",
68    "$googletest_dir/src/gtest-port.cc",
69    "$googletest_dir/src/gtest-printers.cc",
70    "$googletest_dir/src/gtest-test-part.cc",
71    "$googletest_dir/src/gtest-typed-test.cc",
72    "$googletest_dir/src/gtest.cc",
73    "$googletest_dir/src/hwext/gtest-ext.cc",
74    "$googletest_dir/src/hwext/gtest-filter.cc",
75    "$googletest_dir/src/hwext/gtest-tag.cc",
76    "$googletest_dir/src/hwext/gtest-utils.cc",
77  ]
78  sources -= [ "$googletest_dir/src/gtest-all.cc" ]
79  public_configs = [ ":gtest_config" ]
80  configs += [ ":gtest_private_config" ]
81}
82
83static_library("gtest_main") {
84  testonly = true
85  sources = [ "$googletest_dir/src/gtest_main.cc" ]
86  public_deps = [ ":gtest" ]
87}
88
89config("gmock_private_config") {
90  visibility = [ ":*" ]
91  include_dirs = [ "$googlemock_dir" ]
92}
93
94config("gmock_config") {
95  include_dirs = [ "$googlemock_dir/include" ]
96
97  cflags_cc = [
98    # The MOCK_METHODn() macros do not specify "override", which triggers this
99    # warning in users: "error: 'Method' overrides a member function but is not
100    # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress
101    # these warnings until https://github.com/google/googletest/issues/533 is
102    # fixed.
103    "-Wno-inconsistent-missing-override",
104  ]
105}
106
107static_library("gmock") {
108  testonly = true
109  public = [ "$googlemock_dir/include/gmock/gmock.h" ]
110  sources = [
111    "$googlemock_dir/include/gmock/gmock-actions.h",
112    "$googlemock_dir/include/gmock/gmock-cardinalities.h",
113    "$googlemock_dir/include/gmock/gmock-function-mocker.h",
114    "$googlemock_dir/include/gmock/gmock-matchers.h",
115    "$googlemock_dir/include/gmock/gmock-more-actions.h",
116    "$googlemock_dir/include/gmock/gmock-more-matchers.h",
117    "$googlemock_dir/include/gmock/gmock-nice-strict.h",
118    "$googlemock_dir/include/gmock/gmock-spec-builders.h",
119    "$googlemock_dir/include/gmock/internal/custom/gmock-generated-actions.h",
120    "$googlemock_dir/include/gmock/internal/custom/gmock-matchers.h",
121    "$googlemock_dir/include/gmock/internal/custom/gmock-port.h",
122    "$googlemock_dir/include/gmock/internal/gmock-internal-utils.h",
123    "$googlemock_dir/include/gmock/internal/gmock-port.h",
124    "$googlemock_dir/include/gmock/internal/gmock-pp.h",
125    "$googlemock_dir/src/gmock-all.cc",
126    "$googlemock_dir/src/gmock-cardinalities.cc",
127    "$googlemock_dir/src/gmock-internal-utils.cc",
128    "$googlemock_dir/src/gmock-matchers.cc",
129    "$googlemock_dir/src/gmock-spec-builders.cc",
130    "$googlemock_dir/src/gmock.cc",
131  ]
132  sources -= [ "$googlemock_dir/src/gmock-all.cc" ]
133  public_configs = [ ":gmock_config" ]
134  configs += [ ":gmock_private_config" ]
135  deps = [ ":gtest" ]
136}
137
138static_library("gmock_main") {
139  testonly = true
140  sources = [ "$googlemock_dir/src/gmock_main.cc" ]
141  public_deps = [
142    ":gmock",
143    ":gtest",
144  ]
145}
146