BUILD.gn (11125B)
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 = [ 75 "googletest/include/gtest/gtest-spi.h", 76 ] 77 } 78 79 static_library("gtest") { 80 testonly = true 81 public = [ 82 "googletest/include/gtest/gtest.h", 83 ] 84 sources = [ 85 "googletest/src/gtest-all.cc", 86 "googletest/src/gtest-assertion-result.cc", 87 "googletest/src/gtest-death-test.cc", 88 "googletest/src/gtest-filepath.cc", 89 "googletest/src/gtest-matchers.cc", 90 "googletest/src/gtest-port.cc", 91 "googletest/src/gtest-printers.cc", 92 "googletest/src/gtest-test-part.cc", 93 "googletest/src/gtest-typed-test.cc", 94 "googletest/src/gtest.cc", 95 ] 96 sources -= [ "googletest/src/gtest-all.cc" ] 97 public_configs = [ ":gtest_config" ] 98 configs += [ ":gtest_private_config" ] 99 deps = [ 100 ":gtest_internal_headers", 101 ":gtest_test_headers", 102 ] 103 } 104 105 static_library("gtest_main") { 106 testonly = true 107 sources = [ 108 "googletest/src/gtest_main.cc", 109 ] 110 public_deps = [ 111 ":gtest", 112 ] 113 } 114 115 executable("gtest_all_test") { 116 testonly = true 117 sources = [ 118 "googletest/test/googletest-death-test-test.cc", 119 "googletest/test/googletest-filepath-test.cc", 120 "googletest/test/googletest-message-test.cc", 121 "googletest/test/googletest-options-test.cc", 122 "googletest/test/googletest-param-test2-test.cc", 123 "googletest/test/googletest-port-test.cc", 124 "googletest/test/googletest-printers-test.cc", 125 "googletest/test/googletest-test-part-test.cc", 126 "googletest/test/gtest-typed-test2_test.cc", 127 "googletest/test/gtest-typed-test_test.cc", 128 "googletest/test/gtest_dirs_test.cc", 129 "googletest/test/gtest_main_unittest.cc", 130 "googletest/test/gtest_pred_impl_unittest.cc", 131 "googletest/test/gtest_skip_test.cc", 132 "googletest/test/gtest_sole_header_test.cc", 133 "googletest/test/gtest_unittest.cc", 134 ] 135 configs += [ ":gtest_private_config" ] 136 deps = [ 137 ":gtest", 138 ":gtest_internal_headers", 139 ":gtest_main", 140 ":gtest_test_headers", 141 ] 142 } 143 144 executable("gtest_environment_test") { 145 testonly = true 146 sources = [ 147 "googletest/test/gtest_environment_test.cc", 148 ] 149 configs += [ ":gtest_private_config" ] 150 deps = [ 151 ":gtest", 152 ":gtest_internal_headers", 153 ] 154 } 155 156 executable("gtest_listener_test") { 157 testonly = true 158 sources = [ 159 "googletest/test/googletest-listener-test.cc", 160 ] 161 deps = [ 162 ":gtest", 163 ] 164 cflags_cc = [ 165 "-Wno-missing-prototypes", 166 "-Wno-missing-variable-declarations", 167 ] 168 } 169 170 executable("gtest_no_test") { 171 testonly = true 172 sources = [ 173 "googletest/test/gtest_no_test_unittest.cc", 174 ] 175 deps = [ 176 ":gtest", 177 ] 178 } 179 180 executable("gtest_param_test") { 181 testonly = true 182 sources = [ 183 "googletest/test/googletest-param-test2-test.cc", 184 "googletest/test/googletest-param-test-test.cc", 185 "googletest/test/googletest-param-test-test.h", 186 ] 187 configs += [ ":gtest_private_config" ] 188 deps = [ 189 ":gtest", 190 ] 191 } 192 193 executable("gtest_premature_exit_test") { 194 testonly = true 195 sources = [ 196 "googletest/test/gtest_premature_exit_test.cc", 197 ] 198 configs += [ ":gtest_private_config" ] 199 deps = [ 200 ":gtest", 201 ] 202 } 203 204 executable("gtest_repeat_test") { 205 testonly = true 206 sources = [ 207 "googletest/test/gtest_repeat_test.cc", 208 ] 209 configs += [ ":gtest_private_config" ] 210 deps = [ 211 ":gtest", 212 ":gtest_internal_headers", 213 ] 214 } 215 216 executable("gtest_sole_header_test") { 217 testonly = true 218 sources = [ 219 "googletest/test/gtest_sole_header_test.cc", 220 ] 221 deps = [ 222 ":gtest", 223 ":gtest_main", 224 ] 225 } 226 227 executable("gtest_stress_test") { 228 testonly = true 229 sources = [ 230 "googletest/test/gtest_stress_test.cc", 231 ] 232 configs += [ ":gtest_private_config" ] 233 deps = [ 234 ":gtest", 235 ":gtest_internal_headers", 236 ] 237 } 238 239 executable("gtest_unittest_api_test") { 240 testonly = true 241 sources = [ 242 "googletest/test/gtest-unittest-api_test.cc", 243 ] 244 configs += [ ":gtest_private_config" ] 245 deps = [ 246 ":gtest", 247 ] 248 } 249 250 group("gtest_all_tests") { 251 testonly = true 252 deps = [ 253 ":gtest_all_test", 254 ":gtest_environment_test", 255 ":gtest_listener_test", 256 ":gtest_no_test", 257 ":gtest_param_test", 258 ":gtest_premature_exit_test", 259 ":gtest_repeat_test", 260 ":gtest_sole_header_test", 261 ":gtest_stress_test", 262 ":gtest_unittest_api_test", 263 ] 264 } 265 266 config("gmock_private_config") { 267 visibility = [ ":*" ] 268 include_dirs = [ "googlemock" ] 269 cflags_cc = [ 270 "-Wno-deprecated", 271 "-Wno-double-promotion", 272 "-Wno-exit-time-destructors", 273 "-Wno-float-equal", 274 "-Wno-missing-prototypes", 275 "-Wno-pedantic", 276 "-Wno-sign-conversion", 277 "-Wno-switch-enum", 278 "-Wno-unused-macros", 279 "-Wno-unused-parameter", 280 "-Wno-used-but-marked-unused", 281 "-Wno-zero-as-null-pointer-constant", 282 ] 283 } 284 285 config("gmock_config") { 286 include_dirs = [ "googlemock/include" ] 287 288 cflags_cc = [ 289 # The MOCK_METHODn() macros do not specify "override", which triggers this 290 # warning in users: "error: 'Method' overrides a member function but is not 291 # marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress 292 # these warnings until https://github.com/google/googletest/issues/533 is 293 # fixed. 294 "-Wno-inconsistent-missing-override", 295 ] 296 ldflags = [ "-lpthread" ] 297 } 298 299 source_set("gmock_internal_headers") { 300 visibility = [ ":*" ] 301 testonly = true 302 sources = [ 303 "googlemock/include/gmock/gmock-actions.h", 304 "googlemock/include/gmock/gmock-cardinalities.h", 305 "googlemock/include/gmock/gmock-generated-actions.h", 306 "googlemock/include/gmock/gmock-generated-function-mockers.h", 307 "googlemock/include/gmock/gmock-generated-matchers.h", 308 "googlemock/include/gmock/gmock-generated-nice-strict.h", 309 "googlemock/include/gmock/gmock-matchers.h", 310 "googlemock/include/gmock/gmock-more-actions.h", 311 "googlemock/include/gmock/gmock-more-matchers.h", 312 "googlemock/include/gmock/gmock-spec-builders.h", 313 "googlemock/include/gmock/internal/custom/gmock-generated-actions.h", 314 "googlemock/include/gmock/internal/custom/gmock-matchers.h", 315 "googlemock/include/gmock/internal/custom/gmock-port.h", 316 "googlemock/include/gmock/internal/gmock-generated-internal-utils.h", 317 "googlemock/include/gmock/internal/gmock-internal-utils.h", 318 "googlemock/include/gmock/internal/gmock-port.h", 319 ] 320 } 321 322 static_library("gmock") { 323 testonly = true 324 public = [ 325 "googlemock/include/gmock/gmock.h", 326 ] 327 sources = [ 328 "googlemock/src/gmock-all.cc", 329 "googlemock/src/gmock-cardinalities.cc", 330 "googlemock/src/gmock-internal-utils.cc", 331 "googlemock/src/gmock-matchers.cc", 332 "googlemock/src/gmock-spec-builders.cc", 333 "googlemock/src/gmock.cc", 334 ] 335 sources -= [ "googlemock/src/gmock-all.cc" ] 336 public_configs = [ ":gmock_config" ] 337 configs += [ ":gmock_private_config" ] 338 deps = [ 339 ":gmock_internal_headers", 340 ":gtest", 341 ":gtest_internal_headers", 342 ] 343 } 344 345 static_library("gmock_main") { 346 testonly = true 347 sources = [ 348 "googlemock/src/gmock_main.cc", 349 ] 350 configs += [ ":gmock_private_config" ] 351 public_deps = [ 352 ":gmock", 353 ":gtest", 354 ] 355 } 356 357 executable("gmock_all_test") { 358 testonly = true 359 sources = [ 360 "googlemock/test/gmock-actions_test.cc", 361 "googlemock/test/gmock-cardinalities_test.cc", 362 "googlemock/test/gmock-generated-actions_test.cc", 363 "googlemock/test/gmock-generated-function-mockers_test.cc", 364 "googlemock/test/gmock-generated-internal-utils_test.cc", 365 "googlemock/test/gmock-generated-matchers_test.cc", 366 "googlemock/test/gmock-internal-utils_test.cc", 367 "googlemock/test/gmock-matchers_test.cc", 368 "googlemock/test/gmock-more-actions_test.cc", 369 "googlemock/test/gmock-nice-strict_test.cc", 370 "googlemock/test/gmock-port_test.cc", 371 "googlemock/test/gmock-spec-builders_test.cc", 372 "googlemock/test/gmock_test.cc", 373 ] 374 configs += [ 375 ":gmock_private_config", 376 ":gtest_private_config", 377 ] 378 deps = [ 379 ":gmock", 380 ":gmock_internal_headers", 381 ":gmock_main", 382 ":gtest", 383 ":gtest_internal_headers", 384 ":gtest_test_headers", 385 ] 386 } 387 388 executable("gmock_link_test") { 389 testonly = true 390 sources = [ 391 "googlemock/test/gmock_link2_test.cc", 392 "googlemock/test/gmock_link_test.cc", 393 "googlemock/test/gmock_link_test.h", 394 ] 395 configs += [ ":gmock_private_config" ] 396 deps = [ 397 ":gmock", 398 ":gmock_main", 399 ":gtest", 400 ":gtest_internal_headers", 401 ] 402 } 403 404 executable("gmock_stress_test") { 405 testonly = true 406 sources = [ 407 "googlemock/test/gmock_stress_test.cc", 408 ] 409 cflags_cc = [ "-Wno-unused-member-function" ] 410 configs += [ ":gmock_private_config" ] 411 deps = [ 412 ":gmock", 413 ":gtest", 414 ] 415 } 416 417 group("gmock_all_tests") { 418 testonly = true 419 deps = [ 420 ":gmock_all_test", 421 ":gmock_link_test", 422 ":gmock_stress_test", 423 ] 424 }