Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / system_wrappers / BUILD.gn
1 # 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
9 import("//build/config/android/config.gni")
10 import("../build/webrtc.gni")
11
12 config("system_wrappers_inherited_config") {
13   include_dirs = [
14     "interface",
15   ]
16 }
17
18 static_library("system_wrappers") {
19   sources = [
20     "interface/aligned_array.h",
21     "interface/aligned_malloc.h",
22     "interface/atomic32.h",
23     "interface/clock.h",
24     "interface/compile_assert.h",
25     "interface/condition_variable_wrapper.h",
26     "interface/cpu_info.h",
27     "interface/cpu_features_wrapper.h",
28     "interface/critical_section_wrapper.h",
29     "interface/data_log.h",
30     "interface/data_log_c.h",
31     "interface/data_log_impl.h",
32     "interface/event_tracer.h",
33     "interface/event_wrapper.h",
34     "interface/field_trial.h",
35     "interface/file_wrapper.h",
36     "interface/fix_interlocked_exchange_pointer_win.h",
37     "interface/logging.h",
38     "interface/metrics.h",
39     "interface/ref_count.h",
40     "interface/rtp_to_ntp.h",
41     "interface/rw_lock_wrapper.h",
42     "interface/scoped_ptr.h",
43     "interface/scoped_refptr.h",
44     "interface/scoped_vector.h",
45     "interface/sleep.h",
46     "interface/sort.h",
47     "interface/static_instance.h",
48     "interface/stl_util.h",
49     "interface/stringize_macros.h",
50     "interface/thread_wrapper.h",
51     "interface/tick_util.h",
52     "interface/timestamp_extrapolator.h",
53     "interface/trace.h",
54     "interface/trace_event.h",
55     "interface/utf_util_win.h",
56     "source/aligned_malloc.cc",
57     "source/atomic32_mac.cc",
58     "source/atomic32_win.cc",
59     "source/clock.cc",
60     "source/condition_variable.cc",
61     "source/condition_variable_posix.cc",
62     "source/condition_variable_posix.h",
63     "source/condition_variable_event_win.cc",
64     "source/condition_variable_event_win.h",
65     "source/condition_variable_native_win.cc",
66     "source/condition_variable_native_win.h",
67     "source/cpu_info.cc",
68     "source/cpu_features.cc",
69     "source/critical_section.cc",
70     "source/critical_section_posix.cc",
71     "source/critical_section_posix.h",
72     "source/critical_section_win.cc",
73     "source/critical_section_win.h",
74     "source/data_log_c.cc",
75     "source/event.cc",
76     "source/event_posix.cc",
77     "source/event_posix.h",
78     "source/event_tracer.cc",
79     "source/event_win.cc",
80     "source/event_win.h",
81     "source/file_impl.cc",
82     "source/file_impl.h",
83     "source/logging.cc",
84     "source/rtp_to_ntp.cc",
85     "source/rw_lock.cc",
86     "source/rw_lock_generic.cc",
87     "source/rw_lock_generic.h",
88     "source/rw_lock_posix.cc",
89     "source/rw_lock_posix.h",
90     "source/rw_lock_win.cc",
91     "source/rw_lock_win.h",
92     "source/set_thread_name_win.h",
93     "source/sleep.cc",
94     "source/sort.cc",
95     "source/tick_util.cc",
96     "source/thread.cc",
97     "source/thread_posix.cc",
98     "source/thread_posix.h",
99     "source/thread_win.cc",
100     "source/thread_win.h",
101     "source/timestamp_extrapolator.cc",
102     "source/trace_impl.cc",
103     "source/trace_impl.h",
104     "source/trace_posix.cc",
105     "source/trace_posix.h",
106     "source/trace_win.cc",
107     "source/trace_win.h",
108   ]
109
110   configs += [ "..:common_config" ]
111
112   if (is_clang) {
113     # Suppress warnings from Chrome's Clang plugins.
114     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
115     configs -= [ "//build/config/clang:find_bad_constructs" ]
116   }
117
118   public_configs = [
119     "..:common_inherited_config",
120     ":system_wrappers_inherited_config",
121   ]
122
123   if (rtc_enable_data_logging) {
124     sources += [ "source/data_log.cc" ]
125   } else {
126     sources += [ "source/data_log_no_op.cc" ]
127   }
128
129   defines = []
130   libs = []
131   deps = []
132
133   if (is_android) {
134     sources += [
135       "interface/logcat_trace_context.h",
136       "source/logcat_trace_context.cc",
137     ]
138
139     defines += [
140       "WEBRTC_THREAD_RR",
141       # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
142       # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
143       # remove it after I verify that CLOCK_MONOTONIC is fully functional
144       # with condition and event functions in system_wrappers.
145       "WEBRTC_CLOCK_TYPE_REALTIME",
146     ]
147
148     deps += [ ":cpu_features_android" ]
149
150     libs += [ "log" ]
151   }
152
153   if (is_linux) {
154     defines += [
155       "WEBRTC_THREAD_RR",
156       # TODO(andrew): can we select this automatically?
157       # Define this if the Linux system does not support CLOCK_MONOTONIC.
158       #"WEBRTC_CLOCK_TYPE_REALTIME",
159     ]
160
161     libs += [ "rt" ]
162   }
163
164   if (!is_mac && !is_ios) {
165     sources += [
166       "source/atomic32_posix.cc",
167     ]
168   }
169
170   if (is_ios || is_mac) {
171     defines += [
172       "WEBRTC_THREAD_RR",
173       "WEBRTC_CLOCK_TYPE_REALTIME",
174     ]
175   }
176
177   if (is_ios) {
178     sources += [
179       "source/atomic32_mac.cc",
180     ]
181   }
182
183   if (is_win) {
184     libs += [ "winmm.lib" ]
185
186     cflags = [
187       "/wd4267",  # size_t to int truncation.
188       "/wd4334",  # Ignore warning on shift operator promotion.
189     ]
190   }
191
192   include_dirs = [
193     "source/spreadsortlib",
194   ]
195
196   deps += [
197     "../base:rtc_base_approved",
198   ]
199 }
200
201 source_set("field_trial_default") {
202   sources = [
203     "source/field_trial_default.cc",
204   ]
205
206   configs += [ "..:common_config" ]
207   public_configs = [ "..:common_inherited_config" ]
208
209   if (is_clang) {
210     # Suppress warnings from Chrome's Clang plugins.
211     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
212     configs -= [ "//build/config/clang:find_bad_constructs" ]
213   }
214
215   deps = [
216     ":system_wrappers",
217   ]
218 }
219
220 source_set("metrics_default") {
221   sources = [
222     "source/metrics_default.cc",
223   ]
224
225   configs += [ "..:common_config" ]
226   public_configs = [ "..:common_inherited_config" ]
227
228   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   }
233
234   deps = [
235     ":system_wrappers",
236   ]
237 }
238
239 source_set("system_wrappers_default") {
240
241   configs += [ "..:common_config" ]
242   public_configs = [ "..:common_inherited_config" ]
243
244   if (is_clang) {
245     # Suppress warnings from Chrome's Clang plugins.
246     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
247     configs -= [ "//build/config/clang:find_bad_constructs" ]
248   }
249
250   deps = [
251     ":field_trial_default",
252     ":metrics_default",
253   ]
254 }
255
256 if (is_android) {
257   source_set("cpu_features_android") {
258     sources = [
259       "source/cpu_features_android.c",
260     ]
261
262     configs += [ "..:common_config" ]
263     public_configs = [ "..:common_inherited_config" ]
264
265     if (is_android_webview_build) {
266       libs += [ "cpufeatures.a" ]
267     } else {
268       deps = [ "//third_party/android_tools:cpu_features" ]
269     }
270   }
271 }