123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
- package(default_visibility = ["//visibility:public"])
- licenses(["notice"])
- exports_files(["LICENSE"])
- config_setting(
- name = "windows",
- constraint_values = ["@platforms//os:windows"],
- )
- config_setting(
- name = "msvc_compiler",
- flag_values = {
- "@bazel_tools//tools/cpp:compiler": "msvc-cl",
- },
- visibility = [":__subpackages__"],
- )
- config_setting(
- name = "has_absl",
- values = {"define": "absl=1"},
- )
- cc_library(
- name = "gtest_prod",
- hdrs = ["googletest/include/gtest/gtest_prod.h"],
- includes = ["googletest/include"],
- )
- cc_library(
- name = "gtest",
- srcs = glob(
- include = [
- "googletest/src/*.cc",
- "googletest/src/*.h",
- "googletest/include/gtest/**/*.h",
- "googlemock/src/*.cc",
- "googlemock/include/gmock/**/*.h",
- ],
- exclude = [
- "googletest/src/gtest-all.cc",
- "googletest/src/gtest_main.cc",
- "googlemock/src/gmock-all.cc",
- "googlemock/src/gmock_main.cc",
- ],
- ),
- hdrs = glob([
- "googletest/include/gtest/*.h",
- "googlemock/include/gmock/*.h",
- ]),
- copts = select({
- ":windows": [],
- "//conditions:default": ["-pthread"],
- }),
- defines = select({
- ":has_absl": ["GTEST_HAS_ABSL=1"],
- "//conditions:default": [],
- }),
- features = select({
- ":windows": ["windows_export_all_symbols"],
- "//conditions:default": [],
- }),
- includes = [
- "googlemock",
- "googlemock/include",
- "googletest",
- "googletest/include",
- ],
- linkopts = select({
- ":windows": [],
- "//conditions:default": ["-pthread"],
- }),
- deps = select({
- ":has_absl": [
- "@com_google_absl//absl/debugging:failure_signal_handler",
- "@com_google_absl//absl/debugging:stacktrace",
- "@com_google_absl//absl/debugging:symbolize",
- "@com_google_absl//absl/strings",
- "@com_google_absl//absl/types:any",
- "@com_google_absl//absl/types:optional",
- "@com_google_absl//absl/types:variant",
- ],
- "//conditions:default": [],
- }),
- )
- cc_library(
- name = "gtest_main",
- srcs = ["googlemock/src/gmock_main.cc"],
- features = select({
- ":windows": ["windows_export_all_symbols"],
- "//conditions:default": [],
- }),
- deps = [":gtest"],
- )
- cc_library(
- name = "gtest_sample_lib",
- srcs = [
- "googletest/samples/sample1.cc",
- "googletest/samples/sample2.cc",
- "googletest/samples/sample4.cc",
- ],
- hdrs = [
- "googletest/samples/prime_tables.h",
- "googletest/samples/sample1.h",
- "googletest/samples/sample2.h",
- "googletest/samples/sample3-inl.h",
- "googletest/samples/sample4.h",
- ],
- features = select({
- ":windows": ["windows_export_all_symbols"],
- "//conditions:default": [],
- }),
- )
- cc_test(
- name = "gtest_samples",
- size = "small",
-
-
-
- srcs = [
- "googletest/samples/sample1_unittest.cc",
- "googletest/samples/sample2_unittest.cc",
- "googletest/samples/sample3_unittest.cc",
- "googletest/samples/sample4_unittest.cc",
- "googletest/samples/sample5_unittest.cc",
- "googletest/samples/sample6_unittest.cc",
- "googletest/samples/sample7_unittest.cc",
- "googletest/samples/sample8_unittest.cc",
- ],
- linkstatic = 0,
- deps = [
- "gtest_sample_lib",
- ":gtest_main",
- ],
- )
- cc_test(
- name = "sample9_unittest",
- size = "small",
- srcs = ["googletest/samples/sample9_unittest.cc"],
- deps = [":gtest"],
- )
- cc_test(
- name = "sample10_unittest",
- size = "small",
- srcs = ["googletest/samples/sample10_unittest.cc"],
- deps = [":gtest"],
- )
|