• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_info.h",
20    "include/ntp_time.h",
21    "include/rtp_to_ntp_estimator.h",
22    "include/sleep.h",
23    "source/clock.cc",
24    "source/cpu_features.cc",
25    "source/cpu_info.cc",
26    "source/rtp_to_ntp_estimator.cc",
27    "source/sleep.cc",
28  ]
29
30  defines = []
31  libs = []
32  deps = [
33    ":cpu_features_api",
34    "../api:array_view",
35    "../api/units:timestamp",
36    "../modules:module_api_public",
37    "../rtc_base:checks",
38    "../rtc_base/synchronization:mutex",
39    "../rtc_base/synchronization:rw_lock_wrapper",
40    "../rtc_base/system:arch",
41    "../rtc_base/system:rtc_export",
42  ]
43  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
44
45  if (is_android) {
46    if (build_with_mozilla) {
47      include_dirs = [
48        "/config/external/nspr",
49        "/nsprpub/lib/ds",
50        "/nsprpub/pr/include",
51      ]
52    } else {
53      deps += [ ":cpu_features_android" ]
54    }
55
56    libs += [ "log" ]
57  }
58
59  if (is_linux) {
60    if (!build_with_chromium) {
61      deps += [ ":cpu_features_linux" ]
62    }
63
64    libs += [ "rt" ]
65  }
66
67  if (is_win) {
68    libs += [ "winmm.lib" ]
69
70    # Windows needs ../rtc_base due to include of
71    # webrtc/rtc_base/win32.h in source/clock.cc.
72    deps += [ "../rtc_base" ]
73  }
74
75  deps += [
76    "../rtc_base:rtc_base_approved",
77    "../rtc_base:rtc_numerics",
78  ]
79}
80
81rtc_source_set("cpu_features_api") {
82  sources = [ "include/cpu_features_wrapper.h" ]
83}
84
85rtc_library("field_trial") {
86  visibility = [ "*" ]
87  public = [ "include/field_trial.h" ]
88  sources = [ "source/field_trial.cc" ]
89  if (rtc_exclude_field_trial_default) {
90    defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
91  }
92  deps = [
93    "../rtc_base:checks",
94    "../rtc_base:logging",
95    "../rtc_base:stringutils",
96  ]
97  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
98}
99
100rtc_library("metrics") {
101  visibility = [ "*" ]
102  public = [ "include/metrics.h" ]
103  sources = [ "source/metrics.cc" ]
104  if (rtc_exclude_metrics_default) {
105    defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
106  }
107  deps = [
108    "../rtc_base:checks",
109    "../rtc_base:rtc_base_approved",
110    "../rtc_base/synchronization:mutex",
111  ]
112}
113
114if (is_android && !build_with_mozilla) {
115  rtc_library("cpu_features_android") {
116    sources = [ "source/cpu_features_android.c" ]
117
118    deps = [ "//third_party/android_sdk:cpu_features" ]
119  }
120}
121
122if (is_linux) {
123  rtc_library("cpu_features_linux") {
124    sources = [ "source/cpu_features_linux.c" ]
125    deps = [
126      ":cpu_features_api",
127      "../rtc_base/system:arch",
128    ]
129  }
130}
131
132if (rtc_include_tests) {
133  rtc_test("system_wrappers_unittests") {
134    testonly = true
135    sources = [
136      "source/clock_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      ":field_trial",
146      ":metrics",
147      ":system_wrappers",
148      "../rtc_base:checks",
149      "../rtc_base:rtc_base_approved",
150      "../test:rtc_expect_death",
151      "../test:test_main",
152      "../test:test_support",
153      "//testing/gtest",
154      "//third_party/abseil-cpp/absl/strings",
155    ]
156
157    if (is_android) {
158      deps += [ "//testing/android/native_test:native_test_support" ]
159
160      shard_timeout = 900
161    }
162  }
163}
164