blob: 8e78cafdab36248518f02be2de0ebf409fc52103 [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 = [
kjellandera69d9732016-08-31 07:33:05 -070057 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -070058 "../base:rtc_base",
59 "../media",
60 ]
61
kjellanderc76dc952016-06-03 03:09:32 -070062 if (rtc_build_libsrtp) {
63 deps += [ "//third_party/libsrtp" ]
64 }
65
ehmaldonadoe9cc6862016-09-05 06:10:18 -070066 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070067
kjellandere40a7ee2016-10-16 23:56:12 -070068 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070069 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070070 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070071 }
72}
kjellander142f8c52016-06-13 00:08:24 -070073
ossu7bb87ee2017-01-23 04:56:25 -080074config("libjingle_peerconnection_warnings_config") {
75 # GN orders flags on a target before flags from configs. The default config
76 # adds these flags so to cancel them out they need to come from a config and
77 # cannot be on the target directly.
78 if (!is_win && !is_clang) {
79 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
80 }
81}
82
83rtc_static_library("libjingle_peerconnection") {
ossu7bb87ee2017-01-23 04:56:25 -080084 cflags = []
85 sources = [
86 "audiotrack.cc",
87 "audiotrack.h",
88 "datachannel.cc",
89 "datachannel.h",
90 "dtmfsender.cc",
91 "dtmfsender.h",
deadbeef1dcb1642017-03-29 21:08:16 -070092 "iceserverparsing.cc",
93 "iceserverparsing.h",
ossu7bb87ee2017-01-23 04:56:25 -080094 "jsepicecandidate.cc",
95 "jsepsessiondescription.cc",
96 "localaudiosource.cc",
97 "localaudiosource.h",
98 "mediacontroller.cc",
99 "mediacontroller.h",
100 "mediastream.cc",
101 "mediastream.h",
102 "mediastreamobserver.cc",
103 "mediastreamobserver.h",
104 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800105 "peerconnection.cc",
106 "peerconnection.h",
107 "peerconnectionfactory.cc",
108 "peerconnectionfactory.h",
109 "remoteaudiosource.cc",
110 "remoteaudiosource.h",
111 "rtcstatscollector.cc",
112 "rtcstatscollector.h",
113 "rtpreceiver.cc",
114 "rtpreceiver.h",
115 "rtpsender.cc",
116 "rtpsender.h",
117 "sctputils.cc",
118 "sctputils.h",
119 "statscollector.cc",
120 "statscollector.h",
121 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800122 "trackmediainfomap.cc",
123 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800124 "videocapturertracksource.cc",
125 "videocapturertracksource.h",
126 "videotrack.cc",
127 "videotrack.h",
128 "videotracksource.cc",
129 "videotracksource.h",
130 "webrtcsdp.cc",
131 "webrtcsdp.h",
132 "webrtcsession.cc",
133 "webrtcsession.h",
134 "webrtcsessiondescriptionfactory.cc",
135 "webrtcsessiondescriptionfactory.h",
136 ]
137
138 configs += [ ":libjingle_peerconnection_warnings_config" ]
139
140 if (!build_with_chromium && is_clang) {
141 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
142 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
143 }
144
145 deps = [
146 ":rtc_pc",
147 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800148 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700149 "../api/video_codecs:video_codecs_api",
ossu7bb87ee2017-01-23 04:56:25 -0800150 "../call",
151 "../media",
152 "../stats",
153 ]
154
ossuda250062017-01-23 07:37:43 -0800155 public_deps = [
156 "../api:libjingle_peerconnection_api",
157 ]
158
ossu7bb87ee2017-01-23 04:56:25 -0800159 if (rtc_use_quic) {
160 sources += [
161 "quicdatachannel.cc",
162 "quicdatachannel.h",
163 "quicdatatransport.cc",
164 "quicdatatransport.h",
165 ]
166 deps += [ "//third_party/libquic" ]
167 public_deps = [
168 "//third_party/libquic",
169 ]
170 }
171}
172
kjellander142f8c52016-06-13 00:08:24 -0700173if (rtc_include_tests) {
174 config("rtc_pc_unittests_config") {
175 # GN orders flags on a target before flags from configs. The default config
176 # adds -Wall, and this flag have to be after -Wall -- so they need to
177 # come from a config and can't be on the target directly.
178 if (!is_win && !is_clang) {
179 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
180 }
181 }
182
ehmaldonado38a21322016-09-02 04:10:34 -0700183 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700184 testonly = true
185
186 sources = [
187 "bundlefilter_unittest.cc",
188 "channel_unittest.cc",
189 "channelmanager_unittest.cc",
190 "currentspeakermonitor_unittest.cc",
191 "mediasession_unittest.cc",
192 "rtcpmuxfilter_unittest.cc",
zstein56162b92017-04-24 16:54:35 -0700193 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700194 "srtpfilter_unittest.cc",
195 ]
196
197 include_dirs = [ "//third_party/libsrtp/srtp" ]
198
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700199 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700200
kjellandere40a7ee2016-10-16 23:56:12 -0700201 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700202 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700203 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700204 }
205
206 if (is_win) {
207 libs = [ "strmiids.lib" ]
208 }
209
210 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800211 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700212 ":rtc_pc",
mbonadei9087d492017-04-25 00:35:35 -0700213 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700214 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700215 "../media:rtc_media_tests_utils",
kjellander142f8c52016-06-13 00:08:24 -0700216 "../system_wrappers:metrics_default",
217 ]
218
219 if (rtc_build_libsrtp) {
220 deps += [ "//third_party/libsrtp" ]
221 }
222
223 if (is_android) {
224 deps += [ "//testing/android/native_test:native_test_support" ]
225 }
226 }
ossu7bb87ee2017-01-23 04:56:25 -0800227
deadbeefe814a0d2017-02-25 18:15:09 -0800228 rtc_source_set("pc_test_utils") {
229 testonly = true
230 sources = [
231 "test/fakeaudiocapturemodule.cc",
232 "test/fakeaudiocapturemodule.h",
233 "test/fakedatachannelprovider.h",
234 "test/fakeperiodicvideocapturer.h",
235 "test/fakertccertificategenerator.h",
236 "test/fakevideotrackrenderer.h",
237 "test/fakevideotracksource.h",
238 "test/mock_datachannel.h",
239 "test/mock_peerconnection.h",
240 "test/mock_webrtcsession.h",
241 "test/mockpeerconnectionobservers.h",
242 "test/peerconnectiontestwrapper.cc",
243 "test/peerconnectiontestwrapper.h",
244 "test/rtcstatsobtainer.h",
245 "test/testsdpstrings.h",
246 ]
247
248 deps = [
249 ":libjingle_peerconnection",
250 "../base:rtc_base_tests_utils",
251 "//testing/gmock",
252 ]
253
254 if (!build_with_chromium && is_clang) {
255 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
256 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
257 }
258 }
259
ossu7bb87ee2017-01-23 04:56:25 -0800260 config("peerconnection_unittests_config") {
261 # The warnings below are enabled by default. Since GN orders compiler flags
262 # for a target before flags from configs, the only way to disable such
263 # warnings is by having them in a separate config, loaded from the target.
264 # TODO(kjellander): Make the code compile without disabling these flags.
265 # See https://bugs.webrtc.org/3307.
266 if (is_clang && is_win) {
267 cflags = [
268 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
269 # for -Wno-sign-compare
270 "-Wno-sign-compare",
271 "-Wno-unused-function",
272 ]
273 }
274
275 if (!is_win) {
276 cflags = [ "-Wno-sign-compare" ]
277 }
278 }
279
280 rtc_test("peerconnection_unittests") {
281 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
282 testonly = true
283 sources = [
284 "datachannel_unittest.cc",
285 "dtmfsender_unittest.cc",
286 "fakemediacontroller.h",
deadbeef1dcb1642017-03-29 21:08:16 -0700287 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800288 "jsepsessiondescription_unittest.cc",
289 "localaudiosource_unittest.cc",
290 "mediaconstraintsinterface_unittest.cc",
291 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700292 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800293 "peerconnectionendtoend_unittest.cc",
294 "peerconnectionfactory_unittest.cc",
295 "peerconnectioninterface_unittest.cc",
296 "proxy_unittest.cc",
297 "rtcstats_integrationtest.cc",
298 "rtcstatscollector_unittest.cc",
299 "rtpsenderreceiver_unittest.cc",
300 "sctputils_unittest.cc",
301 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800302 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800303 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800304 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800305 "videocapturertracksource_unittest.cc",
306 "videotrack_unittest.cc",
307 "webrtcsdp_unittest.cc",
308 "webrtcsession_unittest.cc",
309 ]
310
311 if (rtc_enable_sctp) {
312 defines = [ "HAVE_SCTP" ]
313 }
314
315 configs += [ ":peerconnection_unittests_config" ]
316
317 if (!build_with_chromium && is_clang) {
318 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
319 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
320 }
321
322 # TODO(jschuh): Bug 1348: fix this warning.
323 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
324
325 if (is_win) {
326 cflags = [
327 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
328 "/wd4389", # signed/unsigned mismatch.
329 ]
330 }
331
332 if (rtc_use_quic) {
333 public_deps = [
334 "//third_party/libquic",
335 ]
336 sources += [
337 "quicdatachannel_unittest.cc",
338 "quicdatatransport_unittest.cc",
339 ]
340 }
341
342 deps = []
343 if (is_android) {
344 sources += [
345 "test/androidtestinitializer.cc",
346 "test/androidtestinitializer.h",
347 ]
348 deps += [
349 "//testing/android/native_test:native_test_support",
350 "//webrtc/sdk/android:libjingle_peerconnection_java",
351 "//webrtc/sdk/android:libjingle_peerconnection_jni",
352 ]
353 }
354
355 deps += [
356 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800357 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800358 "..:webrtc_common",
359 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700360 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800361 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700362 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800363 "../pc:rtc_pc",
364 "../system_wrappers:metrics_default",
365 "//testing/gmock",
366 ]
367
368 if (is_android) {
369 deps += [ "//testing/android/native_test:native_test_support" ]
370
371 shard_timeout = 900
372 }
373 }
kjellander142f8c52016-06-13 00:08:24 -0700374}