1# Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5config("gtest_private_config") { 6 visibility = [ ":*" ] 7 include_dirs = [ "googletest" ] 8} 9 10config("gtest_private_config_rtti") { 11 visibility = [ ":*" ] 12 include_dirs = [ "googletest" ] 13 cflags = [ "-frtti" ] 14 cflags_objcc = [ "-frtti" ] 15 cflags_cc = [ "-frtti" ] 16} 17 18config("gtest_config") { 19 include_dirs = [ "googletest/include" ] 20 cflags_cc = [ 21 "-std=c++17", 22 "-Wno-float-equal", 23 "-Wno-sign-compare", 24 "-Wno-reorder-init-list", 25 ] 26 if (is_mingw) { 27 cflags_cc += [ 28 "-Wno-unused-const-variable", 29 "-Wno-unused-private-field", 30 ] 31 } 32} 33 34sources_files = [ 35 "googletest/include/gtest/gtest-death-test.h", 36 "googletest/include/gtest/gtest-matchers.h", 37 "googletest/include/gtest/gtest-message.h", 38 "googletest/include/gtest/gtest-param-test.h", 39 "googletest/include/gtest/gtest-printers.h", 40 "googletest/include/gtest/gtest-test-part.h", 41 "googletest/include/gtest/gtest-typed-test.h", 42 "googletest/include/gtest/gtest_pred_impl.h", 43 "googletest/include/gtest/gtest_prod.h", 44 "googletest/include/gtest/hwext/gtest-ext.h", 45 "googletest/include/gtest/hwext/gtest-filter.h", 46 "googletest/include/gtest/hwext/gtest-multithread.h", 47 "googletest/include/gtest/hwext/gtest-tag.h", 48 "googletest/include/gtest/hwext/utils.h", 49 "googletest/include/gtest/internal/custom/gtest-port.h", 50 "googletest/include/gtest/internal/custom/gtest-printers.h", 51 "googletest/include/gtest/internal/custom/gtest.h", 52 "googletest/include/gtest/internal/gtest-death-test-internal.h", 53 "googletest/include/gtest/internal/gtest-filepath.h", 54 "googletest/include/gtest/internal/gtest-internal.h", 55 "googletest/include/gtest/internal/gtest-param-util.h", 56 "googletest/include/gtest/internal/gtest-port-arch.h", 57 "googletest/include/gtest/internal/gtest-port.h", 58 "googletest/include/gtest/internal/gtest-string.h", 59 "googletest/include/gtest/internal/gtest-type-util.h", 60 "googletest/src/gtest-all.cc", 61 "googletest/src/gtest-assertion-result.cc", 62 "googletest/src/gtest-death-test.cc", 63 "googletest/src/gtest-filepath.cc", 64 "googletest/src/gtest-internal-inl.h", 65 "googletest/src/gtest-matchers.cc", 66 "googletest/src/gtest-port.cc", 67 "googletest/src/gtest-printers.cc", 68 "googletest/src/gtest-test-part.cc", 69 "googletest/src/gtest-typed-test.cc", 70 "googletest/src/gtest.cc", 71 "googletest/src/hwext/gtest-ext.cc", 72 "googletest/src/hwext/gtest-filter.cc", 73 "googletest/src/hwext/gtest-multithread.cpp", 74 "googletest/src/hwext/gtest-tag.cc", 75 "googletest/src/hwext/gtest-utils.cc", 76] 77 78static_library("gtest") { 79 testonly = true 80 public = [ 81 "googletest/include/gtest/gtest-spi.h", 82 "googletest/include/gtest/gtest.h", 83 ] 84 sources = sources_files 85 sources -= [ "googletest/src/gtest-all.cc" ] 86 public_configs = [ ":gtest_config" ] 87 configs += [ ":gtest_private_config" ] 88 configs -= [ "//build/config/coverage:default_coverage" ] 89} 90 91static_library("gtest_rtti") { 92 testonly = true 93 public = [ 94 "googletest/include/gtest/gtest-spi.h", 95 "googletest/include/gtest/gtest.h", 96 ] 97 sources = sources_files 98 sources -= [ "googletest/src/gtest-all.cc" ] 99 public_configs = [ ":gtest_config" ] 100 configs += [ ":gtest_private_config_rtti" ] 101 configs -= [ "//build/config/coverage:default_coverage" ] 102} 103 104static_library("gtest_main") { 105 testonly = true 106 sources = [ "googletest/src/gtest_main.cc" ] 107 public_deps = [ ":gtest" ] 108 configs -= [ "//build/config/coverage:default_coverage" ] 109} 110 111config("gmock_private_config") { 112 visibility = [ ":*" ] 113 include_dirs = [ "googlemock" ] 114} 115 116config("gmock_private_config_rtti") { 117 visibility = [ ":*" ] 118 include_dirs = [ "googlemock/include" ] 119 cflags = [ "-frtti" ] 120 cflags_objcc = [ "-frtti" ] 121 cflags_cc = [ "-frtti" ] 122} 123 124config("gmock_config") { 125 include_dirs = [ "googlemock/include" ] 126 127 cflags_cc = [ 128 # The MOCK_METHODn() macros do not specify "override", which triggers this 129 # warning in users: "error: 'Method' overrides a member function but is not 130 # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress 131 # these warnings until https://github.com/google/googletest/issues/533 is 132 # fixed. 133 "-Wno-inconsistent-missing-override", 134 ] 135} 136 137gmock_sources_files = [ 138 "googlemock/include/gmock/gmock-actions.h", 139 "googlemock/include/gmock/gmock-cardinalities.h", 140 "googlemock/include/gmock/gmock-function-mocker.h", 141 "googlemock/include/gmock/gmock-matchers.h", 142 "googlemock/include/gmock/gmock-more-actions.h", 143 "googlemock/include/gmock/gmock-more-matchers.h", 144 "googlemock/include/gmock/gmock-nice-strict.h", 145 "googlemock/include/gmock/gmock-spec-builders.h", 146 "googlemock/include/gmock/internal/custom/gmock-generated-actions.h", 147 "googlemock/include/gmock/internal/custom/gmock-matchers.h", 148 "googlemock/include/gmock/internal/custom/gmock-port.h", 149 "googlemock/include/gmock/internal/gmock-internal-utils.h", 150 "googlemock/include/gmock/internal/gmock-port.h", 151 "googlemock/include/gmock/internal/gmock-pp.h", 152 "googlemock/src/gmock-all.cc", 153 "googlemock/src/gmock-cardinalities.cc", 154 "googlemock/src/gmock-internal-utils.cc", 155 "googlemock/src/gmock-matchers.cc", 156 "googlemock/src/gmock-spec-builders.cc", 157 "googlemock/src/gmock.cc", 158] 159 160static_library("gmock") { 161 testonly = true 162 public = [ "googlemock/include/gmock/gmock.h" ] 163 sources = gmock_sources_files 164 sources -= [ "googlemock/src/gmock-all.cc" ] 165 public_configs = [ ":gmock_config" ] 166 configs += [ ":gmock_private_config" ] 167 configs -= [ "//build/config/coverage:default_coverage" ] 168 deps = [ ":gtest" ] 169} 170 171static_library("gmock_rtti") { 172 testonly = true 173 public = [ "googlemock/include/gmock/gmock.h" ] 174 sources = gmock_sources_files 175 sources -= [ "googlemock/src/gmock-all.cc" ] 176 public_configs = [ ":gmock_config" ] 177 configs += [ ":gmock_private_config_rtti" ] 178 configs -= [ "//build/config/coverage:default_coverage" ] 179 deps = [ ":gtest_rtti" ] 180} 181 182static_library("gmock_main") { 183 testonly = true 184 sources = [ "googlemock/src/gmock_main.cc" ] 185 public_deps = [ 186 ":gmock", 187 ":gtest", 188 ] 189 configs -= [ "//build/config/coverage:default_coverage" ] 190} 191