blob: 826113dae4ac8b6d06d3e77be9bddc76c705b94f [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",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000059 "source/logging.cc",
60 "source/rtp_to_ntp.cc",
61 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000062 "source/rw_lock_posix.cc",
63 "source/rw_lock_posix.h",
64 "source/rw_lock_win.cc",
65 "source/rw_lock_win.h",
tommi61046eb2016-01-19 02:59:56 -080066 "source/rw_lock_winxp_win.cc",
67 "source/rw_lock_winxp_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000068 "source/sleep.cc",
69 "source/sort.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000070 "source/timestamp_extrapolator.cc",
71 "source/trace_impl.cc",
72 "source/trace_impl.h",
73 "source/trace_posix.cc",
74 "source/trace_posix.h",
75 "source/trace_win.cc",
76 "source/trace_win.h",
77 ]
78
79 configs += [ "..:common_config" ]
80
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020081 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000082
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000083 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000084 sources += [ "source/data_log.cc" ]
85 } else {
86 sources += [ "source/data_log_no_op.cc" ]
87 }
88
89 defines = []
90 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020091 deps = [
92 "..:webrtc_common",
93 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000094
95 if (is_android) {
96 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010097 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000098 "source/logcat_trace_context.cc",
99 ]
100
sprange791ffd2016-01-26 01:53:20 -0800101 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000102
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000103 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000104
105 libs += [ "log" ]
106 }
107
108 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -0800109 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000110
simon.hosie953b1c12016-04-06 14:02:26 -0700111 if (!build_with_chromium) {
112 deps += [ ":cpu_features_linux" ]
113 }
114
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000115 libs += [ "rt" ]
116 }
117
kjellander080a1e32016-05-25 11:37:11 -0700118 if (is_linux || is_android) {
119 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000120 }
121
122 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -0800123 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -0700124 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000125 }
126
kjellander8f4419b2016-06-02 02:09:52 -0700127 # TODO(jschuh): Bug 1348: fix this warning.
128 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
129
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000130 if (is_win) {
131 libs += [ "winmm.lib" ]
132
kjellander8f4419b2016-06-02 02:09:52 -0700133 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000134 }
135
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700136 if (is_clang) {
137 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
138 configs -= [ "//build/config/clang:find_bad_constructs" ]
139 }
140
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200141 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000142}
143
144source_set("field_trial_default") {
145 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100146 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000147 "source/field_trial_default.cc",
148 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000149
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000150 configs += [ "..:common_config" ]
151 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000152}
153
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000154source_set("metrics_default") {
155 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700156 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000157 "source/metrics_default.cc",
158 ]
159
160 configs += [ "..:common_config" ]
161 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000162}
163
164source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000165 configs += [ "..:common_config" ]
166 public_configs = [ "..:common_inherited_config" ]
167
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000168 deps = [
169 ":field_trial_default",
170 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800171 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000172 ]
173}
174
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000175if (is_android) {
176 source_set("cpu_features_android") {
177 sources = [
178 "source/cpu_features_android.c",
179 ]
180
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000181 configs += [ "..:common_config" ]
182 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200183 deps = [
184 "//third_party/android_tools:cpu_features",
185 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000186 }
187}
simon.hosie953b1c12016-04-06 14:02:26 -0700188
189if (is_linux) {
190 source_set("cpu_features_linux") {
191 sources = [
192 "source/cpu_features_linux.c",
193 ]
194
195 configs += [ "..:common_config" ]
196 public_configs = [ "..:common_inherited_config" ]
197 }
198}
kjellanderbac04122016-06-02 02:18:48 -0700199
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200200if (rtc_include_tests) {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200201 test("system_wrappers_unittests") {
202 testonly = true
203 sources = [
204 "source/aligned_array_unittest.cc",
205 "source/aligned_malloc_unittest.cc",
206 "source/clock_unittest.cc",
207 "source/condition_variable_unittest.cc",
208 "source/critical_section_unittest.cc",
209 "source/data_log_c_helpers_unittest.c",
210 "source/data_log_c_helpers_unittest.h",
211 "source/data_log_helpers_unittest.cc",
212 "source/event_timer_posix_unittest.cc",
213 "source/logging_unittest.cc",
214 "source/metrics_default_unittest.cc",
215 "source/metrics_unittest.cc",
216 "source/ntp_time_unittest.cc",
217 "source/rtp_to_ntp_unittest.cc",
218 "source/stl_util_unittest.cc",
219 "source/stringize_macros_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700220 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200221 if (rtc_enable_data_logging) {
222 sources += [
223 "source/data_log_unittest.cc",
224 "source/data_log_unittest_disabled.cc",
225 ]
226 }
kjellanderbac04122016-06-02 02:18:48 -0700227
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200228 configs += [ "..:common_config" ]
229 public_configs = [ "..:common_inherited_config" ]
kjellanderbac04122016-06-02 02:18:48 -0700230
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200231 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700232
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200233 if (is_clang) {
234 # Suppress warnings from Chrome's Clang plugins.
235 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
236 configs -= [ "//build/config/clang:find_bad_constructs" ]
237 }
kjellanderbac04122016-06-02 02:18:48 -0700238
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200239 deps = [
240 ":metrics_default",
241 ":system_wrappers",
242 "../test:test_support_main",
243 "//testing/gtest",
244 ]
kjellanderbac04122016-06-02 02:18:48 -0700245
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200246 if (is_android) {
247 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700248
249 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200250 }
kjellanderbac04122016-06-02 02:18:48 -0700251 }
252}