blob: 6a056c2d9c737a82b541bed8ce3f8f8811b02166 [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",
24 "include/fix_interlocked_exchange_pointer_win.h",
kjellander080a1e32016-05-25 11:37:11 -070025 "include/ntp_time.h",
asaperssonfe50b4d2016-12-22 07:53:51 -080026 "include/rtp_to_ntp_estimator.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010027 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010028 "include/sleep.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010029 "include/static_instance.h",
mbonadei3d7b0e22017-04-26 00:38:48 -070030 "include/stringize_macros.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010031 "include/timestamp_extrapolator.h",
32 "include/trace.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000033 "source/aligned_malloc.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000034 "source/atomic32_win.cc",
35 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000036 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020037 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000038 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020039 "source/event_timer_posix.cc",
40 "source/event_timer_posix.h",
41 "source/event_timer_win.cc",
42 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000043 "source/file_impl.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -080044 "source/rtp_to_ntp_estimator.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000045 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000046 "source/rw_lock_posix.cc",
47 "source/rw_lock_posix.h",
48 "source/rw_lock_win.cc",
49 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000050 "source/sleep.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000051 "source/timestamp_extrapolator.cc",
52 "source/trace_impl.cc",
53 "source/trace_impl.h",
54 "source/trace_posix.cc",
55 "source/trace_posix.h",
56 "source/trace_win.cc",
57 "source/trace_win.h",
58 ]
59
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000060 defines = []
61 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020062 deps = [
63 "..:webrtc_common",
64 ]
kjellander8a116632017-04-21 05:17:08 -070065 public_deps = [
66 ":cpu_features_api",
67 ":field_trial_api",
68 ":metrics_api",
69 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000070
71 if (is_android) {
72 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010073 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000074 "source/logcat_trace_context.cc",
75 ]
76
sprange791ffd2016-01-26 01:53:20 -080077 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000078
kjellander@webrtc.org62711f82014-06-29 13:37:08 +000079 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000080
81 libs += [ "log" ]
82 }
83
84 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -080085 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000086
simon.hosie953b1c12016-04-06 14:02:26 -070087 if (!build_with_chromium) {
88 deps += [ ":cpu_features_linux" ]
89 }
90
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000091 libs += [ "rt" ]
92 }
93
kjellander080a1e32016-05-25 11:37:11 -070094 if (is_linux || is_android) {
95 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000096 }
97
98 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -080099 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -0700100 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000101 }
102
kjellander8f4419b2016-06-02 02:09:52 -0700103 # TODO(jschuh): Bug 1348: fix this warning.
104 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
105
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000106 if (is_win) {
107 libs += [ "winmm.lib" ]
108
kjellander8f4419b2016-06-02 02:09:52 -0700109 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander8a116632017-04-21 05:17:08 -0700110
111 # Windows needs //webrtc/base:rtc_base due to include of webrtc/base/win32.h
112 # in source/clock.cc.
113 # TODO(kjellander): Remove (bugs.webrtc.org/6828)
114 deps += [ "../base:rtc_base" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000115 }
116
ehmaldonado3e3b6f22016-08-29 02:56:06 -0700117 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700118 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700119 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700120 }
121
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200122 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000123}
124
kjellander8a116632017-04-21 05:17:08 -0700125rtc_source_set("cpu_features_api") {
126 sources = [
127 "include/cpu_features_wrapper.h",
128 ]
129 deps = [
130 "..:webrtc_common",
131 ]
132}
133
134rtc_source_set("field_trial_api") {
135 sources = [
136 "include/field_trial.h",
137 ]
138}
139
140rtc_source_set("metrics_api") {
141 sources = [
142 "include/metrics.h",
143 ]
144 deps = [
145 "..:webrtc_common",
146 "../base:rtc_base_approved",
147 ]
148}
149
kjellanderb62dbbe2016-09-23 00:38:52 -0700150rtc_static_library("field_trial_default") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000151 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100152 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000153 "source/field_trial_default.cc",
154 ]
kjellander8a116632017-04-21 05:17:08 -0700155 deps = [
156 ":field_trial_api",
157 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000158}
159
kjellanderb62dbbe2016-09-23 00:38:52 -0700160rtc_static_library("metrics_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000161 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700162 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000163 "source/metrics_default.cc",
164 ]
kjellander8a116632017-04-21 05:17:08 -0700165 deps = [
166 ":metrics_api",
167 "../base:rtc_base_approved",
168 ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000169}
170
kjellanderb62dbbe2016-09-23 00:38:52 -0700171group("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000172 deps = [
173 ":field_trial_default",
174 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800175 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000176 ]
177}
178
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000179if (is_android) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700180 rtc_static_library("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000181 sources = [
182 "source/cpu_features_android.c",
183 ]
184
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200185 deps = [
186 "//third_party/android_tools:cpu_features",
187 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000188 }
189}
simon.hosie953b1c12016-04-06 14:02:26 -0700190
191if (is_linux) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700192 rtc_static_library("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700193 sources = [
194 "source/cpu_features_linux.c",
195 ]
kjellander8a116632017-04-21 05:17:08 -0700196 deps = [
197 ":cpu_features_api",
198 ]
simon.hosie953b1c12016-04-06 14:02:26 -0700199 }
200}
kjellanderbac04122016-06-02 02:18:48 -0700201
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200202if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700203 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200204 testonly = true
205 sources = [
206 "source/aligned_array_unittest.cc",
207 "source/aligned_malloc_unittest.cc",
208 "source/clock_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200209 "source/event_timer_posix_unittest.cc",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200210 "source/metrics_default_unittest.cc",
211 "source/metrics_unittest.cc",
212 "source/ntp_time_unittest.cc",
asaperssonfe50b4d2016-12-22 07:53:51 -0800213 "source/rtp_to_ntp_estimator_unittest.cc",
mbonadei3d7b0e22017-04-26 00:38:48 -0700214 "source/stringize_macros_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700215 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200216 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700217
kjellandere40a7ee2016-10-16 23:56:12 -0700218 if (!build_with_chromium && is_clang) {
219 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700220 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200221 }
kjellanderbac04122016-06-02 02:18:48 -0700222
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200223 deps = [
224 ":metrics_default",
225 ":system_wrappers",
kjellander8a116632017-04-21 05:17:08 -0700226 "..:webrtc_common",
227 "../base:rtc_base_approved",
ehmaldonado26bddb92016-11-30 06:12:01 -0800228 "../test:test_main",
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200229 "//testing/gtest",
230 ]
kjellanderbac04122016-06-02 02:18:48 -0700231
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200232 if (is_android) {
233 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700234
235 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200236 }
kjellanderbac04122016-06-02 02:18:48 -0700237 }
238}