diff --git a/BUILD.gn b/BUILD.gn index 4e1e666efb..bf524bfd62 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -14,6 +14,7 @@ import("//build/config/linux/pkg_config.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//third_party/google_benchmark/buildconfig.gni") import("webrtc.gni") if (rtc_enable_protobuf) { import("//third_party/protobuf/proto_library.gni") @@ -584,12 +585,14 @@ if (rtc_include_tests) { } } - rtc_test("benchmarks") { - testonly = true - deps = [ - "rtc_base/synchronization:mutex_benchmark", - "test:benchmark_main", - ] + if (enable_google_benchmarks) { + rtc_test("benchmarks") { + testonly = true + deps = [ + "rtc_base/synchronization:mutex_benchmark", + "test:benchmark_main", + ] + } } # This runs tests that must run in real time and therefore can take some diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 9e6d697469..dbded17b59 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -8,6 +8,7 @@ import("//build/config/crypto.gni") import("//build/config/ui.gni") +import("//third_party/google_benchmark/buildconfig.gni") import("../webrtc.gni") if (is_android) { @@ -1539,11 +1540,13 @@ if (rtc_include_tests) { "../test:test_support", "memory:fifo_buffer", "synchronization:mutex", - "synchronization:synchronization_unittests", "task_utils:pending_task_safety_flag", "task_utils:to_queued_task", "third_party/sigslot", ] + if (enable_google_benchmarks) { + deps += [ "synchronization:synchronization_unittests" ] + } if (is_win) { sources += [ "win32_unittest.cc", diff --git a/rtc_base/synchronization/BUILD.gn b/rtc_base/synchronization/BUILD.gn index 6b22b22605..ce0c3d0ce2 100644 --- a/rtc_base/synchronization/BUILD.gn +++ b/rtc_base/synchronization/BUILD.gn @@ -6,6 +6,7 @@ # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. +import("//third_party/google_benchmark/buildconfig.gni") import("../../webrtc.gni") if (is_android) { import("//build/config/android/config.gni") @@ -73,34 +74,36 @@ rtc_library("yield_policy") { } if (rtc_include_tests) { - rtc_library("synchronization_unittests") { - testonly = true - sources = [ - "mutex_unittest.cc", - "yield_policy_unittest.cc", - ] - deps = [ - ":mutex", - ":yield", - ":yield_policy", - "..:checks", - "..:macromagic", - "..:rtc_base", - "..:rtc_event", - "..:threading", - "../../test:test_support", - "//third_party/google_benchmark", - ] - } + if (enable_google_benchmarks) { + rtc_library("synchronization_unittests") { + testonly = true + sources = [ + "mutex_unittest.cc", + "yield_policy_unittest.cc", + ] + deps = [ + ":mutex", + ":yield", + ":yield_policy", + "..:checks", + "..:macromagic", + "..:rtc_base", + "..:rtc_event", + "..:threading", + "../../test:test_support", + "//third_party/google_benchmark", + ] + } - rtc_library("mutex_benchmark") { - testonly = true - sources = [ "mutex_benchmark.cc" ] - deps = [ - ":mutex", - "../system:unused", - "//third_party/google_benchmark", - ] + rtc_library("mutex_benchmark") { + testonly = true + sources = [ "mutex_benchmark.cc" ] + deps = [ + ":mutex", + "../system:unused", + "//third_party/google_benchmark", + ] + } } rtc_library("sequence_checker_unittests") { diff --git a/test/BUILD.gn b/test/BUILD.gn index a337979b67..878085c4eb 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -7,6 +7,7 @@ # be found in the AUTHORS file in the root of the source tree. import("//build/config/ui.gni") +import("//third_party/google_benchmark/buildconfig.gni") import("../webrtc.gni") if (is_android) { import("//build/config/android/rules.gni") @@ -445,11 +446,13 @@ if (rtc_include_tests) { ] } - rtc_library("benchmark_main") { - testonly = true - sources = [ "benchmark_main.cc" ] + if (enable_google_benchmarks) { + rtc_library("benchmark_main") { + testonly = true + sources = [ "benchmark_main.cc" ] - deps = [ "//third_party/google_benchmark" ] + deps = [ "//third_party/google_benchmark" ] + } } rtc_library("test_support_test_artifacts") {