1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8 9if (is_android) { 10 import("//build/config/android/config.gni") 11 import("//build/config/android/rules.gni") 12} 13import("../webrtc.gni") 14 15rtc_library("system_wrappers") { 16 visibility = [ "*" ] 17 sources = [ 18 "include/clock.h", 19 "include/cpu_features_wrapper.h", 20 "include/cpu_info.h", 21 "include/ntp_time.h", 22 "include/rtp_to_ntp_estimator.h", 23 "include/sleep.h", 24 "source/clock.cc", 25 "source/cpu_features.cc", 26 "source/cpu_info.cc", 27 "source/rtp_to_ntp_estimator.cc", 28 "source/sleep.cc", 29 ] 30 31 defines = [] 32 libs = [] 33 deps = [ 34 ":field_trial", 35 "../api:array_view", 36 "../api/units:timestamp", 37 "../modules:module_api_public", 38 "../rtc_base:checks", 39 "../rtc_base:logging", 40 "../rtc_base:safe_conversions", 41 "../rtc_base:timeutils", 42 "../rtc_base/synchronization:mutex", 43 "../rtc_base/system:arch", 44 "../rtc_base/system:rtc_export", 45 ] 46 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] 47 48 if (is_android) { 49 if (build_with_mozilla) { 50 include_dirs = [ 51 "/config/external/nspr", 52 "/nsprpub/lib/ds", 53 "/nsprpub/pr/include", 54 ] 55 } else { 56 sources += [ "source/cpu_features_android.cc" ] 57 deps += [ "//third_party/android_sdk:cpu_features" ] 58 } 59 60 libs += [ "log" ] 61 } 62 63 if (is_linux || is_chromeos) { 64 if (!build_with_chromium) { 65 sources += [ "source/cpu_features_linux.cc" ] 66 } 67 68 libs += [ "rt" ] 69 } 70 71 if (is_win) { 72 libs += [ "winmm.lib" ] 73 74 # Windows needs ../rtc_base due to include of 75 # webrtc/rtc_base/win32.h in source/clock.cc. 76 deps += [ "../rtc_base:win32" ] 77 } 78 79 deps += [ "../rtc_base:rtc_numerics" ] 80} 81 82rtc_library("field_trial") { 83 visibility = [ "*" ] 84 public = [ "include/field_trial.h" ] 85 sources = [ "source/field_trial.cc" ] 86 if (rtc_exclude_field_trial_default) { 87 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ] 88 } 89 deps = [ 90 "../experiments:registered_field_trials", 91 "../rtc_base:checks", 92 "../rtc_base:logging", 93 "../rtc_base:stringutils", 94 "../rtc_base/containers:flat_set", 95 ] 96 absl_deps = [ 97 "//third_party/abseil-cpp/absl/algorithm:container", 98 "//third_party/abseil-cpp/absl/strings", 99 ] 100} 101 102rtc_library("metrics") { 103 visibility = [ "*" ] 104 public = [ "include/metrics.h" ] 105 sources = [ "source/metrics.cc" ] 106 if (rtc_exclude_metrics_default) { 107 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ] 108 } 109 deps = [ 110 "../rtc_base:checks", 111 "../rtc_base:macromagic", 112 "../rtc_base:stringutils", 113 "../rtc_base/synchronization:mutex", 114 ] 115 absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] 116} 117 118rtc_library("denormal_disabler") { 119 visibility = [ "*" ] 120 public = [ "include/denormal_disabler.h" ] 121 sources = [ "source/denormal_disabler.cc" ] 122 deps = [ 123 "../rtc_base:checks", 124 "../rtc_base/system:arch", 125 ] 126 if (is_clang) { 127 cflags_cc = [ "-Wno-unused-private-field" ] 128 } 129} 130 131if (rtc_include_tests && !build_with_chromium) { 132 rtc_test("system_wrappers_unittests") { 133 testonly = true 134 sources = [ 135 "source/clock_unittest.cc", 136 "source/denormal_disabler_unittest.cc", 137 "source/field_trial_unittest.cc", 138 "source/metrics_default_unittest.cc", 139 "source/metrics_unittest.cc", 140 "source/ntp_time_unittest.cc", 141 "source/rtp_to_ntp_estimator_unittest.cc", 142 ] 143 144 deps = [ 145 ":denormal_disabler", 146 ":field_trial", 147 ":metrics", 148 ":system_wrappers", 149 "../rtc_base:checks", 150 "../rtc_base:random", 151 "../rtc_base:stringutils", 152 "../test:rtc_expect_death", 153 "../test:test_main", 154 "../test:test_support", 155 "//testing/gtest", 156 ] 157 158 absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] 159 160 if (is_android) { 161 deps += [ "//testing/android/native_test:native_test_support" ] 162 163 shard_timeout = 900 164 } 165 } 166} 167