blob: eb6005226593b4eea44b19fd94afe830b8391dbc [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",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010036 "..:webrtc_common",
Mirko Bonadeia498ae82017-12-06 09:17:14 +010037 "../modules:module_api_public",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010038 "../rtc_base:checks",
Karl Wiberg2b857922018-03-23 14:53:54 +010039 "../rtc_base/synchronization:rw_lock_wrapper",
Niels Möllera12c42a2018-07-25 16:05:48 +020040 "../rtc_base/system:arch",
Danil Chapovalov196100e2018-06-21 10:17:24 +020041 "//third_party/abseil-cpp/absl/types:optional",
kjellander8a116632017-04-21 05:17:08 -070042 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000043
44 if (is_android) {
sprange791ffd2016-01-26 01:53:20 -080045 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000046
Dan Minor9c686132018-01-15 10:20:00 -050047 if (build_with_mozilla) {
48 include_dirs = [
49 "/config/external/nspr",
50 "/nsprpub/lib/ds",
51 "/nsprpub/pr/include",
52 ]
53 } else {
54 deps += [ ":cpu_features_android" ]
55 }
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000056
57 libs += [ "log" ]
58 }
59
60 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080061 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000062
simon.hosie953b1c12016-04-06 14:02:26 -070063 if (!build_with_chromium) {
64 deps += [ ":cpu_features_linux" ]
65 }
66
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000067 libs += [ "rt" ]
68 }
69
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000070 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080071 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000072 }
73
74 if (is_win) {
75 libs += [ "winmm.lib" ]
76
Jianjun Zhu037f3e42017-08-15 21:48:37 +080077 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070078 # webrtc/rtc_base/win32.h in source/clock.cc.
ehmaldonadof6a861a2017-07-19 10:40:47 -070079 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000080 }
81
Ilya Nikolaevskiy8b64fd82017-11-15 16:48:04 +000082 deps += [
83 "../rtc_base:rtc_base_approved",
84 "../rtc_base:rtc_numerics",
85 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000086}
87
kjellander8a116632017-04-21 05:17:08 -070088rtc_source_set("cpu_features_api") {
89 sources = [
90 "include/cpu_features_wrapper.h",
91 ]
92 deps = [
93 "..:webrtc_common",
94 ]
95}
96
Mirko Bonadei92e00382018-09-15 10:37:11 +020097rtc_source_set("field_trial") {
98 visibility = [ "*" ]
99 public = [
kjellander8a116632017-04-21 05:17:08 -0700100 "include/field_trial.h",
101 ]
Mirko Bonadei92e00382018-09-15 10:37:11 +0200102 sources = [
103 "source/field_trial.cc",
104 ]
105 if (rtc_exclude_field_trial_default) {
106 defines = [ "WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT" ]
107 }
108}
109
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200110rtc_source_set("metrics") {
111 visibility = [ "*" ]
112 public = [
113 "include/metrics.h",
Mirko Bonadeic1c2a882018-09-06 13:34:51 +0200114 ]
115 sources = [
116 "source/metrics.cc",
117 ]
118 if (rtc_exclude_metrics_default) {
119 defines = [ "WEBRTC_EXCLUDE_METRICS_DEFAULT" ]
120 }
121 deps = [
122 "..:webrtc_common",
123 "../rtc_base:checks",
124 "../rtc_base:rtc_base_approved",
125 ]
126}
127
Dan Minor9c686132018-01-15 10:20:00 -0500128if (is_android && !build_with_mozilla) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700129 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000130 sources = [
131 "source/cpu_features_android.c",
132 ]
133
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200134 deps = [
135 "//third_party/android_tools:cpu_features",
136 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000137 }
138}
simon.hosie953b1c12016-04-06 14:02:26 -0700139
140if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700141 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700142 sources = [
143 "source/cpu_features_linux.c",
144 ]
kjellander8a116632017-04-21 05:17:08 -0700145 deps = [
146 ":cpu_features_api",
Niels Möllera12c42a2018-07-25 16:05:48 +0200147 "../rtc_base/system:arch",
kjellander8a116632017-04-21 05:17:08 -0700148 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700149 }
150}
kjellanderbac04122016-06-02 02:18:48 -0700151
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200152if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700153 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200154 testonly = true
155 sources = [
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200156 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200157 "source/metrics_default_unittest.cc",
158 "source/metrics_unittest.cc",
159 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800160 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700161 ]
kjellanderbac04122016-06-02 02:18:48 -0700162
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200163 deps = [
Mirko Bonadei17f48782018-09-28 08:51:10 +0200164 ":metrics",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200165 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700166 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700167 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800168 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200169 "//testing/gtest",
170 ]
kjellanderbac04122016-06-02 02:18:48 -0700171
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200172 if (is_android) {
173 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700174
175 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200176 }
kjellanderbac04122016-06-02 02:18:48 -0700177 }
178}