blob: c193c28b77fee985f58e43df5415a0a88b94d9de [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
12config("system_wrappers_inherited_config") {
13 include_dirs = [
14 "interface",
15 ]
16}
17
18static_library("system_wrappers") {
19 sources = [
andrew@webrtc.org325cff02014-10-01 17:42:18 +000020 "interface/aligned_array.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000021 "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/ref_count.h",
39 "interface/rtp_to_ntp.h",
40 "interface/rw_lock_wrapper.h",
41 "interface/scoped_ptr.h",
42 "interface/scoped_refptr.h",
43 "interface/scoped_vector.h",
44 "interface/sleep.h",
45 "interface/sort.h",
46 "interface/static_instance.h",
47 "interface/stl_util.h",
48 "interface/stringize_macros.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000049 "interface/thread_wrapper.h",
50 "interface/tick_util.h",
51 "interface/timestamp_extrapolator.h",
52 "interface/trace.h",
53 "interface/trace_event.h",
54 "interface/utf_util_win.h",
55 "source/aligned_malloc.cc",
56 "source/atomic32_mac.cc",
57 "source/atomic32_win.cc",
58 "source/clock.cc",
59 "source/condition_variable.cc",
60 "source/condition_variable_posix.cc",
61 "source/condition_variable_posix.h",
62 "source/condition_variable_event_win.cc",
63 "source/condition_variable_event_win.h",
64 "source/condition_variable_native_win.cc",
65 "source/condition_variable_native_win.h",
66 "source/cpu_info.cc",
67 "source/cpu_features.cc",
68 "source/critical_section.cc",
69 "source/critical_section_posix.cc",
70 "source/critical_section_posix.h",
71 "source/critical_section_win.cc",
72 "source/critical_section_win.h",
73 "source/data_log_c.cc",
74 "source/event.cc",
75 "source/event_posix.cc",
76 "source/event_posix.h",
77 "source/event_tracer.cc",
78 "source/event_win.cc",
79 "source/event_win.h",
80 "source/file_impl.cc",
81 "source/file_impl.h",
82 "source/logging.cc",
83 "source/rtp_to_ntp.cc",
84 "source/rw_lock.cc",
85 "source/rw_lock_generic.cc",
86 "source/rw_lock_generic.h",
87 "source/rw_lock_posix.cc",
88 "source/rw_lock_posix.h",
89 "source/rw_lock_win.cc",
90 "source/rw_lock_win.h",
91 "source/set_thread_name_win.h",
92 "source/sleep.cc",
93 "source/sort.cc",
94 "source/tick_util.cc",
95 "source/thread.cc",
96 "source/thread_posix.cc",
97 "source/thread_posix.h",
98 "source/thread_win.cc",
99 "source/thread_win.h",
100 "source/timestamp_extrapolator.cc",
101 "source/trace_impl.cc",
102 "source/trace_impl.h",
103 "source/trace_posix.cc",
104 "source/trace_posix.h",
105 "source/trace_win.cc",
106 "source/trace_win.h",
107 ]
108
109 configs += [ "..:common_config" ]
110
andrew@webrtc.org325cff02014-10-01 17:42:18 +0000111 if (is_clang) {
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000112 # Suppress warnings from Chrome's Clang plugins.
113 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
114 configs -= [ "//build/config/clang:find_bad_constructs" ]
115 }
116
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000117 public_configs = [
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000118 "..:common_inherited_config",
119 ":system_wrappers_inherited_config",
120 ]
121
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000122 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000123 sources += [ "source/data_log.cc" ]
124 } else {
125 sources += [ "source/data_log_no_op.cc" ]
126 }
127
128 defines = []
129 libs = []
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000130 deps = []
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000131
132 if (is_android) {
133 sources += [
134 "interface/logcat_trace_context.h",
135 "source/logcat_trace_context.cc",
136 ]
137
138 defines += [
139 "WEBRTC_THREAD_RR",
140 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
141 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
142 # remove it after I verify that CLOCK_MONOTONIC is fully functional
143 # with condition and event functions in system_wrappers.
144 "WEBRTC_CLOCK_TYPE_REALTIME",
145 ]
146
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000147 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000148
149 libs += [ "log" ]
150 }
151
152 if (is_linux) {
153 defines += [
154 "WEBRTC_THREAD_RR",
155 # TODO(andrew): can we select this automatically?
156 # Define this if the Linux system does not support CLOCK_MONOTONIC.
157 #"WEBRTC_CLOCK_TYPE_REALTIME",
158 ]
159
160 libs += [ "rt" ]
161 }
162
163 if (!is_mac && !is_ios) {
164 sources += [
165 "source/atomic32_posix.cc",
166 ]
167 }
168
169 if (is_ios || is_mac) {
170 defines += [
171 "WEBRTC_THREAD_RR",
172 "WEBRTC_CLOCK_TYPE_REALTIME",
173 ]
174 }
175
176 if (is_ios) {
177 sources += [
178 "source/atomic32_mac.cc",
179 ]
180 }
181
182 if (is_win) {
183 libs += [ "winmm.lib" ]
184
185 cflags = [
186 "/wd4267", # size_t to int truncation.
187 "/wd4334", # Ignore warning on shift operator promotion.
188 ]
189 }
190
191 include_dirs = [
192 "source/spreadsortlib",
193 ]
194
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000195 deps += [
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000196 "../base:rtc_base_approved",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000197 ]
198}
199
200source_set("field_trial_default") {
201 sources = [
202 "source/field_trial_default.cc",
203 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000204
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000205 configs += [ "..:common_config" ]
206 public_configs = [ "..:common_inherited_config" ]
207
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000208 if (is_clang) {
209 # Suppress warnings from Chrome's Clang plugins.
210 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
211 configs -= [ "//build/config/clang:find_bad_constructs" ]
212 }
213
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000214 deps = [
215 ":system_wrappers",
216 ]
217}
218
219if (is_android) {
220 source_set("cpu_features_android") {
221 sources = [
222 "source/cpu_features_android.c",
223 ]
224
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000225 configs += [ "..:common_config" ]
226 public_configs = [ "..:common_inherited_config" ]
227
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000228 if (is_android_webview_build) {
229 libs += [ "cpufeatures.a" ]
230 } else {
231 deps = [ "//third_party/android_tools:cpu_features" ]
232 }
233 }
234}