blob: 11e661656b6d548578840beeeac7d8f84e0ffd4f [file] [log] [blame]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +00001# 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
kjellanderbac04122016-06-02 02:18:48 -07009if (is_android) {
10 import("//build/config/android/config.gni")
11 import("//build/config/android/rules.gni")
12}
mbonadei9aa3f0a2017-01-24 06:58:22 -080013import("../webrtc.gni")
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000014
kjellanderb62dbbe2016-09-23 00:38:52 -070015rtc_static_library("system_wrappers") {
Per Kjellandera7f2d842018-01-10 15:54:53 +000016 visibility = [ "*" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000017 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010018 "include/clock.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010019 "include/cpu_info.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010020 "include/event_wrapper.h",
kjellander080a1e32016-05-25 11:37:11 -070021 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080022 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010023 "include/sleep.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000024 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000025 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020026 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000027 "source/event.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080028 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000029 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000030 ]
31
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 defines = []
33 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020034 deps = [
kjellander8a116632017-04-21 05:17:08 -070035 ":cpu_features_api",
36 ":field_trial_api",
37 ":metrics_api",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +010038 ":runtime_enabled_features_api",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010039 "..:webrtc_common",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010040 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010041 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010042 "../rtc_base/synchronization:rw_lock_wrapper",
Niels Möllera12c42a2018-07-25 16:05:48 +020043 "../rtc_base/system:arch",
Danil Chapovalov196100e2018-06-21 10:17:24 +020044 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070045 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000046
47 if (is_android) {
sprange791ffd2016-01-26 01:53:20 -080048 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000049
Dan Minor9c686132018-01-15 10:20:00 -050050 if (build_with_mozilla) {
51 include_dirs = [
52 "/config/external/nspr",
53 "/nsprpub/lib/ds",
54 "/nsprpub/pr/include",
55 ]
56 } else {
57 deps += [ ":cpu_features_android" ]
58 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000059
60 libs += [ "log" ]
61 }
62
63 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080064 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000065
simon.hosie953b1c12016-04-06 14:02:26 -070066 if (!build_with_chromium) {
67 deps += [ ":cpu_features_linux" ]
68 }
69
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000070 libs += [ "rt" ]
71 }
72
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000073 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080074 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000075 }
76
77 if (is_win) {
78 libs += [ "winmm.lib" ]
79
Jianjun Zhu037f3e42017-08-15 21:48:37 +080080 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070081 # webrtc/rtc_base/win32.h in source/clock.cc.
ehmaldonadof6a861a2017-07-19 10:40:47 -070082 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000083 }
84
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000085 deps += [
86 "../rtc_base:rtc_base_approved",
87 "../rtc_base:rtc_numerics",
88 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000089}
90
kjellander8a116632017-04-21 05:17:08 -070091rtc_source_set("cpu_features_api") {
92 sources = [
93 "include/cpu_features_wrapper.h",
94 ]
95 deps = [
96 "..:webrtc_common",
97 ]
98}
99
Mirko Bonadei92e00382018-09-15 10:37:11 +0200100rtc_source_set("field_trial") {
101 visibility = [ "*" ]
102 public = [
kjellander8a116632017-04-21 05:17:08 -0700103 "include/field_trial.h",
Mirko Bonadei92e00382018-09-15 10:37:11 +0200104 "include/field_trial_default.h",
kjellander8a116632017-04-21 05:17:08 -0700105 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +0200106 sources = [
107 "source/field_trial.cc",
108 ]
109 if (rtc_exclude_field_trial_default) {
110 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
111 }
112}
113
114# TODO(bugs.webrtc.org/9631): Remove this as soon as Chromium stop depending
115# on it.
116rtc_source_set("field_trial_api") {
117 public_deps = [ # no-presubmit-check TODO(webrtc:8603)
118 ":field_trial",
119 ]
120}
121
122# TODO(bugs.webrtc.org/9631): Remove this as soon as Chromium stop depending
123# on it.
124rtc_source_set("field_trial_default") {
125 public_deps = [ # no-presubmit-check TODO(webrtc:8603)
126 ":field_trial",
127 ]
128 visibility = [ "*" ]
kjellander8a116632017-04-21 05:17:08 -0700129}
130
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100131rtc_source_set("runtime_enabled_features_api") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100132 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100133 sources = [
134 "include/runtime_enabled_features.h",
135 ]
136}
137
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100138rtc_source_set("runtime_enabled_features_default") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100139 visibility = [ "*" ]
Mirko Bonadei96ede162018-09-06 13:45:44 +0200140 configs += [ "..:no_global_constructors" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100141 sources = [
142 "source/runtime_enabled_features_default.cc",
143 ]
144 deps = [
145 ":runtime_enabled_features_api",
146 "../rtc_base:rtc_base_approved",
147 ]
148}
149
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200150rtc_source_set("metrics") {
151 visibility = [ "*" ]
152 public = [
153 "include/metrics.h",
154 "include/metrics_default.h",
155 ]
156 sources = [
157 "source/metrics.cc",
158 ]
159 if (rtc_exclude_metrics_default) {
160 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
161 }
162 deps = [
163 "..:webrtc_common",
164 "../rtc_base:checks",
165 "../rtc_base:rtc_base_approved",
166 ]
167}
168
169# TODO(bugs.webrtc.org/9631): Remove this as soon as Chromium stops depending
170# on it.
171rtc_source_set("metrics_api") {
172 visibility = [ "*" ]
173 public_deps = [ # no-presubmit-check TODO(webrtc:8603)
174 ":metrics",
175 ]
176}
177
178# TODO(bugs.webrtc.org/9631): Remove this as soon as Chromium stops depending
179# on it.
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200180rtc_source_set("metrics_default") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000181 visibility = [ "*" ]
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200182 public_deps = [ # no-presubmit-check TODO(webrtc:8603)
183 ":metrics",
kjellander8a116632017-04-21 05:17:08 -0700184 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000185}
186
kjellanderb62dbbe2016-09-23 00:38:52 -0700187group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000188 deps = [
189 ":field_trial_default",
190 ":metrics_default",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100191 ":runtime_enabled_features_default",
pbos12411ef2015-11-23 14:47:56 -0800192 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000193 ]
194}
195
Dan Minor9c686132018-01-15 10:20:00 -0500196if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700197 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000198 sources = [
199 "source/cpu_features_android.c",
200 ]
201
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200202 deps = [
203 "//third_party/android_tools:cpu_features",
204 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000205 }
206}
simon.hosie953b1c12016-04-06 14:02:26 -0700207
208if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700209 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700210 sources = [
211 "source/cpu_features_linux.c",
212 ]
kjellander8a116632017-04-21 05:17:08 -0700213 deps = [
214 ":cpu_features_api",
Niels Möllera12c42a2018-07-25 16:05:48 +0200215 "../rtc_base/system:arch",
kjellander8a116632017-04-21 05:17:08 -0700216 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700217 }
218}
kjellanderbac04122016-06-02 02:18:48 -0700219
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200220if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700221 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200222 testonly = true
223 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200224 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200225 "source/metrics_default_unittest.cc",
226 "source/metrics_unittest.cc",
227 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800228 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700229 ]
kjellanderbac04122016-06-02 02:18:48 -0700230
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200231 deps = [
Mirko Bonadeia498ae82017-12-06 09:17:14 +0100232 ":metrics_api",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200233 ":metrics_default",
234 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700235 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700236 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800237 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200238 "//testing/gtest",
239 ]
kjellanderbac04122016-06-02 02:18:48 -0700240
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200241 if (is_android) {
242 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700243
244 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200245 }
kjellanderbac04122016-06-02 02:18:48 -0700246 }
247}