blob: 720fa871dbe8b6e5c0a5d48f5c5d4070bd27360e [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
kjellander@webrtc.org62711f82014-06-29 13:37:08 +00009import("//build/config/android/config.gni")
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000010import("../build/webrtc.gni")
11
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000012static_library("system_wrappers") {
13 sources = [
andrew@webrtc.org325cff02014-10-01 17:42:18 +000014 "interface/aligned_array.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000015 "interface/aligned_malloc.h",
16 "interface/atomic32.h",
17 "interface/clock.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000018 "interface/condition_variable_wrapper.h",
19 "interface/cpu_info.h",
20 "interface/cpu_features_wrapper.h",
21 "interface/critical_section_wrapper.h",
22 "interface/data_log.h",
23 "interface/data_log_c.h",
24 "interface/data_log_impl.h",
25 "interface/event_tracer.h",
26 "interface/event_wrapper.h",
27 "interface/field_trial.h",
28 "interface/file_wrapper.h",
29 "interface/fix_interlocked_exchange_pointer_win.h",
30 "interface/logging.h",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +000031 "interface/metrics.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000032 "interface/ref_count.h",
33 "interface/rtp_to_ntp.h",
34 "interface/rw_lock_wrapper.h",
35 "interface/scoped_ptr.h",
36 "interface/scoped_refptr.h",
37 "interface/scoped_vector.h",
38 "interface/sleep.h",
39 "interface/sort.h",
40 "interface/static_instance.h",
41 "interface/stl_util.h",
42 "interface/stringize_macros.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000043 "interface/thread_wrapper.h",
44 "interface/tick_util.h",
45 "interface/timestamp_extrapolator.h",
46 "interface/trace.h",
47 "interface/trace_event.h",
48 "interface/utf_util_win.h",
49 "source/aligned_malloc.cc",
50 "source/atomic32_mac.cc",
51 "source/atomic32_win.cc",
52 "source/clock.cc",
53 "source/condition_variable.cc",
54 "source/condition_variable_posix.cc",
55 "source/condition_variable_posix.h",
56 "source/condition_variable_event_win.cc",
57 "source/condition_variable_event_win.h",
58 "source/condition_variable_native_win.cc",
59 "source/condition_variable_native_win.h",
60 "source/cpu_info.cc",
61 "source/cpu_features.cc",
62 "source/critical_section.cc",
63 "source/critical_section_posix.cc",
64 "source/critical_section_posix.h",
65 "source/critical_section_win.cc",
66 "source/critical_section_win.h",
67 "source/data_log_c.cc",
68 "source/event.cc",
69 "source/event_posix.cc",
70 "source/event_posix.h",
71 "source/event_tracer.cc",
72 "source/event_win.cc",
73 "source/event_win.h",
74 "source/file_impl.cc",
75 "source/file_impl.h",
76 "source/logging.cc",
77 "source/rtp_to_ntp.cc",
78 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000079 "source/rw_lock_generic.cc",
80 "source/rw_lock_generic.h",
81 "source/rw_lock_posix.cc",
82 "source/rw_lock_posix.h",
83 "source/rw_lock_win.cc",
84 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000085 "source/set_thread_name_win.h",
86 "source/sleep.cc",
87 "source/sort.cc",
88 "source/tick_util.cc",
89 "source/thread.cc",
90 "source/thread_posix.cc",
91 "source/thread_posix.h",
92 "source/thread_win.cc",
93 "source/thread_win.h",
94 "source/timestamp_extrapolator.cc",
95 "source/trace_impl.cc",
96 "source/trace_impl.h",
97 "source/trace_posix.cc",
98 "source/trace_posix.h",
99 "source/trace_win.cc",
100 "source/trace_win.h",
101 ]
102
103 configs += [ "..:common_config" ]
104
andrew@webrtc.org325cff02014-10-01 17:42:18 +0000105 if (is_clang) {
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000106 # Suppress warnings from Chrome's Clang plugins.
107 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
108 configs -= [ "//build/config/clang:find_bad_constructs" ]
109 }
110
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000111 public_configs = [
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000112 "..:common_inherited_config",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000113 ]
114
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000115 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000116 sources += [ "source/data_log.cc" ]
117 } else {
118 sources += [ "source/data_log_no_op.cc" ]
119 }
120
121 defines = []
122 libs = []
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000123 deps = []
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000124
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000125 if (rtc_use_direct_trace) {
126 defines += [ "WEBRTC_DIRECT_TRACE" ]
127 }
128
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000129 if (is_android) {
130 sources += [
131 "interface/logcat_trace_context.h",
132 "source/logcat_trace_context.cc",
133 ]
134
135 defines += [
136 "WEBRTC_THREAD_RR",
137 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
138 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
139 # remove it after I verify that CLOCK_MONOTONIC is fully functional
140 # with condition and event functions in system_wrappers.
141 "WEBRTC_CLOCK_TYPE_REALTIME",
142 ]
143
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000144 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000145
146 libs += [ "log" ]
147 }
148
149 if (is_linux) {
150 defines += [
151 "WEBRTC_THREAD_RR",
152 # TODO(andrew): can we select this automatically?
153 # Define this if the Linux system does not support CLOCK_MONOTONIC.
154 #"WEBRTC_CLOCK_TYPE_REALTIME",
155 ]
156
157 libs += [ "rt" ]
158 }
159
160 if (!is_mac && !is_ios) {
161 sources += [
162 "source/atomic32_posix.cc",
163 ]
164 }
165
166 if (is_ios || is_mac) {
167 defines += [
168 "WEBRTC_THREAD_RR",
169 "WEBRTC_CLOCK_TYPE_REALTIME",
170 ]
171 }
172
173 if (is_ios) {
174 sources += [
175 "source/atomic32_mac.cc",
176 ]
177 }
178
179 if (is_win) {
180 libs += [ "winmm.lib" ]
181
182 cflags = [
183 "/wd4267", # size_t to int truncation.
184 "/wd4334", # Ignore warning on shift operator promotion.
185 ]
186 }
187
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000188 deps += [
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000189 "../base:rtc_base_approved",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000190 ]
191}
192
193source_set("field_trial_default") {
194 sources = [
glaznev@webrtc.org669bc7e2015-02-09 18:17:46 +0000195 "interface/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000196 "source/field_trial_default.cc",
197 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000198
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000199 configs += [ "..:common_config" ]
200 public_configs = [ "..:common_inherited_config" ]
201
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000202 if (is_clang) {
203 # Suppress warnings from Chrome's Clang plugins.
204 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
205 configs -= [ "//build/config/clang:find_bad_constructs" ]
206 }
207
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000208 deps = [
209 ":system_wrappers",
210 ]
211}
212
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000213source_set("metrics_default") {
214 sources = [
215 "source/metrics_default.cc",
216 ]
217
218 configs += [ "..:common_config" ]
219 public_configs = [ "..:common_inherited_config" ]
220
221 if (is_clang) {
222 # Suppress warnings from Chrome's Clang plugins.
223 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
224 configs -= [ "//build/config/clang:find_bad_constructs" ]
225 }
226
227 deps = [
228 ":system_wrappers",
229 ]
230}
231
232source_set("system_wrappers_default") {
233
234 configs += [ "..:common_config" ]
235 public_configs = [ "..:common_inherited_config" ]
236
237 if (is_clang) {
238 # Suppress warnings from Chrome's Clang plugins.
239 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
240 configs -= [ "//build/config/clang:find_bad_constructs" ]
241 }
242
243 deps = [
244 ":field_trial_default",
245 ":metrics_default",
246 ]
247}
248
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000249if (is_android) {
250 source_set("cpu_features_android") {
251 sources = [
252 "source/cpu_features_android.c",
253 ]
254
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000255 configs += [ "..:common_config" ]
256 public_configs = [ "..:common_inherited_config" ]
257
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000258 if (is_android_webview_build) {
259 libs += [ "cpufeatures.a" ]
260 } else {
261 deps = [ "//third_party/android_tools:cpu_features" ]
262 }
263 }
264}