diff options
author | krzysio <krzysio@google.com> | 2018-11-06 15:37:19 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-11-07 19:37:18 (GMT) |
commit | 105579a6e43908bc88a289d309492eda8be896be (patch) | |
tree | a280f427b5c0bf14398c9537a0998ce2fe1bdb44 /BUILD.bazel | |
parent | 529c2c6f4af29dadb8ee5cddf6a7919caa5ca5f6 (diff) | |
download | googletest-105579a6e43908bc88a289d309492eda8be896be.zip googletest-105579a6e43908bc88a289d309492eda8be896be.tar.gz googletest-105579a6e43908bc88a289d309492eda8be896be.tar.bz2 |
Googletest export
Improve Bazel build files.
New target gtest_prod allows access to the FRIEND_TEST macro without depending on the entirety of GTest in production executables. Additionally, duplicate config_setting rules were removed and formatting was adjusted.
PiperOrigin-RevId: 220279205
Diffstat (limited to 'BUILD.bazel')
-rw-r--r-- | BUILD.bazel | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/BUILD.bazel b/BUILD.bazel index 4e5bb0f..4dbaa27 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -38,12 +38,7 @@ licenses(["notice"]) config_setting( name = "windows", - values = {"cpu": "x64_windows"}, -) - -config_setting( - name = "windows_msvc", - values = {"cpu": "x64_windows_msvc"}, + constraint_values = ["@bazel_tools//platforms:windows"], ) config_setting( @@ -51,6 +46,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 +75,14 @@ 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({ + ":windows": [], + "//conditions:default": ["-pthread"], + }), + defines = select({ + ":has_absl": ["GTEST_HAS_ABSL=1"], + "//conditions:default": [], + }), includes = [ "googlemock", "googlemock/include", @@ -96,31 +91,24 @@ cc_library( ], linkopts = select({ ":windows": [], - ":windows_msvc": [], - "//conditions:default": [ - "-pthread", + "//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:optional", + "@com_google_absl//absl/types:variant", ], + "//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"], deps = [":gtest"], ) @@ -174,7 +162,5 @@ cc_test( name = "sample10_unittest", size = "small", srcs = ["googletest/samples/sample10_unittest.cc"], - deps = [ - ":gtest", - ], + deps = [":gtest"], ) |