# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. googletest_dir = "//third_party/googletest/googletest" googlemock_dir = "//third_party/googletest/googlemock" config("gtest_private_config") { visibility = [ ":*" ] include_dirs = [ "$googletest_dir" ] } config("gtest_config") { include_dirs = [ "$googletest_dir/include" ] if (is_mingw) { cflags_cc = [ "-Wno-unused-const-variable", "-Wno-unused-private-field", ] } } static_library("gtest") { testonly = true public = [ "$googletest_dir/include/gtest/gtest-spi.h", "$googletest_dir/include/gtest/gtest.h", ] sources = [ "$googletest_dir/include/gtest/gtest-death-test.h", "$googletest_dir/include/gtest/gtest-matchers.h", "$googletest_dir/include/gtest/gtest-message.h", "$googletest_dir/include/gtest/gtest-param-test.h", "$googletest_dir/include/gtest/gtest-printers.h", "$googletest_dir/include/gtest/gtest-test-part.h", "$googletest_dir/include/gtest/gtest-typed-test.h", "$googletest_dir/include/gtest/gtest_pred_impl.h", "$googletest_dir/include/gtest/gtest_prod.h", "$googletest_dir/include/gtest/hwext/gtest-ext.h", "$googletest_dir/include/gtest/hwext/gtest-filter.h", "$googletest_dir/include/gtest/hwext/gtest-tag.h", "$googletest_dir/include/gtest/hwext/utils.h", "$googletest_dir/include/gtest/internal/custom/gtest-port.h", "$googletest_dir/include/gtest/internal/custom/gtest-printers.h", "$googletest_dir/include/gtest/internal/custom/gtest.h", "$googletest_dir/include/gtest/internal/gtest-death-test-internal.h", "$googletest_dir/include/gtest/internal/gtest-filepath.h", "$googletest_dir/include/gtest/internal/gtest-internal.h", "$googletest_dir/include/gtest/internal/gtest-param-util.h", "$googletest_dir/include/gtest/internal/gtest-port-arch.h", "$googletest_dir/include/gtest/internal/gtest-port.h", "$googletest_dir/include/gtest/internal/gtest-string.h", "$googletest_dir/include/gtest/internal/gtest-type-util.h", "$googletest_dir/src/gtest-all.cc", "$googletest_dir/src/gtest-death-test.cc", "$googletest_dir/src/gtest-filepath.cc", "$googletest_dir/src/gtest-internal-inl.h", "$googletest_dir/src/gtest-matchers.cc", "$googletest_dir/src/gtest-port.cc", "$googletest_dir/src/gtest-printers.cc", "$googletest_dir/src/gtest-test-part.cc", "$googletest_dir/src/gtest-typed-test.cc", "$googletest_dir/src/gtest.cc", "$googletest_dir/src/hwext/gtest-ext.cc", "$googletest_dir/src/hwext/gtest-filter.cc", "$googletest_dir/src/hwext/gtest-tag.cc", "$googletest_dir/src/hwext/gtest-utils.cc", ] sources -= [ "$googletest_dir/src/gtest-all.cc" ] public_configs = [ ":gtest_config" ] configs += [ ":gtest_private_config" ] } static_library("gtest_main") { testonly = true sources = [ "$googletest_dir/src/gtest_main.cc" ] public_deps = [ ":gtest" ] } config("gmock_private_config") { visibility = [ ":*" ] include_dirs = [ "$googlemock_dir" ] } config("gmock_config") { include_dirs = [ "$googlemock_dir/include" ] cflags_cc = [ # The MOCK_METHODn() macros do not specify "override", which triggers this # warning in users: "error: 'Method' overrides a member function but is not # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress # these warnings until https://github.com/google/googletest/issues/533 is # fixed. "-Wno-inconsistent-missing-override", ] } static_library("gmock") { testonly = true public = [ "$googlemock_dir/include/gmock/gmock.h" ] sources = [ "$googlemock_dir/include/gmock/gmock-actions.h", "$googlemock_dir/include/gmock/gmock-cardinalities.h", "$googlemock_dir/include/gmock/gmock-function-mocker.h", "$googlemock_dir/include/gmock/gmock-matchers.h", "$googlemock_dir/include/gmock/gmock-more-actions.h", "$googlemock_dir/include/gmock/gmock-more-matchers.h", "$googlemock_dir/include/gmock/gmock-nice-strict.h", "$googlemock_dir/include/gmock/gmock-spec-builders.h", "$googlemock_dir/include/gmock/internal/custom/gmock-generated-actions.h", "$googlemock_dir/include/gmock/internal/custom/gmock-matchers.h", "$googlemock_dir/include/gmock/internal/custom/gmock-port.h", "$googlemock_dir/include/gmock/internal/gmock-internal-utils.h", "$googlemock_dir/include/gmock/internal/gmock-port.h", "$googlemock_dir/include/gmock/internal/gmock-pp.h", "$googlemock_dir/src/gmock-all.cc", "$googlemock_dir/src/gmock-cardinalities.cc", "$googlemock_dir/src/gmock-internal-utils.cc", "$googlemock_dir/src/gmock-matchers.cc", "$googlemock_dir/src/gmock-spec-builders.cc", "$googlemock_dir/src/gmock.cc", ] sources -= [ "$googlemock_dir/src/gmock-all.cc" ] public_configs = [ ":gmock_config" ] configs += [ ":gmock_private_config" ] deps = [ ":gtest" ] } static_library("gmock_main") { testonly = true sources = [ "$googlemock_dir/src/gmock_main.cc" ] public_deps = [ ":gmock", ":gtest", ] }