blob: 4c6c6051c9d445cba3147e630520070d128f58b0 [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
9import("../build/webrtc.gni")
10
11config("system_wrappers_inherited_config") {
12 include_dirs = [
13 "interface",
14 ]
15}
16
17static_library("system_wrappers") {
18 sources = [
19 "interface/aligned_malloc.h",
20 "interface/atomic32.h",
21 "interface/clock.h",
22 "interface/compile_assert.h",
23 "interface/condition_variable_wrapper.h",
24 "interface/cpu_info.h",
25 "interface/cpu_features_wrapper.h",
26 "interface/critical_section_wrapper.h",
27 "interface/data_log.h",
28 "interface/data_log_c.h",
29 "interface/data_log_impl.h",
30 "interface/event_tracer.h",
31 "interface/event_wrapper.h",
32 "interface/field_trial.h",
33 "interface/file_wrapper.h",
34 "interface/fix_interlocked_exchange_pointer_win.h",
35 "interface/logging.h",
36 "interface/ref_count.h",
37 "interface/rtp_to_ntp.h",
38 "interface/rw_lock_wrapper.h",
39 "interface/scoped_ptr.h",
40 "interface/scoped_refptr.h",
41 "interface/scoped_vector.h",
42 "interface/sleep.h",
43 "interface/sort.h",
44 "interface/static_instance.h",
45 "interface/stl_util.h",
46 "interface/stringize_macros.h",
47 "interface/thread_annotations.h",
48 "interface/thread_wrapper.h",
49 "interface/tick_util.h",
50 "interface/timestamp_extrapolator.h",
51 "interface/trace.h",
52 "interface/trace_event.h",
53 "interface/utf_util_win.h",
54 "source/aligned_malloc.cc",
55 "source/atomic32_mac.cc",
56 "source/atomic32_win.cc",
57 "source/clock.cc",
58 "source/condition_variable.cc",
59 "source/condition_variable_posix.cc",
60 "source/condition_variable_posix.h",
61 "source/condition_variable_event_win.cc",
62 "source/condition_variable_event_win.h",
63 "source/condition_variable_native_win.cc",
64 "source/condition_variable_native_win.h",
65 "source/cpu_info.cc",
66 "source/cpu_features.cc",
67 "source/critical_section.cc",
68 "source/critical_section_posix.cc",
69 "source/critical_section_posix.h",
70 "source/critical_section_win.cc",
71 "source/critical_section_win.h",
72 "source/data_log_c.cc",
73 "source/event.cc",
74 "source/event_posix.cc",
75 "source/event_posix.h",
76 "source/event_tracer.cc",
77 "source/event_win.cc",
78 "source/event_win.h",
79 "source/file_impl.cc",
80 "source/file_impl.h",
81 "source/logging.cc",
82 "source/rtp_to_ntp.cc",
83 "source/rw_lock.cc",
84 "source/rw_lock_generic.cc",
85 "source/rw_lock_generic.h",
86 "source/rw_lock_posix.cc",
87 "source/rw_lock_posix.h",
88 "source/rw_lock_win.cc",
89 "source/rw_lock_win.h",
90 "source/set_thread_name_win.h",
91 "source/sleep.cc",
92 "source/sort.cc",
93 "source/tick_util.cc",
94 "source/thread.cc",
95 "source/thread_posix.cc",
96 "source/thread_posix.h",
97 "source/thread_win.cc",
98 "source/thread_win.h",
99 "source/timestamp_extrapolator.cc",
100 "source/trace_impl.cc",
101 "source/trace_impl.h",
102 "source/trace_posix.cc",
103 "source/trace_posix.h",
104 "source/trace_win.cc",
105 "source/trace_win.h",
106 ]
107
108 configs += [ "..:common_config" ]
109
110 direct_dependent_configs = [
111 "..:common_inherited_config",
112 ":system_wrappers_inherited_config",
113 ]
114
115 if (enable_data_logging) {
116 sources += [ "source/data_log.cc" ]
117 } else {
118 sources += [ "source/data_log_no_op.cc" ]
119 }
120
121 defines = []
122 libs = []
123
124 if (is_android) {
125 sources += [
126 "interface/logcat_trace_context.h",
127 "source/logcat_trace_context.cc",
128 ]
129
130 defines += [
131 "WEBRTC_THREAD_RR",
132 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
133 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
134 # remove it after I verify that CLOCK_MONOTONIC is fully functional
135 # with condition and event functions in system_wrappers.
136 "WEBRTC_CLOCK_TYPE_REALTIME",
137 ]
138
139 deps = [ "cpu_features_android" ]
140
141 libs += [ "log" ]
142 }
143
144 if (is_linux) {
145 defines += [
146 "WEBRTC_THREAD_RR",
147 # TODO(andrew): can we select this automatically?
148 # Define this if the Linux system does not support CLOCK_MONOTONIC.
149 #"WEBRTC_CLOCK_TYPE_REALTIME",
150 ]
151
152 libs += [ "rt" ]
153 }
154
155 if (!is_mac && !is_ios) {
156 sources += [
157 "source/atomic32_posix.cc",
158 ]
159 }
160
161 if (is_ios || is_mac) {
162 defines += [
163 "WEBRTC_THREAD_RR",
164 "WEBRTC_CLOCK_TYPE_REALTIME",
165 ]
166 }
167
168 if (is_ios) {
169 sources += [
170 "source/atomic32_mac.cc",
171 ]
172 }
173
174 if (is_win) {
175 libs += [ "winmm.lib" ]
176
177 cflags = [
178 "/wd4267", # size_t to int truncation.
179 "/wd4334", # Ignore warning on shift operator promotion.
180 ]
181 }
182
183 include_dirs = [
184 "source/spreadsortlib",
185 ]
186
187 deps = [
188 "../base:webrtc_base",
189 ]
190}
191
192source_set("field_trial_default") {
193 sources = [
194 "source/field_trial_default.cc",
195 ]
196 deps = [
197 ":system_wrappers",
198 ]
199}
200
201if (is_android) {
202 source_set("cpu_features_android") {
203 sources = [
204 "source/cpu_features_android.c",
205 ]
206
207 if (is_android_webview_build) {
208 libs += [ "cpufeatures.a" ]
209 } else {
210 deps = [ "//third_party/android_tools:cpu_features" ]
211 }
212 }
213}