blob: 442ecbff0c7f5ff0d0ec2f28d670327b3973a5e3 [file] [log] [blame]
hjonaa32c3e2015-12-13 19:58:11 -08001# Copyright (c) 2015 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")
kjellanderfd5b4e92016-06-13 12:08:33 -070010import("//testing/test.gni")
kjellanderc76dc952016-06-03 03:09:32 -070011
12group("api") {
13 deps = [
14 ":libjingle_peerconnection",
15 ]
16}
17
18config("libjingle_peerconnection_warnings_config") {
19 # GN orders flags on a target before flags from configs. The default config
20 # adds these flags so to cancel them out they need to come from a config and
21 # cannot be on the target directly.
kjellander3e33bfe2016-06-20 07:04:09 -070022 if (!is_win && !is_clang) {
23 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
kjellanderc76dc952016-06-03 03:09:32 -070024 }
25}
26
27source_set("libjingle_peerconnection") {
28 cflags = []
29 sources = [
30 "audiotrack.cc",
31 "audiotrack.h",
32 "datachannel.cc",
33 "datachannel.h",
34 "datachannelinterface.h",
kjellanderc76dc952016-06-03 03:09:32 -070035 "dtlsidentitystore.h",
36 "dtmfsender.cc",
37 "dtmfsender.h",
38 "dtmfsenderinterface.h",
39 "jsep.h",
40 "jsepicecandidate.cc",
41 "jsepicecandidate.h",
42 "jsepsessiondescription.cc",
43 "jsepsessiondescription.h",
44 "localaudiosource.cc",
45 "localaudiosource.h",
46 "mediaconstraintsinterface.cc",
47 "mediaconstraintsinterface.h",
48 "mediacontroller.cc",
49 "mediacontroller.h",
50 "mediastream.cc",
51 "mediastream.h",
52 "mediastreaminterface.h",
53 "mediastreamobserver.cc",
54 "mediastreamobserver.h",
55 "mediastreamprovider.h",
56 "mediastreamproxy.h",
57 "mediastreamtrack.h",
58 "mediastreamtrackproxy.h",
59 "notifier.h",
60 "peerconnection.cc",
61 "peerconnection.h",
62 "peerconnectionfactory.cc",
63 "peerconnectionfactory.h",
64 "peerconnectionfactoryproxy.h",
65 "peerconnectioninterface.h",
66 "peerconnectionproxy.h",
67 "proxy.h",
68 "remoteaudiosource.cc",
69 "remoteaudiosource.h",
70 "rtpparameters.h",
71 "rtpreceiver.cc",
72 "rtpreceiver.h",
73 "rtpreceiverinterface.h",
74 "rtpsender.cc",
75 "rtpsender.h",
76 "rtpsenderinterface.h",
77 "sctputils.cc",
78 "sctputils.h",
79 "statscollector.cc",
80 "statscollector.h",
81 "statstypes.cc",
82 "statstypes.h",
83 "streamcollection.h",
84 "videocapturertracksource.cc",
85 "videocapturertracksource.h",
86 "videosourceproxy.h",
87 "videotrack.cc",
88 "videotrack.h",
89 "videotracksource.cc",
90 "videotracksource.h",
91 "webrtcsdp.cc",
92 "webrtcsdp.h",
93 "webrtcsession.cc",
94 "webrtcsession.h",
95 "webrtcsessiondescriptionfactory.cc",
96 "webrtcsessiondescriptionfactory.h",
97 ]
98
99 configs += [
100 "..:common_config",
101 ":libjingle_peerconnection_warnings_config",
102 ]
103 public_configs = [ "..:common_inherited_config" ]
104
105 if (is_clang) {
kjellanderfd5b4e92016-06-13 12:08:33 -0700106 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellanderc76dc952016-06-03 03:09:32 -0700107 configs -= [ "//build/config/clang:find_bad_constructs" ]
108 }
109
kjellanderc76dc952016-06-03 03:09:32 -0700110 deps = [
katrielc14897d02016-06-03 13:14:28 -0700111 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700112 "../media",
113 "../pc",
114 ]
115
116 if (rtc_use_quic) {
117 sources += [
118 "quicdatachannel.cc",
119 "quicdatachannel.h",
120 "quicdatatransport.cc",
121 "quicdatatransport.h",
122 ]
123 deps += [ "//third_party/libquic" ]
124 public_deps = [
125 "//third_party/libquic",
126 ]
127 }
128}
kjellanderfd5b4e92016-06-13 12:08:33 -0700129
130if (is_android) {
131 config("libjingle_peerconnection_jni_warnings_config") {
132 # The warnings below are enabled by default. Since GN orders compiler flags
133 # for a target before flags from configs, the only way to disable such
134 # warnings is by having them in a separate config, loaded from the target.
135 if (!is_win) {
136 cflags = [
137 "-Wno-sign-compare",
138 "-Wno-unused-variable",
139 ]
140 }
141 }
142
143 source_set("libjingle_peerconnection_jni") {
144 sources = [
145 "androidvideocapturer.cc",
146 "androidvideocapturer.h",
147 "java/jni/androidmediacodeccommon.h",
148 "java/jni/androidmediadecoder_jni.cc",
149 "java/jni/androidmediadecoder_jni.h",
150 "java/jni/androidmediaencoder_jni.cc",
151 "java/jni/androidmediaencoder_jni.h",
152 "java/jni/androidmetrics_jni.cc",
153 "java/jni/androidnetworkmonitor_jni.cc",
154 "java/jni/androidnetworkmonitor_jni.h",
155 "java/jni/androidvideocapturer_jni.cc",
156 "java/jni/androidvideocapturer_jni.h",
157 "java/jni/classreferenceholder.cc",
158 "java/jni/classreferenceholder.h",
159 "java/jni/jni_helpers.cc",
160 "java/jni/jni_helpers.h",
161 "java/jni/native_handle_impl.cc",
162 "java/jni/native_handle_impl.h",
163 "java/jni/peerconnection_jni.cc",
164 "java/jni/surfacetexturehelper_jni.cc",
165 "java/jni/surfacetexturehelper_jni.h",
166 ]
167
168 configs += [
169 "..:common_config",
170 ":libjingle_peerconnection_jni_warnings_config",
171 ]
172 public_configs = [ "..:common_inherited_config" ]
173
174 if (is_clang) {
175 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
176 configs -= [
177 "//build/config/clang:extra_warnings",
178 "//build/config/clang:find_bad_constructs",
179 ]
180 }
181
182 # TODO(jschuh): Bug 1348: fix this warning.
183 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
184
185 if (is_win) {
186 cflags += [
187 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
188 "/wd4389", # signed/unsigned mismatch.
189 ]
190 }
191
192 deps = [
193 ":libjingle_peerconnection",
194 "../system_wrappers:field_trial_default",
195 "../system_wrappers:metrics_default",
196 ]
197
198 if (rtc_build_libyuv) {
199 deps += [ "$rtc_libyuv_dir" ]
200 public_deps = [
201 "$rtc_libyuv_dir",
202 ]
203 } else {
204 # Need to add a directory normally exported by libyuv.
205 include_dirs += [ "$rtc_libyuv_dir/include" ]
206 }
207 }
208}
209
210if (rtc_include_tests) {
211 config("peerconnection_unittests_config") {
212 # The warnings below are enabled by default. Since GN orders compiler flags
213 # for a target before flags from configs, the only way to disable such
214 # warnings is by having them in a separate config, loaded from the target.
215 # TODO(kjellander): Make the code compile without disabling these flags.
216 # See https://bugs.webrtc.org/3307.
217 if (is_clang && is_win) {
218 cflags = [ "-Wno-unused-function" ]
219 }
220
221 if (!is_win) {
222 cflags = [ "-Wno-sign-compare" ]
223 cflags_cc = [ "-Wno-overloaded-virtual" ]
224 }
225 }
226
227 test("peerconnection_unittests") {
228 testonly = true
229 sources = [
230 "datachannel_unittest.cc",
231 "dtmfsender_unittest.cc",
232 "fakemetricsobserver.cc",
233 "fakemetricsobserver.h",
234 "jsepsessiondescription_unittest.cc",
235 "localaudiosource_unittest.cc",
236 "mediaconstraintsinterface_unittest.cc",
237 "mediastream_unittest.cc",
238 "peerconnection_unittest.cc",
239 "peerconnectionendtoend_unittest.cc",
240 "peerconnectionfactory_unittest.cc",
241 "peerconnectioninterface_unittest.cc",
242 "proxy_unittest.cc",
243 "rtpsenderreceiver_unittest.cc",
244 "statscollector_unittest.cc",
245 "test/fakeaudiocapturemodule.cc",
246 "test/fakeaudiocapturemodule.h",
247 "test/fakeaudiocapturemodule_unittest.cc",
248 "test/fakeconstraints.h",
249 "test/fakedatachannelprovider.h",
250 "test/fakeperiodicvideocapturer.h",
251 "test/fakertccertificategenerator.h",
252 "test/fakevideotrackrenderer.h",
253 "test/mockpeerconnectionobservers.h",
254 "test/peerconnectiontestwrapper.cc",
255 "test/peerconnectiontestwrapper.h",
256 "test/testsdpstrings.h",
257 "videocapturertracksource_unittest.cc",
258 "videotrack_unittest.cc",
259 "webrtcsdp_unittest.cc",
260 "webrtcsession_unittest.cc",
261 ]
262
263 defines = [ "HAVE_SCTP" ]
264
265 configs += [
266 "..:common_config",
267 ":peerconnection_unittests_config",
268 ]
269 public_configs = [ "..:common_inherited_config" ]
270
271 if (is_clang) {
272 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
273 configs -= [ "//build/config/clang:find_bad_constructs" ]
274 }
275
276 # TODO(jschuh): Bug 1348: fix this warning.
277 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
278
279 if (is_win) {
280 cflags = [
281 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
282 "/wd4389", # signed/unsigned mismatch.
283 ]
284 }
285
286 if (rtc_use_quic) {
287 public_deps = [
288 "//third_party/libquic",
289 ]
290 sources += [
291 "quicdatachannel_unittest.cc",
292 "quicdatatransport_unittest.cc",
293 ]
294 }
295
296 deps = []
297 if (is_android) {
298 sources += [
299 "test/androidtestinitializer.cc",
300 "test/androidtestinitializer.h",
301 ]
302 deps += [
303 ":libjingle_peerconnection_jni",
304 "//testing/android/native_test:native_test_support",
305 ]
306 }
307
308 deps += [
309 ":libjingle_peerconnection",
310 "..:webrtc_common",
311 "../base:rtc_base_tests_utils",
312 "../media:rtc_unittest_main",
313 "../pc:rtc_pc",
314 "../system_wrappers:metrics_default",
315 "//testing/gmock",
316 ]
317
318 if (is_android) {
319 deps += [ "//testing/android/native_test:native_test_support" ]
320 }
321 }
322}