blob: 6c681f290b2bf70c1d7339a85667b1863a0b842b [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",
kjellander080a1e32016-05-25 11:37:11 -070020 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080021 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010022 "include/sleep.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000023 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000024 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020025 "source/cpu_info.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080026 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000027 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000028 ]
29
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000030 defines = []
31 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020032 deps = [
kjellander8a116632017-04-21 05:17:08 -070033 ":cpu_features_api",
Ilya Nikolaevskiyf1cc3a22018-11-12 15:03:51 +010034 "../api:array_view",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010035 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010036 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010037 "../rtc_base/synchronization:rw_lock_wrapper",
Niels Möllera12c42a2018-07-25 16:05:48 +020038 "../rtc_base/system:arch",
Danil Chapovalov196100e2018-06-21 10:17:24 +020039 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070040 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000041
42 if (is_android) {
Dan Minor9c686132018-01-15 10:20:00 -050043 if (build_with_mozilla) {
44 include_dirs = [
45 "/config/external/nspr",
46 "/nsprpub/lib/ds",
47 "/nsprpub/pr/include",
48 ]
49 } else {
50 deps += [ ":cpu_features_android" ]
51 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000052
53 libs += [ "log" ]
54 }
55
56 if (is_linux) {
simon.hosie953b1c12016-04-06 14:02:26 -070057 if (!build_with_chromium) {
58 deps += [ ":cpu_features_linux" ]
59 }
60
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000061 libs += [ "rt" ]
62 }
63
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000064 if (is_win) {
65 libs += [ "winmm.lib" ]
66
Artem Titov94b57c02019-03-21 13:35:10 +010067 # Windows needs ../rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070068 # webrtc/rtc_base/win32.h in source/clock.cc.
Artem Titov94b57c02019-03-21 13:35:10 +010069 deps += [ "../rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000070 }
71
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000072 deps += [
73 "../rtc_base:rtc_base_approved",
74 "../rtc_base:rtc_numerics",
75 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000076}
77
kjellander8a116632017-04-21 05:17:08 -070078rtc_source_set("cpu_features_api") {
79 sources = [
80 "include/cpu_features_wrapper.h",
81 ]
kjellander8a116632017-04-21 05:17:08 -070082}
83
Mirko Bonadei92e00382018-09-15 10:37:11 +020084rtc_source_set("field_trial") {
85 visibility = [ "*" ]
86 public = [
kjellander8a116632017-04-21 05:17:08 -070087 "include/field_trial.h",
88 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +020089 sources = [
90 "source/field_trial.cc",
91 ]
92 if (rtc_exclude_field_trial_default) {
93 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
94 }
Mirko Bonadei9acf1c12018-10-19 17:17:34 +020095 if (build_with_chromium) {
96 # When WebRTC is built as part of Chromium it should exclude the default
97 # implementation of field_trial unless it is building for NACL or
98 # Chromecast.
99 if (!is_nacl && !is_chromecast) {
100 deps = [
101 "../../webrtc_overrides:field_trial",
102 ]
103 }
104 }
Mirko Bonadei92e00382018-09-15 10:37:11 +0200105}
106
Niels Möllere8fd57c2019-03-28 15:10:17 +0100107rtc_source_set("event_wrapper") {
108 visibility = [
109 "../modules/video_coding",
110 "../modules/video_coding:video_coding_unittests",
111 ]
112 sources = [
113 "include/event_wrapper.h",
114 "source/event.cc",
115 ]
116 deps = [
117 "../rtc_base:rtc_event",
118 ]
119}
120
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200121rtc_source_set("metrics") {
122 visibility = [ "*" ]
123 public = [
124 "include/metrics.h",
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200125 ]
126 sources = [
127 "source/metrics.cc",
128 ]
129 if (rtc_exclude_metrics_default) {
130 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
131 }
132 deps = [
133 "..:webrtc_common",
134 "../rtc_base:checks",
135 "../rtc_base:rtc_base_approved",
136 ]
Mirko Bonadei9acf1c12018-10-19 17:17:34 +0200137 if (build_with_chromium) {
138 deps += [ "../../webrtc_overrides:metrics" ]
139 }
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200140}
141
Dan Minor9c686132018-01-15 10:20:00 -0500142if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700143 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000144 sources = [
145 "source/cpu_features_android.c",
146 ]
147
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200148 deps = [
149 "//third_party/android_tools:cpu_features",
150 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000151 }
152}
simon.hosie953b1c12016-04-06 14:02:26 -0700153
154if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700155 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700156 sources = [
157 "source/cpu_features_linux.c",
158 ]
kjellander8a116632017-04-21 05:17:08 -0700159 deps = [
160 ":cpu_features_api",
Niels Möllera12c42a2018-07-25 16:05:48 +0200161 "../rtc_base/system:arch",
kjellander8a116632017-04-21 05:17:08 -0700162 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700163 }
164}
kjellanderbac04122016-06-02 02:18:48 -0700165
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200166if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700167 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200168 testonly = true
169 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200170 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200171 "source/metrics_default_unittest.cc",
172 "source/metrics_unittest.cc",
173 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800174 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700175 ]
kjellanderbac04122016-06-02 02:18:48 -0700176
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200177 deps = [
Mirko Bonadei17f48782018-09-28 08:51:10 +0200178 ":metrics",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200179 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700180 "..:webrtc_common",
Yves Gerey3e707812018-11-28 16:47:49 +0100181 "../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700182 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800183 "../test:test_main",
Yves Gerey21cddff2018-10-30 21:12:42 +0100184 "../test:test_support",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200185 "//testing/gtest",
186 ]
kjellanderbac04122016-06-02 02:18:48 -0700187
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200188 if (is_android) {
189 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700190
191 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200192 }
kjellanderbac04122016-06-02 02:18:48 -0700193 }
194}