blob: fb376fe3f60e18cf55a75d5c454b5c4fe020cec6 [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") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000016 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010017 "include/aligned_array.h",
18 "include/aligned_malloc.h",
19 "include/atomic32.h",
20 "include/clock.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010021 "include/cpu_info.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010022 "include/event_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010023 "include/file_wrapper.h",
kjellander080a1e32016-05-25 11:37:11 -070024 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080025 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010026 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010027 "include/sleep.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010028 "include/timestamp_extrapolator.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000029 "source/aligned_malloc.cc",
Yuwei Huang160c0202017-10-20 15:47:42 -070030 "source/atomic32.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000031 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020033 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000034 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020035 "source/event_timer_posix.cc",
36 "source/event_timer_posix.h",
37 "source/event_timer_win.cc",
38 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000039 "source/file_impl.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080040 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000041 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000042 "source/rw_lock_posix.cc",
43 "source/rw_lock_posix.h",
44 "source/rw_lock_win.cc",
45 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000046 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000047 "source/timestamp_extrapolator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000048 ]
49
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000050 defines = []
51 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020052 deps = [
53 "..:webrtc_common",
Ilya Nikolaevskiy558cabf2017-11-14 10:32:15 +010054 "../api:optional",
55 "../modules:module_api_public",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020056 ]
kjellander8a116632017-04-21 05:17:08 -070057 public_deps = [
58 ":cpu_features_api",
59 ":field_trial_api",
60 ":metrics_api",
61 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000062
63 if (is_android) {
sprange791ffd2016-01-26 01:53:20 -080064 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000065
kjellander@webrtc.org62711f82014-06-29 13:37:08 +000066 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000067
68 libs += [ "log" ]
69 }
70
71 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080072 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000073
simon.hosie953b1c12016-04-06 14:02:26 -070074 if (!build_with_chromium) {
75 deps += [ ":cpu_features_linux" ]
76 }
77
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000078 libs += [ "rt" ]
79 }
80
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000081 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080082 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000083 }
84
kjellander8f4419b2016-06-02 02:09:52 -070085 # TODO(jschuh): Bug 1348: fix this warning.
86 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
87
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000088 if (is_win) {
89 libs += [ "winmm.lib" ]
90
kjellander8f4419b2016-06-02 02:09:52 -070091 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander8a116632017-04-21 05:17:08 -070092
Jianjun Zhu037f3e42017-08-15 21:48:37 +080093 # Windows needs ../rtc_base:rtc_base due to include of
ehmaldonadof6a861a2017-07-19 10:40:47 -070094 # webrtc/rtc_base/win32.h in source/clock.cc.
kjellander8a116632017-04-21 05:17:08 -070095 # TODO(kjellander): Remove (bugs.webrtc.org/6828)
ehmaldonadof6a861a2017-07-19 10:40:47 -070096 deps += [ "../rtc_base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000097 }
98
ehmaldonado3e3b6f22016-08-29 02:56:06 -070099 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700100 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700101 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700102 }
103
Mirko Bonadeif6703c42017-11-15 16:14:28 +0000104 deps += [ "../rtc_base:rtc_base_approved" ]
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",
113 ]
114}
115
mbonadeib1d6b5492017-05-15 14:59:17 -0700116rtc_source_set("asm_defines") {
117 sources = [
118 "include/asm_defines.h",
119 ]
120}
121
kjellander8a116632017-04-21 05:17:08 -0700122rtc_source_set("field_trial_api") {
123 sources = [
124 "include/field_trial.h",
125 ]
126}
127
128rtc_source_set("metrics_api") {
129 sources = [
130 "include/metrics.h",
131 ]
132 deps = [
133 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700134 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700135 ]
136}
137
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200138rtc_source_set("field_trial_default") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000139 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100140 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000141 "source/field_trial_default.cc",
142 ]
kjellander8a116632017-04-21 05:17:08 -0700143 deps = [
144 ":field_trial_api",
145 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000146}
147
Mirko Bonadeic15b2dd2017-10-26 11:43:59 +0200148rtc_source_set("metrics_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000149 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700150 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000151 "source/metrics_default.cc",
152 ]
kjellander8a116632017-04-21 05:17:08 -0700153 deps = [
154 ":metrics_api",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700155 "../rtc_base:rtc_base_approved",
kjellander8a116632017-04-21 05:17:08 -0700156 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000157}
158
kjellanderb62dbbe2016-09-23 00:38:52 -0700159group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000160 deps = [
161 ":field_trial_default",
162 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800163 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000164 ]
165}
166
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000167if (is_android) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700168 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000169 sources = [
170 "source/cpu_features_android.c",
171 ]
172
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200173 deps = [
174 "//third_party/android_tools:cpu_features",
175 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000176 }
177}
simon.hosie953b1c12016-04-06 14:02:26 -0700178
179if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700180 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700181 sources = [
182 "source/cpu_features_linux.c",
183 ]
kjellander8a116632017-04-21 05:17:08 -0700184 deps = [
185 ":cpu_features_api",
186 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700187 }
188}
kjellanderbac04122016-06-02 02:18:48 -0700189
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200190if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700191 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200192 testonly = true
193 sources = [
194 "source/aligned_array_unittest.cc",
195 "source/aligned_malloc_unittest.cc",
196 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200197 "source/event_timer_posix_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200198 "source/metrics_default_unittest.cc",
199 "source/metrics_unittest.cc",
200 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800201 "source/rtp_to_ntp_estimator_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700202 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200203 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700204
kjellandere40a7ee2016-10-16 23:56:12 -0700205 if (!build_with_chromium && is_clang) {
206 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700207 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200208 }
kjellanderbac04122016-06-02 02:18:48 -0700209
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200210 deps = [
211 ":metrics_default",
212 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700213 "..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700214 "../rtc_base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800215 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200216 "//testing/gtest",
217 ]
kjellanderbac04122016-06-02 02:18:48 -0700218
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200219 if (is_android) {
220 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700221
222 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200223 }
kjellanderbac04122016-06-02 02:18:48 -0700224 }
225}