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_rtti_main") { #Add gtest entry with RTTI compilation 105 # option 106 testonly = true 107 sources = [ "googletest/src/gtest_main.cc" ] 108 public_configs = [ ":gtest_config" ] 109 deps = [ ":gtest_rtti" ] 110 configs -= [ "//build/config/coverage:default_coverage" ] 111} 112 113static_library("gtest_main") { 114 testonly = true 115 sources = [ "googletest/src/gtest_main.cc" ] 116 public_configs = [ ":gtest_config" ] 117 deps = [ ":gtest" ] 118 configs -= [ "//build/config/coverage:default_coverage" ] 119} 120 121config("gmock_private_config") { 122 visibility = [ ":*" ] 123 include_dirs = [ "googlemock" ] 124} 125 126config("gmock_private_config_rtti") { 127 visibility = [ ":*" ] 128 include_dirs = [ "googlemock/include" ] 129 cflags = [ "-frtti" ] 130 cflags_objcc = [ "-frtti" ] 131 cflags_cc = [ "-frtti" ] 132} 133 134config("gmock_config") { 135 include_dirs = [ "googlemock/include" ] 136 137 cflags_cc = [ 138 # The MOCK_METHODn() macros do not specify "override", which triggers this 139 # warning in users: "error: 'Method' overrides a member function but is not 140 # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress 141 # these warnings until https://github.com/google/googletest/issues/533 is 142 # fixed. 143 "-Wno-inconsistent-missing-override", 144 ] 145} 146 147gmock_sources_files = [ 148 "googlemock/include/gmock/gmock-actions.h", 149 "googlemock/include/gmock/gmock-cardinalities.h", 150 "googlemock/include/gmock/gmock-function-mocker.h", 151 "googlemock/include/gmock/gmock-matchers.h", 152 "googlemock/include/gmock/gmock-more-actions.h", 153 "googlemock/include/gmock/gmock-more-matchers.h", 154 "googlemock/include/gmock/gmock-nice-strict.h", 155 "googlemock/include/gmock/gmock-spec-builders.h", 156 "googlemock/include/gmock/internal/custom/gmock-generated-actions.h", 157 "googlemock/include/gmock/internal/custom/gmock-matchers.h", 158 "googlemock/include/gmock/internal/custom/gmock-port.h", 159 "googlemock/include/gmock/internal/gmock-internal-utils.h", 160 "googlemock/include/gmock/internal/gmock-port.h", 161 "googlemock/include/gmock/internal/gmock-pp.h", 162 "googlemock/src/gmock-all.cc", 163 "googlemock/src/gmock-cardinalities.cc", 164 "googlemock/src/gmock-internal-utils.cc", 165 "googlemock/src/gmock-matchers.cc", 166 "googlemock/src/gmock-spec-builders.cc", 167 "googlemock/src/gmock.cc", 168] 169 170static_library("gmock") { 171 testonly = true 172 public = [ "googlemock/include/gmock/gmock.h" ] 173 sources = gmock_sources_files 174 sources -= [ "googlemock/src/gmock-all.cc" ] 175 public_configs = [ ":gmock_config" ] 176 configs += [ ":gmock_private_config" ] 177 configs -= [ "//build/config/coverage:default_coverage" ] 178 deps = [ ":gtest" ] 179} 180 181static_library("gmock_rtti") { 182 testonly = true 183 public = [ "googlemock/include/gmock/gmock.h" ] 184 sources = gmock_sources_files 185 sources -= [ "googlemock/src/gmock-all.cc" ] 186 public_configs = [ ":gmock_config" ] 187 configs += [ ":gmock_private_config_rtti" ] 188 configs -= [ "//build/config/coverage:default_coverage" ] 189 deps = [ ":gtest_rtti" ] 190} 191 192static_library("gmock_main") { 193 testonly = true 194 sources = [ "googlemock/src/gmock_main.cc" ] 195 public_configs = [ ":gmock_config", ":gtest_config" ] 196 deps = [ 197 ":gmock", 198 ":gtest", 199 ] 200 configs -= [ "//build/config/coverage:default_coverage" ] 201} 202