blob: 9b178f92eb152f7a35930fbfea9ff9d62a17d670 [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 "../api:optional",
44 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010045 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010046 "../rtc_base/synchronization:rw_lock_wrapper",
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
kjellander8f4419b2016-06-02 02:09:52 -070089 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander8a116632017-04-21 05:17:08 -070090
Jianjun Zhu037f3e42017-08-15 21:48:37 +080091 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070092 # webrtc/rtc_base/win32.h in source/clock.cc.
ehmaldonadof6a861a2017-07-19 10:40:47 -070093 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000094 }
95
ehmaldonado3e3b6f22016-08-29 02:56:06 -070096 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -070097 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070098 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -070099 }
100
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +0000101 deps += [
102 "../rtc_base:rtc_base_approved",
103 "../rtc_base:rtc_numerics",
104 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000105}
106
kjellander8a116632017-04-21 05:17:08 -0700107rtc_source_set("cpu_features_api") {
108 sources = [
109 "include/cpu_features_wrapper.h",
110 ]
111 deps = [
112 "..:webrtc_common",
Patrik Höglund3e113432017-12-15 14:40:10 +0100113 "../:typedefs",
kjellander8a116632017-04-21 05:17:08 -0700114 ]
115}
116
117rtc_source_set("field_trial_api") {
118 sources = [
119 "include/field_trial.h",
120 ]
121}
122
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100123rtc_source_set("runtime_enabled_features_api") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100124 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100125 sources = [
126 "include/runtime_enabled_features.h",
127 ]
128}
129
kjellander8a116632017-04-21 05:17:08 -0700130rtc_source_set("metrics_api") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000131 visibility = [ "*" ]
kjellander8a116632017-04-21 05:17:08 -0700132 sources = [
133 "include/metrics.h",
134 ]
135 deps = [
136 "..:webrtc_common",
Patrik Höglunda8005cf2017-12-13 16:05:42 +0100137 "../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700138 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700139 ]
140}
141
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200142rtc_source_set("field_trial_default") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000143 visibility = [ "*" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000144 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100145 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000146 "source/field_trial_default.cc",
147 ]
kjellander8a116632017-04-21 05:17:08 -0700148 deps = [
149 ":field_trial_api",
150 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000151}
152
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100153rtc_source_set("runtime_enabled_features_default") {
Ilya Nikolaevskiy6e6a9552018-01-17 11:53:23 +0100154 visibility = [ "*" ]
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100155 sources = [
156 "source/runtime_enabled_features_default.cc",
157 ]
158 deps = [
159 ":runtime_enabled_features_api",
160 "../rtc_base:rtc_base_approved",
161 ]
162}
163
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200164rtc_source_set("metrics_default") {
Per Kjellandera7f2d842018-01-10 15:54:53 +0000165 visibility = [ "*" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000166 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700167 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000168 "source/metrics_default.cc",
169 ]
kjellander8a116632017-04-21 05:17:08 -0700170 deps = [
171 ":metrics_api",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700172 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700173 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000174}
175
kjellanderb62dbbe2016-09-23 00:38:52 -0700176group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000177 deps = [
178 ":field_trial_default",
179 ":metrics_default",
Ilya Nikolaevskiy8cf45e92018-01-15 10:16:54 +0100180 ":runtime_enabled_features_default",
pbos12411ef2015-11-23 14:47:56 -0800181 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000182 ]
183}
184
Dan Minor9c686132018-01-15 10:20:00 -0500185if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700186 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000187 sources = [
188 "source/cpu_features_android.c",
189 ]
190
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200191 deps = [
192 "//third_party/android_tools:cpu_features",
193 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000194 }
195}
simon.hosie953b1c12016-04-06 14:02:26 -0700196
197if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700198 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700199 sources = [
200 "source/cpu_features_linux.c",
201 ]
kjellander8a116632017-04-21 05:17:08 -0700202 deps = [
203 ":cpu_features_api",
204 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700205 }
206}
kjellanderbac04122016-06-02 02:18:48 -0700207
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200208if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700209 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200210 testonly = true
211 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200212 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200213 "source/metrics_default_unittest.cc",
214 "source/metrics_unittest.cc",
215 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800216 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700217 ]
kjellanderbac04122016-06-02 02:18:48 -0700218
Fabrice de Gans-Riberi450cdf32018-04-17 12:56:01 -0700219 if (is_posix || is_fuchsia) {
Mirko Bonadeibeb2d982018-06-20 14:52:15 +0200220 sources += [ "source/event_timer_posix_unittest.cc" ]
Fabrice de Gans-Riberi450cdf32018-04-17 12:56:01 -0700221 }
222
kjellandere40a7ee2016-10-16 23:56:12 -0700223 if (!build_with_chromium && is_clang) {
224 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700225 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200226 }
kjellanderbac04122016-06-02 02:18:48 -0700227
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200228 deps = [
Mirko Bonadeia498ae82017-12-06 09:17:14 +0100229 ":metrics_api",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200230 ":metrics_default",
231 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700232 "..:webrtc_common",
Patrik Höglund3e113432017-12-15 14:40:10 +0100233 "../:typedefs",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700234 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800235 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200236 "//testing/gtest",
237 ]
kjellanderbac04122016-06-02 02:18:48 -0700238
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200239 if (is_android) {
240 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700241
242 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200243 }
kjellanderbac04122016-06-02 02:18:48 -0700244 }
245}