blob: 4c09164abd7178c789840c352ae0c0083d9866b8 [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",
Peter Boström64c03662015-04-08 11:24:19 +020028 "source/event_timer_win.cc",
29 "source/event_timer_win.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080030 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000031 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 ]
33
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000034 defines = []
35 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020036 deps = [
kjellander8a116632017-04-21 05:17:08 -070037 ":cpu_features_api",
38 ":field_trial_api",
39 ":metrics_api",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +010040 ":runtime_enabled_features_api",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010041 "..:webrtc_common",
Patrik Höglund3e113432017-12-15 14:40:10 +010042 "../:typedefs",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010043 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010044 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010045 "../rtc_base/synchronization:rw_lock_wrapper",
Danil Chapovalov196100e2018-06-21 10:17:24 +020046 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070047 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000048
Fabrice de Gans-Riberi450cdf32018-04-17 12:56:01 -070049 if (is_posix || is_fuchsia) {
50 sources += [
51 "source/event_timer_posix.cc",
52 "source/event_timer_posix.h",
53 ]
54 }
55
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000056 if (is_android) {
sprange791ffd2016-01-26 01:53:20 -080057 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000058
Dan Minor9c686132018-01-15 10:20:00 -050059 if (build_with_mozilla) {
60 include_dirs = [
61 "/config/external/nspr",
62 "/nsprpub/lib/ds",
63 "/nsprpub/pr/include",
64 ]
65 } else {
66 deps += [ ":cpu_features_android" ]
67 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000068
69 libs += [ "log" ]
70 }
71
72 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080073 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000074
simon.hosie953b1c12016-04-06 14:02:26 -070075 if (!build_with_chromium) {
76 deps += [ ":cpu_features_linux" ]
77 }
78
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000079 libs += [ "rt" ]
80 }
81
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000082 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080083 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000084 }
85
86 if (is_win) {
87 libs += [ "winmm.lib" ]
88
Jianjun Zhu037f3e42017-08-15 21:48:37 +080089 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070090 # webrtc/rtc_base/win32.h in source/clock.cc.
ehmaldonadof6a861a2017-07-19 10:40:47 -070091 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000092 }
93
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000094 deps += [
95 "../rtc_base:rtc_base_approved",
96 "../rtc_base:rtc_numerics",
97 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000098}
99
kjellander8a116632017-04-21 05:17:08 -0700100rtc_source_set("cpu_features_api") {
101 sources = [
102 "include/cpu_features_wrapper.h",
103 ]
104 deps = [
105 "..:webrtc_common",
Patrik Höglund3e113432017-12-15 14:40:10 +0100106 "../:typedefs",
kjellander8a116632017-04-21 05:17:08 -0700107 ]
108}
109
110rtc_source_set("field_trial_api") {
111 sources = [
112 "include/field_trial.h",
113 ]
114}
115
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100116rtc_source_set("runtime_enabled_features_api") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100117 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100118 sources = [
119 "include/runtime_enabled_features.h",
120 ]
121}
122
kjellander8a116632017-04-21 05:17:08 -0700123rtc_source_set("metrics_api") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000124 visibility = [ "*" ]
kjellander8a116632017-04-21 05:17:08 -0700125 sources = [
126 "include/metrics.h",
127 ]
128 deps = [
129 "..:webrtc_common",
Patrik Höglunda8005cf2017-12-13 16:05:42 +0100130 "../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700131 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700132 ]
133}
134
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200135rtc_source_set("field_trial_default") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000136 visibility = [ "*" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000137 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100138 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000139 "source/field_trial_default.cc",
140 ]
kjellander8a116632017-04-21 05:17:08 -0700141 deps = [
142 ":field_trial_api",
143 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000144}
145
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100146rtc_source_set("runtime_enabled_features_default") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100147 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100148 sources = [
149 "source/runtime_enabled_features_default.cc",
150 ]
151 deps = [
152 ":runtime_enabled_features_api",
153 "../rtc_base:rtc_base_approved",
154 ]
155}
156
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200157rtc_source_set("metrics_default") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000158 visibility = [ "*" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000159 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700160 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000161 "source/metrics_default.cc",
162 ]
kjellander8a116632017-04-21 05:17:08 -0700163 deps = [
164 ":metrics_api",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700165 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700166 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000167}
168
kjellanderb62dbbe2016-09-23 00:38:52 -0700169group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000170 deps = [
171 ":field_trial_default",
172 ":metrics_default",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100173 ":runtime_enabled_features_default",
pbos12411ef2015-11-23 14:47:56 -0800174 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000175 ]
176}
177
Dan Minor9c686132018-01-15 10:20:00 -0500178if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700179 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000180 sources = [
181 "source/cpu_features_android.c",
182 ]
183
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200184 deps = [
185 "//third_party/android_tools:cpu_features",
186 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000187 }
188}
simon.hosie953b1c12016-04-06 14:02:26 -0700189
190if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700191 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700192 sources = [
193 "source/cpu_features_linux.c",
194 ]
kjellander8a116632017-04-21 05:17:08 -0700195 deps = [
196 ":cpu_features_api",
197 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700198 }
199}
kjellanderbac04122016-06-02 02:18:48 -0700200
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200201if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700202 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200203 testonly = true
204 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200205 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200206 "source/metrics_default_unittest.cc",
207 "source/metrics_unittest.cc",
208 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800209 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700210 ]
kjellanderbac04122016-06-02 02:18:48 -0700211
Fabrice de Gans-Riberi450cdf32018-04-17 12:56:01 -0700212 if (is_posix || is_fuchsia) {
Mirko Bonadeibeb2d982018-06-20 14:52:15 +0200213 sources += [ "source/event_timer_posix_unittest.cc" ]
Fabrice de Gans-Riberi450cdf32018-04-17 12:56:01 -0700214 }
215
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200216 deps = [
Mirko Bonadeia498ae82017-12-06 09:17:14 +0100217 ":metrics_api",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200218 ":metrics_default",
219 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700220 "..:webrtc_common",
Patrik Höglund3e113432017-12-15 14:40:10 +0100221 "../:typedefs",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700222 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800223 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200224 "//testing/gtest",
225 ]
kjellanderbac04122016-06-02 02:18:48 -0700226
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200227 if (is_android) {
228 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700229
230 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200231 }
kjellanderbac04122016-06-02 02:18:48 -0700232 }
233}