blob: 75a644c1ed17142ffe6e82b9ea50574ac7510038 [file] [log] [blame]
kjellanderc76dc952016-06-03 03:09:32 -07001# Copyright (c) 2016 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
mbonadei9aa3f0a2017-01-24 06:58:22 -08009import("../webrtc.gni")
ossu7bb87ee2017-01-23 04:56:25 -080010if (is_android) {
11 import("//build/config/android/config.gni")
12 import("//build/config/android/rules.gni")
13}
kjellanderc76dc952016-06-03 03:09:32 -070014
15group("pc") {
kjellander705ecc52016-09-15 00:53:26 -070016 public_deps = [
kjellanderc76dc952016-06-03 03:09:32 -070017 ":rtc_pc",
18 ]
19}
20
21config("rtc_pc_config") {
jbaucheaa9c1d2017-03-06 11:32:22 -080022 defines = []
deadbeef40610e22016-12-22 10:53:38 -080023 if (rtc_enable_sctp) {
24 defines += [ "HAVE_SCTP" ]
25 }
kjellanderc76dc952016-06-03 03:09:32 -070026}
27
kjellanderb62dbbe2016-09-23 00:38:52 -070028rtc_static_library("rtc_pc") {
kjellanderc76dc952016-06-03 03:09:32 -070029 defines = []
30 sources = [
31 "audiomonitor.cc",
32 "audiomonitor.h",
33 "bundlefilter.cc",
34 "bundlefilter.h",
35 "channel.cc",
36 "channel.h",
37 "channelmanager.cc",
38 "channelmanager.h",
39 "currentspeakermonitor.cc",
40 "currentspeakermonitor.h",
jbauchdfcab722017-03-06 00:14:10 -080041 "externalhmac.cc",
42 "externalhmac.h",
kjellanderc76dc952016-06-03 03:09:32 -070043 "mediamonitor.cc",
44 "mediamonitor.h",
45 "mediasession.cc",
46 "mediasession.h",
kjellanderc76dc952016-06-03 03:09:32 -070047 "rtcpmuxfilter.cc",
48 "rtcpmuxfilter.h",
49 "srtpfilter.cc",
50 "srtpfilter.h",
51 "voicechannel.h",
52 ]
53
54 deps = [
kjellandera69d9732016-08-31 07:33:05 -070055 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -070056 "../base:rtc_base",
57 "../media",
58 ]
59
kjellanderc76dc952016-06-03 03:09:32 -070060 if (rtc_build_libsrtp) {
61 deps += [ "//third_party/libsrtp" ]
62 }
63
ehmaldonadoe9cc6862016-09-05 06:10:18 -070064 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070065
kjellandere40a7ee2016-10-16 23:56:12 -070066 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070067 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070068 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070069 }
70}
kjellander142f8c52016-06-13 00:08:24 -070071
ossu7bb87ee2017-01-23 04:56:25 -080072config("libjingle_peerconnection_warnings_config") {
73 # GN orders flags on a target before flags from configs. The default config
74 # adds these flags so to cancel them out they need to come from a config and
75 # cannot be on the target directly.
76 if (!is_win && !is_clang) {
77 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
78 }
79}
80
81rtc_static_library("libjingle_peerconnection") {
82 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
83 cflags = []
84 sources = [
85 "audiotrack.cc",
86 "audiotrack.h",
87 "datachannel.cc",
88 "datachannel.h",
89 "dtmfsender.cc",
90 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -070091 "iceserverparsing.cc",
92 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -080093 "jsepicecandidate.cc",
94 "jsepsessiondescription.cc",
95 "localaudiosource.cc",
96 "localaudiosource.h",
97 "mediacontroller.cc",
98 "mediacontroller.h",
99 "mediastream.cc",
100 "mediastream.h",
101 "mediastreamobserver.cc",
102 "mediastreamobserver.h",
103 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800104 "peerconnection.cc",
105 "peerconnection.h",
106 "peerconnectionfactory.cc",
107 "peerconnectionfactory.h",
108 "remoteaudiosource.cc",
109 "remoteaudiosource.h",
110 "rtcstatscollector.cc",
111 "rtcstatscollector.h",
112 "rtpreceiver.cc",
113 "rtpreceiver.h",
114 "rtpsender.cc",
115 "rtpsender.h",
116 "sctputils.cc",
117 "sctputils.h",
118 "statscollector.cc",
119 "statscollector.h",
120 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800121 "trackmediainfomap.cc",
122 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800123 "videocapturertracksource.cc",
124 "videocapturertracksource.h",
125 "videotrack.cc",
126 "videotrack.h",
127 "videotracksource.cc",
128 "videotracksource.h",
129 "webrtcsdp.cc",
130 "webrtcsdp.h",
131 "webrtcsession.cc",
132 "webrtcsession.h",
133 "webrtcsessiondescriptionfactory.cc",
134 "webrtcsessiondescriptionfactory.h",
135 ]
136
137 configs += [ ":libjingle_peerconnection_warnings_config" ]
138
139 if (!build_with_chromium && is_clang) {
140 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
141 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
142 }
143
144 deps = [
145 ":rtc_pc",
146 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800147 "../api:rtc_stats_api",
148 "../call",
149 "../media",
150 "../stats",
151 ]
152
ossuda250062017-01-23 07:37:43 -0800153 public_deps = [
154 "../api:libjingle_peerconnection_api",
155 ]
156
ossu7bb87ee2017-01-23 04:56:25 -0800157 if (rtc_use_quic) {
158 sources += [
159 "quicdatachannel.cc",
160 "quicdatachannel.h",
161 "quicdatatransport.cc",
162 "quicdatatransport.h",
163 ]
164 deps += [ "//third_party/libquic" ]
165 public_deps = [
166 "//third_party/libquic",
167 ]
168 }
169}
170
kjellander142f8c52016-06-13 00:08:24 -0700171if (rtc_include_tests) {
172 config("rtc_pc_unittests_config") {
173 # GN orders flags on a target before flags from configs. The default config
174 # adds -Wall, and this flag have to be after -Wall -- so they need to
175 # come from a config and can't be on the target directly.
176 if (!is_win && !is_clang) {
177 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
178 }
179 }
180
ehmaldonado38a21322016-09-02 04:10:34 -0700181 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700182 testonly = true
183
184 sources = [
185 "bundlefilter_unittest.cc",
186 "channel_unittest.cc",
187 "channelmanager_unittest.cc",
188 "currentspeakermonitor_unittest.cc",
189 "mediasession_unittest.cc",
190 "rtcpmuxfilter_unittest.cc",
191 "srtpfilter_unittest.cc",
192 ]
193
194 include_dirs = [ "//third_party/libsrtp/srtp" ]
195
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700196 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700197
kjellandere40a7ee2016-10-16 23:56:12 -0700198 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700199 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700200 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700201 }
202
203 if (is_win) {
204 libs = [ "strmiids.lib" ]
205 }
206
207 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800208 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700209 ":rtc_pc",
kjellander142f8c52016-06-13 00:08:24 -0700210 "../base:rtc_base_tests_utils",
211 "../media:rtc_unittest_main",
212 "../system_wrappers:metrics_default",
213 ]
214
215 if (rtc_build_libsrtp) {
216 deps += [ "//third_party/libsrtp" ]
217 }
218
219 if (is_android) {
220 deps += [ "//testing/android/native_test:native_test_support" ]
221 }
222 }
ossu7bb87ee2017-01-23 04:56:25 -0800223
deadbeefe814a0d2017-02-25 18:15:09 -0800224 rtc_source_set("pc_test_utils") {
225 testonly = true
226 sources = [
227 "test/fakeaudiocapturemodule.cc",
228 "test/fakeaudiocapturemodule.h",
229 "test/fakedatachannelprovider.h",
230 "test/fakeperiodicvideocapturer.h",
231 "test/fakertccertificategenerator.h",
232 "test/fakevideotrackrenderer.h",
233 "test/fakevideotracksource.h",
234 "test/mock_datachannel.h",
235 "test/mock_peerconnection.h",
236 "test/mock_webrtcsession.h",
237 "test/mockpeerconnectionobservers.h",
238 "test/peerconnectiontestwrapper.cc",
239 "test/peerconnectiontestwrapper.h",
240 "test/rtcstatsobtainer.h",
241 "test/testsdpstrings.h",
242 ]
243
244 deps = [
245 ":libjingle_peerconnection",
246 "../base:rtc_base_tests_utils",
247 "//testing/gmock",
248 ]
249
250 if (!build_with_chromium && is_clang) {
251 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
252 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
253 }
254 }
255
ossu7bb87ee2017-01-23 04:56:25 -0800256 config("peerconnection_unittests_config") {
257 # The warnings below are enabled by default. Since GN orders compiler flags
258 # for a target before flags from configs, the only way to disable such
259 # warnings is by having them in a separate config, loaded from the target.
260 # TODO(kjellander): Make the code compile without disabling these flags.
261 # See https://bugs.webrtc.org/3307.
262 if (is_clang && is_win) {
263 cflags = [
264 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
265 # for -Wno-sign-compare
266 "-Wno-sign-compare",
267 "-Wno-unused-function",
268 ]
269 }
270
271 if (!is_win) {
272 cflags = [ "-Wno-sign-compare" ]
273 }
274 }
275
276 rtc_test("peerconnection_unittests") {
277 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
278 testonly = true
279 sources = [
280 "datachannel_unittest.cc",
281 "dtmfsender_unittest.cc",
282 "fakemediacontroller.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700283 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800284 "jsepsessiondescription_unittest.cc",
285 "localaudiosource_unittest.cc",
286 "mediaconstraintsinterface_unittest.cc",
287 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700288 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800289 "peerconnectionendtoend_unittest.cc",
290 "peerconnectionfactory_unittest.cc",
291 "peerconnectioninterface_unittest.cc",
292 "proxy_unittest.cc",
293 "rtcstats_integrationtest.cc",
294 "rtcstatscollector_unittest.cc",
295 "rtpsenderreceiver_unittest.cc",
296 "sctputils_unittest.cc",
297 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800298 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800299 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800300 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800301 "videocapturertracksource_unittest.cc",
302 "videotrack_unittest.cc",
303 "webrtcsdp_unittest.cc",
304 "webrtcsession_unittest.cc",
305 ]
306
307 if (rtc_enable_sctp) {
308 defines = [ "HAVE_SCTP" ]
309 }
310
311 configs += [ ":peerconnection_unittests_config" ]
312
313 if (!build_with_chromium && is_clang) {
314 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
315 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
316 }
317
318 # TODO(jschuh): Bug 1348: fix this warning.
319 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
320
321 if (is_win) {
322 cflags = [
323 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
324 "/wd4389", # signed/unsigned mismatch.
325 ]
326 }
327
328 if (rtc_use_quic) {
329 public_deps = [
330 "//third_party/libquic",
331 ]
332 sources += [
333 "quicdatachannel_unittest.cc",
334 "quicdatatransport_unittest.cc",
335 ]
336 }
337
338 deps = []
339 if (is_android) {
340 sources += [
341 "test/androidtestinitializer.cc",
342 "test/androidtestinitializer.h",
343 ]
344 deps += [
345 "//testing/android/native_test:native_test_support",
346 "//webrtc/sdk/android:libjingle_peerconnection_java",
347 "//webrtc/sdk/android:libjingle_peerconnection_jni",
348 ]
349 }
350
351 deps += [
352 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800353 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800354 "..:webrtc_common",
355 "../api:fakemetricsobserver",
356 "../base:rtc_base_tests_utils",
357 "../media:rtc_unittest_main",
358 "../pc:rtc_pc",
359 "../system_wrappers:metrics_default",
360 "//testing/gmock",
361 ]
362
363 if (is_android) {
364 deps += [ "//testing/android/native_test:native_test_support" ]
365
366 shard_timeout = 900
367 }
368 }
kjellander142f8c52016-06-13 00:08:24 -0700369}