blob: 10256ce2f407cc3b76e5ee3c28dfbde8188536be [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",
zsteind48dbda2017-04-04 19:45:57 -070049 "rtptransport.cc",
50 "rtptransport.h",
kjellanderc76dc952016-06-03 03:09:32 -070051 "srtpfilter.cc",
52 "srtpfilter.h",
53 "voicechannel.h",
54 ]
55
56 deps = [
mbonadei7d9a55b2017-06-01 13:01:48 -070057 "..:webrtc_common",
kjellandera69d9732016-08-31 07:33:05 -070058 "../api:call_api",
mbonadei7d9a55b2017-06-01 13:01:48 -070059 "../api:libjingle_peerconnection_api",
60 "../api:ortc_api",
kjellanderc76dc952016-06-03 03:09:32 -070061 "../base:rtc_base",
mbonadei7d9a55b2017-06-01 13:01:48 -070062 "../common_video:common_video",
kjellanderc76dc952016-06-03 03:09:32 -070063 "../media",
mbonadei7d9a55b2017-06-01 13:01:48 -070064 "../p2p:rtc_p2p",
kjellanderc76dc952016-06-03 03:09:32 -070065 ]
66
kjellanderc76dc952016-06-03 03:09:32 -070067 if (rtc_build_libsrtp) {
68 deps += [ "//third_party/libsrtp" ]
69 }
70
ehmaldonadoe9cc6862016-09-05 06:10:18 -070071 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070072
kjellandere40a7ee2016-10-16 23:56:12 -070073 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070074 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070075 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070076 }
77}
kjellander142f8c52016-06-13 00:08:24 -070078
ossu7bb87ee2017-01-23 04:56:25 -080079config("libjingle_peerconnection_warnings_config") {
80 # GN orders flags on a target before flags from configs. The default config
81 # adds these flags so to cancel them out they need to come from a config and
82 # cannot be on the target directly.
83 if (!is_win && !is_clang) {
84 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
85 }
86}
87
88rtc_static_library("libjingle_peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -080089 cflags = []
90 sources = [
91 "audiotrack.cc",
92 "audiotrack.h",
93 "datachannel.cc",
94 "datachannel.h",
95 "dtmfsender.cc",
96 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -070097 "iceserverparsing.cc",
98 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -080099 "jsepicecandidate.cc",
100 "jsepsessiondescription.cc",
101 "localaudiosource.cc",
102 "localaudiosource.h",
ossu7bb87ee2017-01-23 04:56:25 -0800103 "mediastream.cc",
104 "mediastream.h",
105 "mediastreamobserver.cc",
106 "mediastreamobserver.h",
107 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800108 "peerconnection.cc",
109 "peerconnection.h",
110 "peerconnectionfactory.cc",
111 "peerconnectionfactory.h",
112 "remoteaudiosource.cc",
113 "remoteaudiosource.h",
114 "rtcstatscollector.cc",
115 "rtcstatscollector.h",
116 "rtpreceiver.cc",
117 "rtpreceiver.h",
118 "rtpsender.cc",
119 "rtpsender.h",
120 "sctputils.cc",
121 "sctputils.h",
122 "statscollector.cc",
123 "statscollector.h",
124 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800125 "trackmediainfomap.cc",
126 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800127 "videocapturertracksource.cc",
128 "videocapturertracksource.h",
129 "videotrack.cc",
130 "videotrack.h",
131 "videotracksource.cc",
132 "videotracksource.h",
133 "webrtcsdp.cc",
134 "webrtcsdp.h",
135 "webrtcsession.cc",
136 "webrtcsession.h",
137 "webrtcsessiondescriptionfactory.cc",
138 "webrtcsessiondescriptionfactory.h",
139 ]
140
141 configs += [ ":libjingle_peerconnection_warnings_config" ]
142
143 if (!build_with_chromium && is_clang) {
144 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
145 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
146 }
147
148 deps = [
149 ":rtc_pc",
mbonadei7d9a55b2017-06-01 13:01:48 -0700150 "..:webrtc_common",
ossu7bb87ee2017-01-23 04:56:25 -0800151 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800152 "../api:rtc_stats_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700153 "../api/audio_codecs:builtin_audio_decoder_factory",
154 "../api/audio_codecs:builtin_audio_encoder_factory",
ilnikd60d06a2017-04-05 03:02:20 -0700155 "../api/video_codecs:video_codecs_api",
mbonadei7d9a55b2017-06-01 13:01:48 -0700156 "../base:rtc_base",
157 "../base:rtc_base_approved",
ossu7bb87ee2017-01-23 04:56:25 -0800158 "../call",
mbonadei7d9a55b2017-06-01 13:01:48 -0700159 "../logging:rtc_event_log_api",
ossu7bb87ee2017-01-23 04:56:25 -0800160 "../media",
mbonadei7d9a55b2017-06-01 13:01:48 -0700161 "../modules/audio_device:audio_device",
162 "../p2p:rtc_p2p",
ossu7bb87ee2017-01-23 04:56:25 -0800163 "../stats",
mbonadei7d9a55b2017-06-01 13:01:48 -0700164 "../system_wrappers:system_wrappers",
ossu7bb87ee2017-01-23 04:56:25 -0800165 ]
166
ossuda250062017-01-23 07:37:43 -0800167 public_deps = [
168 "../api:libjingle_peerconnection_api",
169 ]
170
ossu7bb87ee2017-01-23 04:56:25 -0800171 if (rtc_use_quic) {
172 sources += [
173 "quicdatachannel.cc",
174 "quicdatachannel.h",
175 "quicdatatransport.cc",
176 "quicdatatransport.h",
177 ]
178 deps += [ "//third_party/libquic" ]
179 public_deps = [
180 "//third_party/libquic",
181 ]
182 }
183}
184
kjellander142f8c52016-06-13 00:08:24 -0700185if (rtc_include_tests) {
186 config("rtc_pc_unittests_config") {
187 # GN orders flags on a target before flags from configs. The default config
188 # adds -Wall, and this flag have to be after -Wall -- so they need to
189 # come from a config and can't be on the target directly.
190 if (!is_win && !is_clang) {
191 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
192 }
193 }
194
ehmaldonado38a21322016-09-02 04:10:34 -0700195 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700196 testonly = true
197
198 sources = [
199 "bundlefilter_unittest.cc",
200 "channel_unittest.cc",
201 "channelmanager_unittest.cc",
202 "currentspeakermonitor_unittest.cc",
203 "mediasession_unittest.cc",
204 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700205 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700206 "srtpfilter_unittest.cc",
207 ]
208
209 include_dirs = [ "//third_party/libsrtp/srtp" ]
210
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700211 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700212
kjellandere40a7ee2016-10-16 23:56:12 -0700213 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700214 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700215 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700216 }
217
218 if (is_win) {
219 libs = [ "strmiids.lib" ]
220 }
221
222 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800223 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700224 ":rtc_pc",
mbonadei7d9a55b2017-06-01 13:01:48 -0700225 "../base:rtc_base",
226 "../base:rtc_base_approved",
mbonadei9087d492017-04-25 00:35:35 -0700227 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700228 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700229 "../logging:rtc_event_log_api",
230 "../media:rtc_media_base",
mbonadei9087d492017-04-25 00:35:35 -0700231 "../media:rtc_media_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700232 "../p2p:p2p_test_utils",
233 "../p2p:rtc_p2p",
kjellander142f8c52016-06-13 00:08:24 -0700234 "../system_wrappers:metrics_default",
235 ]
236
237 if (rtc_build_libsrtp) {
238 deps += [ "//third_party/libsrtp" ]
239 }
240
241 if (is_android) {
242 deps += [ "//testing/android/native_test:native_test_support" ]
243 }
244 }
ossu7bb87ee2017-01-23 04:56:25 -0800245
deadbeefe814a0d2017-02-25 18:15:09 -0800246 rtc_source_set("pc_test_utils") {
247 testonly = true
248 sources = [
249 "test/fakeaudiocapturemodule.cc",
250 "test/fakeaudiocapturemodule.h",
251 "test/fakedatachannelprovider.h",
252 "test/fakeperiodicvideocapturer.h",
253 "test/fakertccertificategenerator.h",
254 "test/fakevideotrackrenderer.h",
255 "test/fakevideotracksource.h",
256 "test/mock_datachannel.h",
257 "test/mock_peerconnection.h",
258 "test/mock_webrtcsession.h",
259 "test/mockpeerconnectionobservers.h",
260 "test/peerconnectiontestwrapper.cc",
261 "test/peerconnectiontestwrapper.h",
262 "test/rtcstatsobtainer.h",
263 "test/testsdpstrings.h",
264 ]
265
266 deps = [
267 ":libjingle_peerconnection",
mbonadei7d9a55b2017-06-01 13:01:48 -0700268 "..:webrtc_common",
269 "../api:libjingle_peerconnection_test_api",
270 "../api:rtc_stats_api",
271 "../base:rtc_base",
272 "../base:rtc_base_approved",
deadbeefe814a0d2017-02-25 18:15:09 -0800273 "../base:rtc_base_tests_utils",
mbonadei7d9a55b2017-06-01 13:01:48 -0700274 "../media:rtc_media",
275 "../media:rtc_media_tests_utils",
276 "../modules/audio_device:audio_device",
277 "../p2p:p2p_test_utils",
278 "../test:test_support",
deadbeefe814a0d2017-02-25 18:15:09 -0800279 "//testing/gmock",
280 ]
281
282 if (!build_with_chromium && is_clang) {
283 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
284 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
285 }
286 }
287
ossu7bb87ee2017-01-23 04:56:25 -0800288 config("peerconnection_unittests_config") {
289 # The warnings below are enabled by default. Since GN orders compiler flags
290 # for a target before flags from configs, the only way to disable such
291 # warnings is by having them in a separate config, loaded from the target.
292 # TODO(kjellander): Make the code compile without disabling these flags.
293 # See https://bugs.webrtc.org/3307.
294 if (is_clang && is_win) {
295 cflags = [
296 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
297 # for -Wno-sign-compare
298 "-Wno-sign-compare",
299 "-Wno-unused-function",
300 ]
301 }
302
303 if (!is_win) {
304 cflags = [ "-Wno-sign-compare" ]
305 }
306 }
307
308 rtc_test("peerconnection_unittests") {
309 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
310 testonly = true
311 sources = [
312 "datachannel_unittest.cc",
313 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700314 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800315 "jsepsessiondescription_unittest.cc",
316 "localaudiosource_unittest.cc",
317 "mediaconstraintsinterface_unittest.cc",
318 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700319 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800320 "peerconnectionendtoend_unittest.cc",
321 "peerconnectionfactory_unittest.cc",
322 "peerconnectioninterface_unittest.cc",
323 "proxy_unittest.cc",
324 "rtcstats_integrationtest.cc",
325 "rtcstatscollector_unittest.cc",
326 "rtpsenderreceiver_unittest.cc",
327 "sctputils_unittest.cc",
328 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800329 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800330 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800331 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800332 "videocapturertracksource_unittest.cc",
333 "videotrack_unittest.cc",
334 "webrtcsdp_unittest.cc",
335 "webrtcsession_unittest.cc",
336 ]
337
338 if (rtc_enable_sctp) {
339 defines = [ "HAVE_SCTP" ]
340 }
341
342 configs += [ ":peerconnection_unittests_config" ]
343
344 if (!build_with_chromium && is_clang) {
345 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
346 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
347 }
348
349 # TODO(jschuh): Bug 1348: fix this warning.
350 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
351
352 if (is_win) {
353 cflags = [
354 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
355 "/wd4389", # signed/unsigned mismatch.
356 ]
357 }
358
359 if (rtc_use_quic) {
360 public_deps = [
361 "//third_party/libquic",
362 ]
363 sources += [
364 "quicdatachannel_unittest.cc",
365 "quicdatatransport_unittest.cc",
366 ]
367 }
368
369 deps = []
370 if (is_android) {
371 sources += [
372 "test/androidtestinitializer.cc",
373 "test/androidtestinitializer.h",
374 ]
375 deps += [
376 "//testing/android/native_test:native_test_support",
377 "//webrtc/sdk/android:libjingle_peerconnection_java",
378 "//webrtc/sdk/android:libjingle_peerconnection_jni",
379 ]
380 }
381
382 deps += [
383 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800384 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800385 "..:webrtc_common",
386 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700387 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800388 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700389 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800390 "../pc:rtc_pc",
391 "../system_wrappers:metrics_default",
392 "//testing/gmock",
393 ]
394
395 if (is_android) {
396 deps += [ "//testing/android/native_test:native_test_support" ]
397
398 shard_timeout = 900
399 }
400 }
kjellander142f8c52016-06-13 00:08:24 -0700401}