blob: 805f07f19dfe89bffd9a5eae2b4788cdd6ae767c [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/sleep.cc",
86 "source/sort.cc",
87 "source/tick_util.cc",
88 "source/thread.cc",
89 "source/thread_posix.cc",
90 "source/thread_posix.h",
91 "source/thread_win.cc",
92 "source/thread_win.h",
93 "source/timestamp_extrapolator.cc",
94 "source/trace_impl.cc",
95 "source/trace_impl.h",
96 "source/trace_posix.cc",
97 "source/trace_posix.h",
98 "source/trace_win.cc",
99 "source/trace_win.h",
100 ]
101
102 configs += [ "..:common_config" ]
103
andrew@webrtc.org325cff02014-10-01 17:42:18 +0000104 if (is_clang) {
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000105 # Suppress warnings from Chrome's Clang plugins.
106 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
107 configs -= [ "//build/config/clang:find_bad_constructs" ]
108 }
109
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000110 public_configs = [
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000111 "..:common_inherited_config",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000112 ]
113
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000114 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000115 sources += [ "source/data_log.cc" ]
116 } else {
117 sources += [ "source/data_log_no_op.cc" ]
118 }
119
120 defines = []
121 libs = []
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000122 deps = []
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000123
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000124 if (rtc_use_direct_trace) {
125 defines += [ "WEBRTC_DIRECT_TRACE" ]
126 }
127
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000128 if (is_android) {
129 sources += [
130 "interface/logcat_trace_context.h",
131 "source/logcat_trace_context.cc",
132 ]
133
134 defines += [
135 "WEBRTC_THREAD_RR",
136 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
137 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
138 # remove it after I verify that CLOCK_MONOTONIC is fully functional
139 # with condition and event functions in system_wrappers.
140 "WEBRTC_CLOCK_TYPE_REALTIME",
141 ]
142
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000143 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000144
145 libs += [ "log" ]
146 }
147
148 if (is_linux) {
149 defines += [
150 "WEBRTC_THREAD_RR",
151 # TODO(andrew): can we select this automatically?
152 # Define this if the Linux system does not support CLOCK_MONOTONIC.
153 #"WEBRTC_CLOCK_TYPE_REALTIME",
154 ]
155
156 libs += [ "rt" ]
157 }
158
159 if (!is_mac && !is_ios) {
160 sources += [
161 "source/atomic32_posix.cc",
162 ]
163 }
164
165 if (is_ios || is_mac) {
166 defines += [
167 "WEBRTC_THREAD_RR",
168 "WEBRTC_CLOCK_TYPE_REALTIME",
169 ]
170 }
171
172 if (is_ios) {
173 sources += [
174 "source/atomic32_mac.cc",
175 ]
176 }
177
178 if (is_win) {
179 libs += [ "winmm.lib" ]
180
181 cflags = [
182 "/wd4267", # size_t to int truncation.
183 "/wd4334", # Ignore warning on shift operator promotion.
184 ]
185 }
186
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000187 deps += [
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000188 "../base:rtc_base_approved",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000189 ]
190}
191
192source_set("field_trial_default") {
193 sources = [
glaznev@webrtc.org669bc7e2015-02-09 18:17:46 +0000194 "interface/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000195 "source/field_trial_default.cc",
196 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000197
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000198 configs += [ "..:common_config" ]
199 public_configs = [ "..:common_inherited_config" ]
200
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000201 if (is_clang) {
202 # Suppress warnings from Chrome's Clang plugins.
203 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
204 configs -= [ "//build/config/clang:find_bad_constructs" ]
205 }
206
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000207 deps = [
208 ":system_wrappers",
209 ]
210}
211
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000212source_set("metrics_default") {
213 sources = [
214 "source/metrics_default.cc",
215 ]
216
217 configs += [ "..:common_config" ]
218 public_configs = [ "..:common_inherited_config" ]
219
220 if (is_clang) {
221 # Suppress warnings from Chrome's Clang plugins.
222 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
223 configs -= [ "//build/config/clang:find_bad_constructs" ]
224 }
225
226 deps = [
227 ":system_wrappers",
228 ]
229}
230
231source_set("system_wrappers_default") {
232
233 configs += [ "..:common_config" ]
234 public_configs = [ "..:common_inherited_config" ]
235
236 if (is_clang) {
237 # Suppress warnings from Chrome's Clang plugins.
238 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
239 configs -= [ "//build/config/clang:find_bad_constructs" ]
240 }
241
242 deps = [
243 ":field_trial_default",
244 ":metrics_default",
245 ]
246}
247
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000248if (is_android) {
249 source_set("cpu_features_android") {
250 sources = [
251 "source/cpu_features_android.c",
252 ]
253
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000254 configs += [ "..:common_config" ]
255 public_configs = [ "..:common_inherited_config" ]
256
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000257 if (is_android_webview_build) {
258 libs += [ "cpufeatures.a" ]
259 } else {
260 deps = [ "//third_party/android_tools:cpu_features" ]
261 }
262 }
263}