BUILD.gn (10990B)
1 config("gtest_private_config") { 2 visibility = [ ":*" ] 3 include_dirs = [ "googletest" ] 4 cflags_cc = [ 5 "-Wno-covered-switch-default", 6 "-Wno-deprecated", 7 "-Wno-double-promotion", 8 "-Wno-exit-time-destructors", 9 "-Wno-float-equal", 10 "-Wno-gnu-zero-variadic-macro-arguments", 11 "-Wno-missing-prototypes", 12 "-Wno-missing-variable-declarations", 13 "-Wno-old-style-cast", 14 "-Wno-sign-conversion", 15 "-Wno-switch-enum", 16 "-Wno-unreachable-code-break", 17 "-Wno-unused-member-function", 18 "-Wno-unused-private-field", 19 "-Wno-unused-template", 20 "-Wno-used-but-marked-unused", 21 "-Wno-zero-as-null-pointer-constant", 22 "-Wno-extra-semi-stmt", 23 ] 24 ldflags = [ "-lpthread" ] 25 } 26 27 config("gtest_config") { 28 include_dirs = [ "googletest/include" ] 29 cflags_cc = [ 30 "-Wno-global-constructors", 31 "-Wno-missing-noreturn", 32 "-Wno-padded", 33 "-Wno-shift-sign-overflow", 34 "-Wno-thread-safety", # googletest lacks locking annotations. 35 "-Wno-undef", 36 "-Wno-weak-vtables", 37 ] 38 ldflags = [ "-lpthread" ] 39 } 40 41 source_set("gtest_internal_headers") { 42 visibility = [ ":*" ] 43 testonly = true 44 sources = [ 45 "googletest/include/gtest/gtest-assertion-result.h", 46 "googletest/include/gtest/gtest-death-test.h", 47 "googletest/include/gtest/gtest-matchers.h", 48 "googletest/include/gtest/gtest-message.h", 49 "googletest/include/gtest/gtest-param-test.h", 50 "googletest/include/gtest/gtest-printers.h", 51 "googletest/include/gtest/gtest-spi.h", 52 "googletest/include/gtest/gtest-test-part.h", 53 "googletest/include/gtest/gtest-typed-test.h", 54 "googletest/include/gtest/gtest_pred_impl.h", 55 "googletest/include/gtest/gtest_prod.h", 56 "googletest/include/gtest/internal/custom/gtest-port.h", 57 "googletest/include/gtest/internal/custom/gtest-printers.h", 58 "googletest/include/gtest/internal/custom/gtest.h", 59 "googletest/include/gtest/internal/gtest-death-test-internal.h", 60 "googletest/include/gtest/internal/gtest-filepath.h", 61 "googletest/include/gtest/internal/gtest-internal.h", 62 "googletest/include/gtest/internal/gtest-param-util.h", 63 "googletest/include/gtest/internal/gtest-port-arch.h", 64 "googletest/include/gtest/internal/gtest-port.h", 65 "googletest/include/gtest/internal/gtest-string.h", 66 "googletest/include/gtest/internal/gtest-type-util.h", 67 "googletest/src/gtest-internal-inl.h", 68 ] 69 } 70 71 source_set("gtest_test_headers") { 72 visibility = [ ":*" ] 73 testonly = true 74 sources = [ "googletest/include/gtest/gtest-spi.h" ] 75 } 76 77 static_library("gtest") { 78 testonly = true 79 public = [ "googletest/include/gtest/gtest.h" ] 80 sources = [ 81 "googletest/src/gtest-all.cc", 82 "googletest/src/gtest-assertion-result.cc", 83 "googletest/src/gtest-death-test.cc", 84 "googletest/src/gtest-filepath.cc", 85 "googletest/src/gtest-matchers.cc", 86 "googletest/src/gtest-port.cc", 87 "googletest/src/gtest-printers.cc", 88 "googletest/src/gtest-test-part.cc", 89 "googletest/src/gtest-typed-test.cc", 90 "googletest/src/gtest.cc", 91 ] 92 sources -= [ "googletest/src/gtest-all.cc" ] 93 public_configs = [ ":gtest_config" ] 94 configs += [ ":gtest_private_config" ] 95 deps = [ 96 ":gtest_internal_headers", 97 ":gtest_test_headers", 98 ] 99 } 100 101 static_library("gtest_main") { 102 testonly = true 103 sources = [ "googletest/src/gtest_main.cc" ] 104 public_deps = [ ":gtest" ] 105 } 106 107 executable("gtest_all_test") { 108 testonly = true 109 sources = [ 110 "googletest/test/googletest-death-test-test.cc", 111 "googletest/test/googletest-filepath-test.cc", 112 "googletest/test/googletest-message-test.cc", 113 "googletest/test/googletest-options-test.cc", 114 "googletest/test/googletest-param-test2-test.cc", 115 "googletest/test/googletest-port-test.cc", 116 "googletest/test/googletest-printers-test.cc", 117 "googletest/test/googletest-test-part-test.cc", 118 "googletest/test/gtest-typed-test2_test.cc", 119 "googletest/test/gtest-typed-test_test.cc", 120 "googletest/test/gtest_dirs_test.cc", 121 "googletest/test/gtest_main_unittest.cc", 122 "googletest/test/gtest_pred_impl_unittest.cc", 123 "googletest/test/gtest_skip_test.cc", 124 "googletest/test/gtest_sole_header_test.cc", 125 "googletest/test/gtest_unittest.cc", 126 ] 127 configs += [ ":gtest_private_config" ] 128 deps = [ 129 ":gtest", 130 ":gtest_internal_headers", 131 ":gtest_main", 132 ":gtest_test_headers", 133 ] 134 } 135 136 executable("gtest_environment_test") { 137 testonly = true 138 sources = [ "googletest/test/gtest_environment_test.cc" ] 139 configs += [ ":gtest_private_config" ] 140 deps = [ 141 ":gtest", 142 ":gtest_internal_headers", 143 ] 144 } 145 146 executable("gtest_listener_test") { 147 testonly = true 148 sources = [ "googletest/test/googletest-listener-test.cc" ] 149 deps = [ ":gtest" ] 150 cflags_cc = [ 151 "-Wno-missing-prototypes", 152 "-Wno-missing-variable-declarations", 153 ] 154 } 155 156 executable("gtest_no_test") { 157 testonly = true 158 sources = [ "googletest/test/gtest_no_test_unittest.cc" ] 159 deps = [ ":gtest" ] 160 } 161 162 executable("gtest_param_test") { 163 testonly = true 164 sources = [ 165 "googletest/test/googletest-param-test-test.cc", 166 "googletest/test/googletest-param-test-test.h", 167 "googletest/test/googletest-param-test2-test.cc", 168 ] 169 configs += [ ":gtest_private_config" ] 170 deps = [ ":gtest" ] 171 } 172 173 executable("gtest_premature_exit_test") { 174 testonly = true 175 sources = [ "googletest/test/gtest_premature_exit_test.cc" ] 176 configs += [ ":gtest_private_config" ] 177 deps = [ ":gtest" ] 178 } 179 180 executable("gtest_repeat_test") { 181 testonly = true 182 sources = [ "googletest/test/gtest_repeat_test.cc" ] 183 configs += [ ":gtest_private_config" ] 184 deps = [ 185 ":gtest", 186 ":gtest_internal_headers", 187 ] 188 } 189 190 executable("gtest_sole_header_test") { 191 testonly = true 192 sources = [ "googletest/test/gtest_sole_header_test.cc" ] 193 deps = [ 194 ":gtest", 195 ":gtest_main", 196 ] 197 } 198 199 executable("gtest_stress_test") { 200 testonly = true 201 sources = [ "googletest/test/gtest_stress_test.cc" ] 202 configs += [ ":gtest_private_config" ] 203 deps = [ 204 ":gtest", 205 ":gtest_internal_headers", 206 ] 207 } 208 209 executable("gtest_unittest_api_test") { 210 testonly = true 211 sources = [ "googletest/test/gtest-unittest-api_test.cc" ] 212 configs += [ ":gtest_private_config" ] 213 deps = [ ":gtest" ] 214 } 215 216 group("gtest_all_tests") { 217 testonly = true 218 deps = [ 219 ":gtest_all_test", 220 ":gtest_environment_test", 221 ":gtest_listener_test", 222 ":gtest_no_test", 223 ":gtest_param_test", 224 ":gtest_premature_exit_test", 225 ":gtest_repeat_test", 226 ":gtest_sole_header_test", 227 ":gtest_stress_test", 228 ":gtest_unittest_api_test", 229 ] 230 } 231 232 config("gmock_private_config") { 233 visibility = [ ":*" ] 234 include_dirs = [ "googlemock" ] 235 cflags_cc = [ 236 "-Wno-deprecated", 237 "-Wno-double-promotion", 238 "-Wno-exit-time-destructors", 239 "-Wno-float-equal", 240 "-Wno-missing-prototypes", 241 "-Wno-pedantic", 242 "-Wno-sign-conversion", 243 "-Wno-switch-enum", 244 "-Wno-unused-macros", 245 "-Wno-unused-parameter", 246 "-Wno-used-but-marked-unused", 247 "-Wno-zero-as-null-pointer-constant", 248 ] 249 } 250 251 config("gmock_config") { 252 include_dirs = [ "googlemock/include" ] 253 254 cflags_cc = [ 255 # The MOCK_METHODn() macros do not specify "override", which triggers this 256 # warning in users: "error: 'Method' overrides a member function but is not 257 # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress 258 # these warnings until https://github.com/google/googletest/issues/533 is 259 # fixed. 260 "-Wno-inconsistent-missing-override", 261 ] 262 ldflags = [ "-lpthread" ] 263 } 264 265 source_set("gmock_internal_headers") { 266 visibility = [ ":*" ] 267 testonly = true 268 sources = [ 269 "googlemock/include/gmock/gmock-actions.h", 270 "googlemock/include/gmock/gmock-cardinalities.h", 271 "googlemock/include/gmock/gmock-generated-actions.h", 272 "googlemock/include/gmock/gmock-generated-function-mockers.h", 273 "googlemock/include/gmock/gmock-generated-matchers.h", 274 "googlemock/include/gmock/gmock-generated-nice-strict.h", 275 "googlemock/include/gmock/gmock-matchers.h", 276 "googlemock/include/gmock/gmock-more-actions.h", 277 "googlemock/include/gmock/gmock-more-matchers.h", 278 "googlemock/include/gmock/gmock-spec-builders.h", 279 "googlemock/include/gmock/internal/custom/gmock-generated-actions.h", 280 "googlemock/include/gmock/internal/custom/gmock-matchers.h", 281 "googlemock/include/gmock/internal/custom/gmock-port.h", 282 "googlemock/include/gmock/internal/gmock-generated-internal-utils.h", 283 "googlemock/include/gmock/internal/gmock-internal-utils.h", 284 "googlemock/include/gmock/internal/gmock-port.h", 285 ] 286 } 287 288 static_library("gmock") { 289 testonly = true 290 public = [ "googlemock/include/gmock/gmock.h" ] 291 sources = [ 292 "googlemock/src/gmock-all.cc", 293 "googlemock/src/gmock-cardinalities.cc", 294 "googlemock/src/gmock-internal-utils.cc", 295 "googlemock/src/gmock-matchers.cc", 296 "googlemock/src/gmock-spec-builders.cc", 297 "googlemock/src/gmock.cc", 298 ] 299 sources -= [ "googlemock/src/gmock-all.cc" ] 300 public_configs = [ ":gmock_config" ] 301 configs += [ ":gmock_private_config" ] 302 deps = [ 303 ":gmock_internal_headers", 304 ":gtest", 305 ":gtest_internal_headers", 306 ] 307 } 308 309 static_library("gmock_main") { 310 testonly = true 311 sources = [ "googlemock/src/gmock_main.cc" ] 312 configs += [ ":gmock_private_config" ] 313 public_deps = [ 314 ":gmock", 315 ":gtest", 316 ] 317 } 318 319 executable("gmock_all_test") { 320 testonly = true 321 sources = [ 322 "googlemock/test/gmock-actions_test.cc", 323 "googlemock/test/gmock-cardinalities_test.cc", 324 "googlemock/test/gmock-generated-actions_test.cc", 325 "googlemock/test/gmock-generated-function-mockers_test.cc", 326 "googlemock/test/gmock-generated-internal-utils_test.cc", 327 "googlemock/test/gmock-generated-matchers_test.cc", 328 "googlemock/test/gmock-internal-utils_test.cc", 329 "googlemock/test/gmock-matchers_test.cc", 330 "googlemock/test/gmock-more-actions_test.cc", 331 "googlemock/test/gmock-nice-strict_test.cc", 332 "googlemock/test/gmock-port_test.cc", 333 "googlemock/test/gmock-spec-builders_test.cc", 334 "googlemock/test/gmock_test.cc", 335 ] 336 configs += [ 337 ":gmock_private_config", 338 ":gtest_private_config", 339 ] 340 deps = [ 341 ":gmock", 342 ":gmock_internal_headers", 343 ":gmock_main", 344 ":gtest", 345 ":gtest_internal_headers", 346 ":gtest_test_headers", 347 ] 348 } 349 350 executable("gmock_link_test") { 351 testonly = true 352 sources = [ 353 "googlemock/test/gmock_link2_test.cc", 354 "googlemock/test/gmock_link_test.cc", 355 "googlemock/test/gmock_link_test.h", 356 ] 357 configs += [ ":gmock_private_config" ] 358 deps = [ 359 ":gmock", 360 ":gmock_main", 361 ":gtest", 362 ":gtest_internal_headers", 363 ] 364 } 365 366 executable("gmock_stress_test") { 367 testonly = true 368 sources = [ "googlemock/test/gmock_stress_test.cc" ] 369 cflags_cc = [ "-Wno-unused-member-function" ] 370 configs += [ ":gmock_private_config" ] 371 deps = [ 372 ":gmock", 373 ":gtest", 374 ] 375 } 376 377 group("gmock_all_tests") { 378 testonly = true 379 deps = [ 380 ":gmock_all_test", 381 ":gmock_link_test", 382 ":gmock_stress_test", 383 ] 384 }