summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/system_wrappers/BUILD.gn
blob: a6bcc9c28e775ba5b6751510619b1c41cef20625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS.  All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.

if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
}
import("../webrtc.gni")

rtc_library("system_wrappers") {
  visibility = [ "*" ]
  sources = [
    "include/clock.h",
    "include/cpu_features_wrapper.h",
    "include/cpu_info.h",
    "include/ntp_time.h",
    "include/rtp_to_ntp_estimator.h",
    "include/sleep.h",
    "source/clock.cc",
    "source/cpu_features.cc",
    "source/cpu_info.cc",
    "source/rtp_to_ntp_estimator.cc",
    "source/sleep.cc",
  ]

  defines = []
  libs = []
  deps = [
    ":field_trial",
    "../api:array_view",
    "../api/units:timestamp",
    "../modules:module_api_public",
    "../rtc_base:checks",
    "../rtc_base:logging",
    "../rtc_base:safe_conversions",
    "../rtc_base:timeutils",
    "../rtc_base/synchronization:mutex",
    "../rtc_base/system:arch",
    "../rtc_base/system:rtc_export",
  ]
  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]

  if (is_android) {
    if (build_with_mozilla) {
      include_dirs = [
        "/config/external/nspr",
        "/nsprpub/lib/ds",
        "/nsprpub/pr/include",
      ]
    } else {
      sources += [ "source/cpu_features_android.cc" ]
      deps += [ "//third_party/android_sdk:cpu_features" ]
    }

    libs += [ "log" ]
  }

  if (is_linux || is_chromeos) {
    if (!build_with_chromium) {
      sources += [ "source/cpu_features_linux.cc" ]
    }

    libs += [ "rt" ]
  }

  if (is_win) {
    libs += [ "winmm.lib" ]

    # Windows needs ../rtc_base due to include of
    # webrtc/rtc_base/win32.h in source/clock.cc.
    deps += [ "../rtc_base:win32" ]
  }

  deps += [ "../rtc_base:rtc_numerics" ]
}

rtc_library("field_trial") {
  visibility = [ "*" ]
  public = [ "include/field_trial.h" ]
  sources = [ "source/field_trial.cc" ]
  if (rtc_exclude_field_trial_default) {
    defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
  }
  deps = [
    "../experiments:registered_field_trials",
    "../rtc_base:checks",
    "../rtc_base:logging",
    "../rtc_base:stringutils",
    "../rtc_base/containers:flat_set",
  ]
  absl_deps = [
    "//third_party/abseil-cpp/absl/algorithm:container",
    "//third_party/abseil-cpp/absl/strings",
  ]
}

rtc_library("metrics") {
  visibility = [ "*" ]
  public = [ "include/metrics.h" ]
  sources = [ "source/metrics.cc" ]
  if (rtc_exclude_metrics_default) {
    defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
  }
  deps = [
    "../rtc_base:checks",
    "../rtc_base:macromagic",
    "../rtc_base:stringutils",
    "../rtc_base/synchronization:mutex",
  ]
  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}

rtc_library("denormal_disabler") {
  visibility = [ "*" ]
  public = [ "include/denormal_disabler.h" ]
  sources = [ "source/denormal_disabler.cc" ]
  deps = [
    "../rtc_base:checks",
    "../rtc_base/system:arch",
  ]
  if (is_clang) {
    cflags_cc = [ "-Wno-unused-private-field" ]
  }
}

if (rtc_include_tests && !build_with_chromium) {
  rtc_test("system_wrappers_unittests") {
    testonly = true
    sources = [
      "source/clock_unittest.cc",
      "source/denormal_disabler_unittest.cc",
      "source/field_trial_unittest.cc",
      "source/metrics_default_unittest.cc",
      "source/metrics_unittest.cc",
      "source/ntp_time_unittest.cc",
      "source/rtp_to_ntp_estimator_unittest.cc",
    ]

    deps = [
      ":denormal_disabler",
      ":field_trial",
      ":metrics",
      ":system_wrappers",
      "../rtc_base:checks",
      "../rtc_base:random",
      "../rtc_base:stringutils",
      "../test:rtc_expect_death",
      "../test:test_main",
      "../test:test_support",
      "//testing/gtest",
    ]

    absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]

    if (is_android) {
      deps += [ "//testing/android/native_test:native_test_support" ]

      shard_timeout = 900
    }
  }
}