blob: 9464c6b6e1ee0b660bfcbc036dfa0ece83bae19e [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
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200136 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000137}
138
139source_set("field_trial_default") {
140 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100141 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000142 "source/field_trial_default.cc",
143 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000144
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000145 configs += [ "..:common_config" ]
146 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000147}
148
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000149source_set("metrics_default") {
150 sources = [
asapersson01d70a32016-05-20 06:29:46 -0700151 "include/metrics_default.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000152 "source/metrics_default.cc",
153 ]
154
155 configs += [ "..:common_config" ]
156 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000157}
158
159source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000160 configs += [ "..:common_config" ]
161 public_configs = [ "..:common_inherited_config" ]
162
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000163 deps = [
164 ":field_trial_default",
165 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800166 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000167 ]
168}
169
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000170if (is_android) {
171 source_set("cpu_features_android") {
172 sources = [
173 "source/cpu_features_android.c",
174 ]
175
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000176 configs += [ "..:common_config" ]
177 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200178 deps = [
179 "//third_party/android_tools:cpu_features",
180 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000181 }
182}
simon.hosie953b1c12016-04-06 14:02:26 -0700183
184if (is_linux) {
185 source_set("cpu_features_linux") {
186 sources = [
187 "source/cpu_features_linux.c",
188 ]
189
190 configs += [ "..:common_config" ]
191 public_configs = [ "..:common_inherited_config" ]
192 }
193}
kjellanderbac04122016-06-02 02:18:48 -0700194
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200195if (rtc_include_tests) {
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200196 test("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",
kjellanderbac04122016-06-02 02:18:48 -0700215 ]
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200216 if (rtc_enable_data_logging) {
217 sources += [
218 "source/data_log_unittest.cc",
219 "source/data_log_unittest_disabled.cc",
220 ]
221 }
kjellanderbac04122016-06-02 02:18:48 -0700222
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200223 configs += [ "..:common_config" ]
224 public_configs = [ "..:common_inherited_config" ]
kjellanderbac04122016-06-02 02:18:48 -0700225
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200226 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellanderbac04122016-06-02 02:18:48 -0700227
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200228 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 }
kjellanderbac04122016-06-02 02:18:48 -0700233
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200234 deps = [
235 ":metrics_default",
236 ":system_wrappers",
237 "../test:test_support_main",
238 "//testing/gtest",
239 ]
kjellanderbac04122016-06-02 02:18:48 -0700240
kjellander@webrtc.orgdc0dbad2016-06-02 13:29:07 +0200241 if (is_android) {
242 deps += [ "//testing/android/native_test:native_test_support" ]
243 }
kjellanderbac04122016-06-02 02:18:48 -0700244 }
245}