blob: 5e0e41e832265075bfe3527aa2eab0e2f63fa84e [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",
Henrik Kjellander98f53512015-10-28 18:17:40 +010040 "include/tick_util.h",
41 "include/timestamp_extrapolator.h",
42 "include/trace.h",
43 "include/utf_util_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000044 "source/aligned_malloc.cc",
45 "source/atomic32_mac.cc",
46 "source/atomic32_win.cc",
47 "source/clock.cc",
48 "source/condition_variable.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000049 "source/condition_variable_event_win.cc",
50 "source/condition_variable_event_win.h",
51 "source/condition_variable_native_win.cc",
52 "source/condition_variable_native_win.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020053 "source/condition_variable_posix.cc",
54 "source/condition_variable_posix.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000055 "source/cpu_features.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020056 "source/cpu_info.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000057 "source/critical_section.cc",
58 "source/critical_section_posix.cc",
59 "source/critical_section_posix.h",
60 "source/critical_section_win.cc",
61 "source/critical_section_win.h",
62 "source/data_log_c.cc",
63 "source/event.cc",
Peter Boström64c03662015-04-08 11:24:19 +020064 "source/event_timer_posix.cc",
65 "source/event_timer_posix.h",
66 "source/event_timer_win.cc",
67 "source/event_timer_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000068 "source/file_impl.cc",
69 "source/file_impl.h",
70 "source/logging.cc",
71 "source/rtp_to_ntp.cc",
72 "source/rw_lock.cc",
tommi@webrtc.orgfe196992015-02-07 22:35:54 +000073 "source/rw_lock_generic.cc",
74 "source/rw_lock_generic.h",
75 "source/rw_lock_posix.cc",
76 "source/rw_lock_posix.h",
77 "source/rw_lock_win.cc",
78 "source/rw_lock_win.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000079 "source/sleep.cc",
80 "source/sort.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020081 "source/tick_util.cc",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000082 "source/timestamp_extrapolator.cc",
83 "source/trace_impl.cc",
84 "source/trace_impl.h",
85 "source/trace_posix.cc",
86 "source/trace_posix.h",
87 "source/trace_win.cc",
88 "source/trace_win.h",
89 ]
90
91 configs += [ "..:common_config" ]
92
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020093 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000094
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000095 if (rtc_enable_data_logging) {
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +000096 sources += [ "source/data_log.cc" ]
97 } else {
98 sources += [ "source/data_log_no_op.cc" ]
99 }
100
101 defines = []
102 libs = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200103 deps = [
104 "..:webrtc_common",
105 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000106
107 if (is_android) {
108 sources += [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100109 "include/logcat_trace_context.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000110 "source/logcat_trace_context.cc",
111 ]
112
113 defines += [
114 "WEBRTC_THREAD_RR",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200115
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000116 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
117 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
118 # remove it after I verify that CLOCK_MONOTONIC is fully functional
119 # with condition and event functions in system_wrappers.
120 "WEBRTC_CLOCK_TYPE_REALTIME",
121 ]
122
kjellander@webrtc.org62711f82014-06-29 13:37:08 +0000123 deps += [ ":cpu_features_android" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000124
125 libs += [ "log" ]
126 }
127
128 if (is_linux) {
129 defines += [
130 "WEBRTC_THREAD_RR",
131 # TODO(andrew): can we select this automatically?
132 # Define this if the Linux system does not support CLOCK_MONOTONIC.
133 #"WEBRTC_CLOCK_TYPE_REALTIME",
134 ]
135
136 libs += [ "rt" ]
137 }
138
139 if (!is_mac && !is_ios) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200140 sources += [ "source/atomic32_posix.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000141 }
142
143 if (is_ios || is_mac) {
144 defines += [
145 "WEBRTC_THREAD_RR",
146 "WEBRTC_CLOCK_TYPE_REALTIME",
147 ]
148 }
149
150 if (is_ios) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200151 sources += [ "source/atomic32_mac.cc" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000152 }
153
154 if (is_win) {
155 libs += [ "winmm.lib" ]
156
157 cflags = [
158 "/wd4267", # size_t to int truncation.
159 "/wd4334", # Ignore warning on shift operator promotion.
160 ]
161 }
162
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200163 deps += [ "../base:rtc_base_approved" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000164}
165
166source_set("field_trial_default") {
167 sources = [
Henrik Kjellander98f53512015-10-28 18:17:40 +0100168 "include/field_trial_default.h",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000169 "source/field_trial_default.cc",
170 ]
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000171
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000172 configs += [ "..:common_config" ]
173 public_configs = [ "..:common_inherited_config" ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000174}
175
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000176source_set("metrics_default") {
177 sources = [
178 "source/metrics_default.cc",
179 ]
180
181 configs += [ "..:common_config" ]
182 public_configs = [ "..:common_inherited_config" ]
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000183}
184
185source_set("system_wrappers_default") {
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000186 configs += [ "..:common_config" ]
187 public_configs = [ "..:common_inherited_config" ]
188
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000189 deps = [
190 ":field_trial_default",
191 ":metrics_default",
pbos12411ef2015-11-23 14:47:56 -0800192 ":system_wrappers",
asapersson@webrtc.org580d3672014-10-23 12:57:56 +0000193 ]
194}
195
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000196if (is_android) {
197 source_set("cpu_features_android") {
198 sources = [
199 "source/cpu_features_android.c",
200 ]
201
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000202 configs += [ "..:common_config" ]
203 public_configs = [ "..:common_inherited_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200204 deps = [
205 "//third_party/android_tools:cpu_features",
206 ]
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000207 }
208}