blob: 07b8bec5dc1ba355bac1fd4198aa5e04a1457cc5 [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}
13import("//testing/test.gni")
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000014import("../build/webrtc.gni")
15
kjellanderbac04122016-06-02 02:18:48 -070016source_set("system_wrappers") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000017 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010018 "include/aligned_array.h",
19 "include/aligned_malloc.h",
20 "include/atomic32.h",
21 "include/clock.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010022 "include/cpu_features_wrapper.h",
23 "include/cpu_info.h",
24 "include/critical_section_wrapper.h",
25 "include/data_log.h",
26 "include/data_log_c.h",
27 "include/data_log_impl.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010028 "include/event_wrapper.h",
29 "include/field_trial.h",
30 "include/file_wrapper.h",
31 "include/fix_interlocked_exchange_pointer_win.h",
32 "include/logging.h",
33 "include/metrics.h",
kjellander080a1e32016-05-25 11:37:11 -070034 "include/ntp_time.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010035 "include/rtp_to_ntp.h",
36 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010037 "include/sleep.h",
38 "include/sort.h",
39 "include/static_instance.h",
40 "include/stl_util.h",
41 "include/stringize_macros.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010042 "include/timestamp_extrapolator.h",
43 "include/trace.h",
44 "include/utf_util_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000045 "source/aligned_malloc.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000046 "source/atomic32_win.cc",
47 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000048 "source/condition_variable_event_win.cc",
49 "source/condition_variable_event_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000050 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020051 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000052 "source/data_log_c.cc",
53 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020054 "source/event_timer_posix.cc",
55 "source/event_timer_posix.h",
56 "source/event_timer_win.cc",
57 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000058 "source/file_impl.cc",
59 "source/file_impl.h",
60 "source/logging.cc",
61 "source/rtp_to_ntp.cc",
62 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000063 "source/rw_lock_posix.cc",
64 "source/rw_lock_posix.h",
65 "source/rw_lock_win.cc",
66 "source/rw_lock_win.h",
tommi61046eb2016-01-19 02:59:56 -080067 "source/rw_lock_winxp_win.cc",
68 "source/rw_lock_winxp_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000069 "source/sleep.cc",
70 "source/sort.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000071 "source/timestamp_extrapolator.cc",
72 "source/trace_impl.cc",
73 "source/trace_impl.h",
74 "source/trace_posix.cc",
75 "source/trace_posix.h",
76 "source/trace_win.cc",
77 "source/trace_win.h",
78 ]
79
80 configs += [ "..:common_config" ]
81
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020082 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000083
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000084 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000085 sources += [ "source/data_log.cc" ]
86 } else {
87 sources += [ "source/data_log_no_op.cc" ]
88 }
89
90 defines = []
91 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020092 deps = [
93 "..:webrtc_common",
94 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000095
96 if (is_android) {
97 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010098 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000099 "source/logcat_trace_context.cc",
100 ]
101
sprange791ffd2016-01-26 01:53:20 -0800102 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000103
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000104 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000105
106 libs += [ "log" ]
107 }
108
109 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -0800110 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000111
simon.hosie953b1c12016-04-06 14:02:26 -0700112 if (!build_with_chromium) {
113 deps += [ ":cpu_features_linux" ]
114 }
115
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000116 libs += [ "rt" ]
117 }
118
kjellander080a1e32016-05-25 11:37:11 -0700119 if (is_linux || is_android) {
120 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000121 }
122
123 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -0800124 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -0700125 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000126 }
127
kjellander8f4419b2016-06-02 02:09:52 -0700128 # TODO(jschuh): Bug 1348: fix this warning.
129 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
130
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000131 if (is_win) {
132 libs += [ "winmm.lib" ]
133
kjellander8f4419b2016-06-02 02:09:52 -0700134 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000135 }
136
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200137 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000138}
139
140source_set("field_trial_default") {
141 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100142 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000143 "source/field_trial_default.cc",
144 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000145
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000146 configs += [ "..:common_config" ]
147 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000148}
149
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000150source_set("metrics_default") {
151 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700152 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000153 "source/metrics_default.cc",
154 ]
155
156 configs += [ "..:common_config" ]
157 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000158}
159
160source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000161 configs += [ "..:common_config" ]
162 public_configs = [ "..:common_inherited_config" ]
163
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000164 deps = [
165 ":field_trial_default",
166 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800167 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000168 ]
169}
170
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000171if (is_android) {
172 source_set("cpu_features_android") {
173 sources = [
174 "source/cpu_features_android.c",
175 ]
176
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000177 configs += [ "..:common_config" ]
178 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200179 deps = [
180 "//third_party/android_tools:cpu_features",
181 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000182 }
183}
simon.hosie953b1c12016-04-06 14:02:26 -0700184
185if (is_linux) {
186 source_set("cpu_features_linux") {
187 sources = [
188 "source/cpu_features_linux.c",
189 ]
190
191 configs += [ "..:common_config" ]
192 public_configs = [ "..:common_inherited_config" ]
193 }
194}
kjellanderbac04122016-06-02 02:18:48 -0700195
196test("system_wrappers_unittests") {
197 testonly = true
198 sources = [
199 "source/aligned_array_unittest.cc",
200 "source/aligned_malloc_unittest.cc",
201 "source/clock_unittest.cc",
202 "source/condition_variable_unittest.cc",
203 "source/critical_section_unittest.cc",
204 "source/data_log_c_helpers_unittest.c",
205 "source/data_log_c_helpers_unittest.h",
206 "source/data_log_helpers_unittest.cc",
207 "source/event_timer_posix_unittest.cc",
208 "source/logging_unittest.cc",
209 "source/metrics_default_unittest.cc",
210 "source/metrics_unittest.cc",
211 "source/ntp_time_unittest.cc",
212 "source/rtp_to_ntp_unittest.cc",
213 "source/stl_util_unittest.cc",
214 "source/stringize_macros_unittest.cc",
215 ]
216 if (rtc_enable_data_logging) {
217 sources += [
218 "source/data_log_unittest.cc",
219 "source/data_log_unittest_disabled.cc",
220 ]
221 }
222
223 configs += [ "..:common_config" ]
224 public_configs = [ "..:common_inherited_config" ]
225
226 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
227
228 if (is_clang) {
229 # Suppress warnings from Chrome's Clang plugins.
230 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
231 configs -= [ "//build/config/clang:find_bad_constructs" ]
232 }
233
234 deps = [
235 ":metrics_default",
236 ":system_wrappers",
237 "../test:test_support_main",
238 "//testing/gtest",
239 ]
240
241 if (is_android) {
242 deps += [ "//testing/android/native_test:native_test_support" ]
243 }
244}