blob: 208c9efae16a2e4845b13acdca0233602d27f6e1 [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
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000104 public_configs = [
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000105 "..:common_inherited_config",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000106 ]
107
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000108 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000109 sources += [ "source/data_log.cc" ]
110 } else {
111 sources += [ "source/data_log_no_op.cc" ]
112 }
113
114 defines = []
115 libs = []
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000116 deps = [ "..:webrtc_common" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000117
kjellander@webrtc.orgce22f132015-02-16 12:47:20 +0000118 if (rtc_use_direct_trace) {
119 defines += [ "WEBRTC_DIRECT_TRACE" ]
120 }
121
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000122 if (is_android) {
123 sources += [
124 "interface/logcat_trace_context.h",
125 "source/logcat_trace_context.cc",
126 ]
127
128 defines += [
129 "WEBRTC_THREAD_RR",
130 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
131 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
132 # remove it after I verify that CLOCK_MONOTONIC is fully functional
133 # with condition and event functions in system_wrappers.
134 "WEBRTC_CLOCK_TYPE_REALTIME",
135 ]
136
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000137 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000138
139 libs += [ "log" ]
140 }
141
142 if (is_linux) {
143 defines += [
144 "WEBRTC_THREAD_RR",
145 # TODO(andrew): can we select this automatically?
146 # Define this if the Linux system does not support CLOCK_MONOTONIC.
147 #"WEBRTC_CLOCK_TYPE_REALTIME",
148 ]
149
150 libs += [ "rt" ]
151 }
152
153 if (!is_mac && !is_ios) {
154 sources += [
155 "source/atomic32_posix.cc",
156 ]
157 }
158
159 if (is_ios || is_mac) {
160 defines += [
161 "WEBRTC_THREAD_RR",
162 "WEBRTC_CLOCK_TYPE_REALTIME",
163 ]
164 }
165
166 if (is_ios) {
167 sources += [
168 "source/atomic32_mac.cc",
169 ]
170 }
171
172 if (is_win) {
173 libs += [ "winmm.lib" ]
174
175 cflags = [
176 "/wd4267", # size_t to int truncation.
177 "/wd4334", # Ignore warning on shift operator promotion.
178 ]
179 }
180
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000181 deps += [
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000182 "../base:rtc_base_approved",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000183 ]
184}
185
186source_set("field_trial_default") {
187 sources = [
glaznev@webrtc.org669bc7e2015-02-09 18:17:46 +0000188 "interface/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000189 "source/field_trial_default.cc",
190 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000191
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000192 configs += [ "..:common_config" ]
193 public_configs = [ "..:common_inherited_config" ]
194
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000195 deps = [
196 ":system_wrappers",
197 ]
198}
199
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000200source_set("metrics_default") {
201 sources = [
202 "source/metrics_default.cc",
203 ]
204
205 configs += [ "..:common_config" ]
206 public_configs = [ "..:common_inherited_config" ]
207
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000208 deps = [
209 ":system_wrappers",
210 ]
211}
212
213source_set("system_wrappers_default") {
214
215 configs += [ "..:common_config" ]
216 public_configs = [ "..:common_inherited_config" ]
217
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000218 deps = [
219 ":field_trial_default",
220 ":metrics_default",
221 ]
222}
223
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000224if (is_android) {
225 source_set("cpu_features_android") {
226 sources = [
227 "source/cpu_features_android.c",
228 ]
229
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000230 configs += [ "..:common_config" ]
231 public_configs = [ "..:common_inherited_config" ]
232
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000233 if (is_android_webview_build) {
234 libs += [ "cpufeatures.a" ]
235 } else {
236 deps = [ "//third_party/android_tools:cpu_features" ]
237 }
238 }
239}