blob: d0447e9ca1b51b04558c67cdee14a2d1b764a8f5 [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 = [
Henrik Kjellander98f53512015-10-28 18:17:40 +010014 "include/aligned_array.h",
15 "include/aligned_malloc.h",
16 "include/atomic32.h",
17 "include/clock.h",
18 "include/condition_variable_wrapper.h",
19 "include/cpu_features_wrapper.h",
20 "include/cpu_info.h",
21 "include/critical_section_wrapper.h",
22 "include/data_log.h",
23 "include/data_log_c.h",
24 "include/data_log_impl.h",
Henrik Kjellander98f53512015-10-28 18:17:40 +010025 "include/event_wrapper.h",
26 "include/field_trial.h",
27 "include/file_wrapper.h",
28 "include/fix_interlocked_exchange_pointer_win.h",
29 "include/logging.h",
30 "include/metrics.h",
31 "include/ref_count.h",
32 "include/rtp_to_ntp.h",
33 "include/rw_lock_wrapper.h",
34 "include/scoped_vector.h",
35 "include/sleep.h",
36 "include/sort.h",
37 "include/static_instance.h",
38 "include/stl_util.h",
39 "include/stringize_macros.h",
40 "include/thread_wrapper.h",
41 "include/tick_util.h",
42 "include/timestamp_extrapolator.h",
43 "include/trace.h",
44 "include/utf_util_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000045 "source/aligned_malloc.cc",
46 "source/atomic32_mac.cc",
47 "source/atomic32_win.cc",
48 "source/clock.cc",
49 "source/condition_variable.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000050 "source/condition_variable_event_win.cc",
51 "source/condition_variable_event_win.h",
52 "source/condition_variable_native_win.cc",
53 "source/condition_variable_native_win.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020054 "source/condition_variable_posix.cc",
55 "source/condition_variable_posix.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000056 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020057 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000058 "source/critical_section.cc",
59 "source/critical_section_posix.cc",
60 "source/critical_section_posix.h",
61 "source/critical_section_win.cc",
62 "source/critical_section_win.h",
63 "source/data_log_c.cc",
64 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020065 "source/event_timer_posix.cc",
66 "source/event_timer_posix.h",
67 "source/event_timer_win.cc",
68 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000069 "source/file_impl.cc",
70 "source/file_impl.h",
71 "source/logging.cc",
72 "source/rtp_to_ntp.cc",
73 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000074 "source/rw_lock_generic.cc",
75 "source/rw_lock_generic.h",
76 "source/rw_lock_posix.cc",
77 "source/rw_lock_posix.h",
78 "source/rw_lock_win.cc",
79 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000080 "source/sleep.cc",
81 "source/sort.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000082 "source/thread.cc",
83 "source/thread_posix.cc",
84 "source/thread_posix.h",
85 "source/thread_win.cc",
86 "source/thread_win.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020087 "source/tick_util.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000088 "source/timestamp_extrapolator.cc",
89 "source/trace_impl.cc",
90 "source/trace_impl.h",
91 "source/trace_posix.cc",
92 "source/trace_posix.h",
93 "source/trace_win.cc",
94 "source/trace_win.h",
95 ]
96
97 configs += [ "..:common_config" ]
98
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020099 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000100
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000101 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000102 sources += [ "source/data_log.cc" ]
103 } else {
104 sources += [ "source/data_log_no_op.cc" ]
105 }
106
107 defines = []
108 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200109 deps = [
110 "..:webrtc_common",
111 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000112
113 if (is_android) {
114 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100115 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000116 "source/logcat_trace_context.cc",
117 ]
118
119 defines += [
120 "WEBRTC_THREAD_RR",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200121
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000122 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
123 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
124 # remove it after I verify that CLOCK_MONOTONIC is fully functional
125 # with condition and event functions in system_wrappers.
126 "WEBRTC_CLOCK_TYPE_REALTIME",
127 ]
128
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000129 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000130
131 libs += [ "log" ]
132 }
133
134 if (is_linux) {
135 defines += [
136 "WEBRTC_THREAD_RR",
137 # TODO(andrew): can we select this automatically?
138 # Define this if the Linux system does not support CLOCK_MONOTONIC.
139 #"WEBRTC_CLOCK_TYPE_REALTIME",
140 ]
141
142 libs += [ "rt" ]
143 }
144
145 if (!is_mac && !is_ios) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200146 sources += [ "source/atomic32_posix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000147 }
148
149 if (is_ios || is_mac) {
150 defines += [
151 "WEBRTC_THREAD_RR",
152 "WEBRTC_CLOCK_TYPE_REALTIME",
153 ]
154 }
155
156 if (is_ios) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200157 sources += [ "source/atomic32_mac.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000158 }
159
160 if (is_win) {
161 libs += [ "winmm.lib" ]
162
163 cflags = [
164 "/wd4267", # size_t to int truncation.
165 "/wd4334", # Ignore warning on shift operator promotion.
166 ]
167 }
168
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200169 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000170}
171
172source_set("field_trial_default") {
173 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100174 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000175 "source/field_trial_default.cc",
176 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000177
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000178 configs += [ "..:common_config" ]
179 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000180}
181
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000182source_set("metrics_default") {
183 sources = [
184 "source/metrics_default.cc",
185 ]
186
187 configs += [ "..:common_config" ]
188 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000189}
190
191source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000192 configs += [ "..:common_config" ]
193 public_configs = [ "..:common_inherited_config" ]
194
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000195 deps = [
sergeyu5ab193f2015-11-03 09:36:52 -0800196 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000197 ":field_trial_default",
198 ":metrics_default",
199 ]
200}
201
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000202if (is_android) {
203 source_set("cpu_features_android") {
204 sources = [
205 "source/cpu_features_android.c",
206 ]
207
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000208 configs += [ "..:common_config" ]
209 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200210 deps = [
211 "//third_party/android_tools:cpu_features",
212 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000213 }
214}