blob: 327c9af4b908447b7e4ba52da4e4f13e74252dcb [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}
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000013import("../build/webrtc.gni")
14
ehmaldonado38a21322016-09-02 04:10:34 -070015rtc_source_set("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_features_wrapper.h",
22 "include/cpu_info.h",
23 "include/critical_section_wrapper.h",
24 "include/data_log.h",
25 "include/data_log_c.h",
26 "include/data_log_impl.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010027 "include/event_wrapper.h",
28 "include/field_trial.h",
29 "include/file_wrapper.h",
30 "include/fix_interlocked_exchange_pointer_win.h",
31 "include/logging.h",
32 "include/metrics.h",
kjellander080a1e32016-05-25 11:37:11 -070033 "include/ntp_time.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010034 "include/rtp_to_ntp.h",
35 "include/rw_lock_wrapper.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010036 "include/sleep.h",
37 "include/sort.h",
38 "include/static_instance.h",
39 "include/stl_util.h",
40 "include/stringize_macros.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010041 "include/timestamp_extrapolator.h",
42 "include/trace.h",
43 "include/utf_util_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000044 "source/aligned_malloc.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000045 "source/atomic32_win.cc",
46 "source/clock.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000047 "source/condition_variable_event_win.cc",
48 "source/condition_variable_event_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000049 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020050 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000051 "source/data_log_c.cc",
52 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020053 "source/event_timer_posix.cc",
54 "source/event_timer_posix.h",
55 "source/event_timer_win.cc",
56 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000057 "source/file_impl.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000058 "source/logging.cc",
59 "source/rtp_to_ntp.cc",
60 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000061 "source/rw_lock_posix.cc",
62 "source/rw_lock_posix.h",
63 "source/rw_lock_win.cc",
64 "source/rw_lock_win.h",
tommi61046eb2016-01-19 02:59:56 -080065 "source/rw_lock_winxp_win.cc",
66 "source/rw_lock_winxp_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000067 "source/sleep.cc",
68 "source/sort.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000069 "source/timestamp_extrapolator.cc",
70 "source/trace_impl.cc",
71 "source/trace_impl.h",
72 "source/trace_posix.cc",
73 "source/trace_posix.h",
74 "source/trace_win.cc",
75 "source/trace_win.h",
76 ]
77
78 configs += [ "..:common_config" ]
79
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020080 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000081
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000082 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000083 sources += [ "source/data_log.cc" ]
84 } else {
85 sources += [ "source/data_log_no_op.cc" ]
86 }
87
88 defines = []
89 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020090 deps = [
91 "..:webrtc_common",
92 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000093
94 if (is_android) {
95 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +010096 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000097 "source/logcat_trace_context.cc",
98 ]
99
sprange791ffd2016-01-26 01:53:20 -0800100 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000101
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000102 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000103
104 libs += [ "log" ]
105 }
106
107 if (is_linux) {
sprange791ffd2016-01-26 01:53:20 -0800108 defines += [ "WEBRTC_THREAD_RR" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000109
simon.hosie953b1c12016-04-06 14:02:26 -0700110 if (!build_with_chromium) {
111 deps += [ ":cpu_features_linux" ]
112 }
113
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000114 libs += [ "rt" ]
115 }
116
kjellander080a1e32016-05-25 11:37:11 -0700117 if (is_linux || is_android) {
118 sources += [ "source/atomic32_non_darwin_unix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000119 }
120
121 if (is_ios || is_mac) {
sprange791ffd2016-01-26 01:53:20 -0800122 defines += [ "WEBRTC_THREAD_RR" ]
kjellander080a1e32016-05-25 11:37:11 -0700123 sources += [ "source/atomic32_darwin.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000124 }
125
kjellander8f4419b2016-06-02 02:09:52 -0700126 # TODO(jschuh): Bug 1348: fix this warning.
127 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
128
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000129 if (is_win) {
130 libs += [ "winmm.lib" ]
131
kjellander8f4419b2016-06-02 02:09:52 -0700132 cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000133 }
134
ehmaldonado3e3b6f22016-08-29 02:56:06 -0700135 if (is_win && is_clang) {
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700136 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700137 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonadod02fe4b2016-08-26 13:31:24 -0700138 }
139
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200140 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000141}
142
ehmaldonado38a21322016-09-02 04:10:34 -0700143rtc_source_set("field_trial_default") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000144 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100145 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000146 "source/field_trial_default.cc",
147 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000148
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000149 configs += [ "..:common_config" ]
150 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000151}
152
ehmaldonado38a21322016-09-02 04:10:34 -0700153rtc_source_set("metrics_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000154 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700155 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000156 "source/metrics_default.cc",
157 ]
158
159 configs += [ "..:common_config" ]
160 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000161}
162
ehmaldonado38a21322016-09-02 04:10:34 -0700163rtc_source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000164 configs += [ "..:common_config" ]
165 public_configs = [ "..:common_inherited_config" ]
166
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000167 deps = [
168 ":field_trial_default",
169 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800170 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000171 ]
172}
173
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000174if (is_android) {
ehmaldonado38a21322016-09-02 04:10:34 -0700175 rtc_source_set("cpu_features_android") {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000176 sources = [
177 "source/cpu_features_android.c",
178 ]
179
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000180 configs += [ "..:common_config" ]
181 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200182 deps = [
183 "//third_party/android_tools:cpu_features",
184 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000185 }
186}
simon.hosie953b1c12016-04-06 14:02:26 -0700187
188if (is_linux) {
ehmaldonado38a21322016-09-02 04:10:34 -0700189 rtc_source_set("cpu_features_linux") {
simon.hosie953b1c12016-04-06 14:02:26 -0700190 sources = [
191 "source/cpu_features_linux.c",
192 ]
193
194 configs += [ "..:common_config" ]
195 public_configs = [ "..:common_inherited_config" ]
196 }
197}
kjellanderbac04122016-06-02 02:18:48 -0700198
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200199if (rtc_include_tests) {
ehmaldonado38a21322016-09-02 04:10:34 -0700200 rtc_test("system_wrappers_unittests") {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200201 testonly = true
202 sources = [
203 "source/aligned_array_unittest.cc",
204 "source/aligned_malloc_unittest.cc",
205 "source/clock_unittest.cc",
206 "source/condition_variable_unittest.cc",
207 "source/critical_section_unittest.cc",
208 "source/data_log_c_helpers_unittest.c",
209 "source/data_log_c_helpers_unittest.h",
210 "source/data_log_helpers_unittest.cc",
211 "source/event_timer_posix_unittest.cc",
212 "source/logging_unittest.cc",
213 "source/metrics_default_unittest.cc",
214 "source/metrics_unittest.cc",
215 "source/ntp_time_unittest.cc",
216 "source/rtp_to_ntp_unittest.cc",
217 "source/stl_util_unittest.cc",
218 "source/stringize_macros_unittest.cc",
kjellanderbac04122016-06-02 02:18:48 -0700219 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200220 if (rtc_enable_data_logging) {
221 sources += [
222 "source/data_log_unittest.cc",
223 "source/data_log_unittest_disabled.cc",
224 ]
225 }
kjellanderbac04122016-06-02 02:18:48 -0700226
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200227 configs += [ "..:common_config" ]
228 public_configs = [ "..:common_inherited_config" ]
kjellanderbac04122016-06-02 02:18:48 -0700229
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200230 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700231
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200232 if (is_clang) {
233 # Suppress warnings from Chrome's Clang plugins.
234 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700235 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200236 }
kjellanderbac04122016-06-02 02:18:48 -0700237
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200238 deps = [
239 ":metrics_default",
240 ":system_wrappers",
241 "../test:test_support_main",
242 "//testing/gtest",
243 ]
kjellanderbac04122016-06-02 02:18:48 -0700244
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200245 if (is_android) {
246 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700247
248 shard_timeout = 900
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200249 }
kjellanderbac04122016-06-02 02:18:48 -0700250 }
251}