aboutsummaryrefslogtreecommitdiff
path: root/contrib/googletest/BUILD.bazel
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2023-08-08 06:17:32 +0000
committerEnji Cooper <ngie@FreeBSD.org>2023-08-10 09:32:33 +0000
commit28f6c2f292806bf31230a959bc4b19d7081669a7 (patch)
tree9dcddc020fbf236198f9f3c8056e1e670121a667 /contrib/googletest/BUILD.bazel
parent9228ac3a69c4c7401a743e6465e118101a2beeb0 (diff)
downloadsrc-28f6c2f292806bf31230a959bc4b19d7081669a7.tar.gz
src-28f6c2f292806bf31230a959bc4b19d7081669a7.zip
Diffstat (limited to 'contrib/googletest/BUILD.bazel')
-rw-r--r--contrib/googletest/BUILD.bazel127
1 files changed, 83 insertions, 44 deletions
diff --git a/contrib/googletest/BUILD.bazel b/contrib/googletest/BUILD.bazel
index 41a098579818..b1e3b7fba89a 100644
--- a/contrib/googletest/BUILD.bazel
+++ b/contrib/googletest/BUILD.bazel
@@ -28,22 +28,40 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-# Author: misterg@google.com (Gennadiy Civil)
-#
# Bazel Build for Google C++ Testing Framework(Google Test)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
+exports_files(["LICENSE"])
+
+config_setting(
+ name = "qnx",
+ constraint_values = ["@platforms//os:qnx"],
+)
+
config_setting(
name = "windows",
- values = {"cpu": "x64_windows"},
+ constraint_values = ["@platforms//os:windows"],
+)
+
+config_setting(
+ name = "freebsd",
+ constraint_values = ["@platforms//os:freebsd"],
)
config_setting(
- name = "windows_msvc",
- values = {"cpu": "x64_windows_msvc"},
+ name = "openbsd",
+ constraint_values = ["@platforms//os:openbsd"],
+)
+
+config_setting(
+ name = "msvc_compiler",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "msvc-cl",
+ },
+ visibility = [":__subpackages__"],
)
config_setting(
@@ -51,6 +69,13 @@ config_setting(
values = {"define": "absl=1"},
)
+# Library that defines the FRIEND_TEST macro.
+cc_library(
+ name = "gtest_prod",
+ hdrs = ["googletest/include/gtest/gtest_prod.h"],
+ includes = ["googletest/include"],
+)
+
# Google Test including Google Mock
cc_library(
name = "gtest",
@@ -73,21 +98,19 @@ cc_library(
"googletest/include/gtest/*.h",
"googlemock/include/gmock/*.h",
]),
- copts = select(
- {
- ":windows": [],
- ":windows_msvc": [],
- "//conditions:default": ["-pthread"],
- },
- ),
- defines = select(
- {
- ":has_absl": [
- "GTEST_HAS_ABSL=1",
- ],
- "//conditions:default": [],
- },
- ),
+ copts = select({
+ ":qnx": [],
+ ":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",
@@ -95,32 +118,45 @@ cc_library(
"googletest/include",
],
linkopts = select({
+ ":qnx": ["-lregex"],
":windows": [],
- ":windows_msvc": [],
- "//conditions:default": [
+ ":freebsd": [
+ "-lm",
"-pthread",
],
+ ":openbsd": [
+ "-lm",
+ "-pthread",
+ ],
+ "//conditions:default": ["-pthread"],
+ }),
+ deps = select({
+ ":has_absl": [
+ "@com_google_absl//absl/container:flat_hash_set",
+ "@com_google_absl//absl/debugging:failure_signal_handler",
+ "@com_google_absl//absl/debugging:stacktrace",
+ "@com_google_absl//absl/debugging:symbolize",
+ "@com_google_absl//absl/flags:flag",
+ "@com_google_absl//absl/flags:parse",
+ "@com_google_absl//absl/flags:reflection",
+ "@com_google_absl//absl/flags:usage",
+ "@com_google_absl//absl/strings",
+ "@com_google_absl//absl/types:any",
+ "@com_google_absl//absl/types:optional",
+ "@com_google_absl//absl/types:variant",
+ "@com_googlesource_code_re2//:re2",
+ ],
+ "//conditions:default": [],
}),
- 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:optional",
- "@com_google_absl//absl/types:variant",
- ],
- "//conditions:default": [],
- },
- ),
)
cc_library(
name = "gtest_main",
- srcs = [
- "googlemock/src/gmock_main.cc",
- ],
+ srcs = ["googlemock/src/gmock_main.cc"],
+ features = select({
+ ":windows": ["windows_export_all_symbols"],
+ "//conditions:default": [],
+ }),
deps = [":gtest"],
)
@@ -139,14 +175,18 @@ cc_library(
"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",
- #All Samples except:
- #sample9 ( main )
- #sample10 (main and takes a command line option and needs to be separate)
+ # All Samples except:
+ # sample9 (main)
+ # sample10 (main and takes a command line option and needs to be separate)
srcs = [
"googletest/samples/sample1_unittest.cc",
"googletest/samples/sample2_unittest.cc",
@@ -157,6 +197,7 @@ cc_test(
"googletest/samples/sample7_unittest.cc",
"googletest/samples/sample8_unittest.cc",
],
+ linkstatic = 0,
deps = [
"gtest_sample_lib",
":gtest_main",
@@ -174,7 +215,5 @@ cc_test(
name = "sample10_unittest",
size = "small",
srcs = ["googletest/samples/sample10_unittest.cc"],
- deps = [
- ":gtest",
- ],
+ deps = [":gtest"],
)