blob: 483485012da481803fe641f220ef643832af61bb [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",
ossu7bb87ee2017-01-23 04:56:25 -080098 "mediastream.cc",
99 "mediastream.h",
100 "mediastreamobserver.cc",
101 "mediastreamobserver.h",
102 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800103 "peerconnection.cc",
104 "peerconnection.h",
105 "peerconnectionfactory.cc",
106 "peerconnectionfactory.h",
107 "remoteaudiosource.cc",
108 "remoteaudiosource.h",
109 "rtcstatscollector.cc",
110 "rtcstatscollector.h",
111 "rtpreceiver.cc",
112 "rtpreceiver.h",
113 "rtpsender.cc",
114 "rtpsender.h",
115 "sctputils.cc",
116 "sctputils.h",
117 "statscollector.cc",
118 "statscollector.h",
119 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800120 "trackmediainfomap.cc",
121 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800122 "videocapturertracksource.cc",
123 "videocapturertracksource.h",
124 "videotrack.cc",
125 "videotrack.h",
126 "videotracksource.cc",
127 "videotracksource.h",
128 "webrtcsdp.cc",
129 "webrtcsdp.h",
130 "webrtcsession.cc",
131 "webrtcsession.h",
132 "webrtcsessiondescriptionfactory.cc",
133 "webrtcsessiondescriptionfactory.h",
134 ]
135
136 configs += [ ":libjingle_peerconnection_warnings_config" ]
137
138 if (!build_with_chromium && is_clang) {
139 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
140 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
141 }
142
143 deps = [
144 ":rtc_pc",
145 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800146 "../api:rtc_stats_api",
ilnikd60d06a2017-04-05 03:02:20 -0700147 "../api/video_codecs:video_codecs_api",
ossu7bb87ee2017-01-23 04:56:25 -0800148 "../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",
zstein56162b92017-04-24 16:54:35 -0700191 "rtptransport_unittest.cc",
kjellander142f8c52016-06-13 00:08:24 -0700192 "srtpfilter_unittest.cc",
193 ]
194
195 include_dirs = [ "//third_party/libsrtp/srtp" ]
196
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700197 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700198
kjellandere40a7ee2016-10-16 23:56:12 -0700199 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700200 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700201 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700202 }
203
204 if (is_win) {
205 libs = [ "strmiids.lib" ]
206 }
207
208 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800209 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700210 ":rtc_pc",
mbonadei9087d492017-04-25 00:35:35 -0700211 "../base:rtc_base_tests_main",
kjellander142f8c52016-06-13 00:08:24 -0700212 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700213 "../media:rtc_media_tests_utils",
kjellander142f8c52016-06-13 00:08:24 -0700214 "../system_wrappers:metrics_default",
215 ]
216
217 if (rtc_build_libsrtp) {
218 deps += [ "//third_party/libsrtp" ]
219 }
220
221 if (is_android) {
222 deps += [ "//testing/android/native_test:native_test_support" ]
223 }
224 }
ossu7bb87ee2017-01-23 04:56:25 -0800225
deadbeefe814a0d2017-02-25 18:15:09 -0800226 rtc_source_set("pc_test_utils") {
227 testonly = true
228 sources = [
229 "test/fakeaudiocapturemodule.cc",
230 "test/fakeaudiocapturemodule.h",
231 "test/fakedatachannelprovider.h",
232 "test/fakeperiodicvideocapturer.h",
233 "test/fakertccertificategenerator.h",
234 "test/fakevideotrackrenderer.h",
235 "test/fakevideotracksource.h",
236 "test/mock_datachannel.h",
237 "test/mock_peerconnection.h",
238 "test/mock_webrtcsession.h",
239 "test/mockpeerconnectionobservers.h",
240 "test/peerconnectiontestwrapper.cc",
241 "test/peerconnectiontestwrapper.h",
242 "test/rtcstatsobtainer.h",
243 "test/testsdpstrings.h",
244 ]
245
246 deps = [
247 ":libjingle_peerconnection",
248 "../base:rtc_base_tests_utils",
249 "//testing/gmock",
250 ]
251
252 if (!build_with_chromium && is_clang) {
253 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
254 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
255 }
256 }
257
ossu7bb87ee2017-01-23 04:56:25 -0800258 config("peerconnection_unittests_config") {
259 # The warnings below are enabled by default. Since GN orders compiler flags
260 # for a target before flags from configs, the only way to disable such
261 # warnings is by having them in a separate config, loaded from the target.
262 # TODO(kjellander): Make the code compile without disabling these flags.
263 # See https://bugs.webrtc.org/3307.
264 if (is_clang && is_win) {
265 cflags = [
266 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
267 # for -Wno-sign-compare
268 "-Wno-sign-compare",
269 "-Wno-unused-function",
270 ]
271 }
272
273 if (!is_win) {
274 cflags = [ "-Wno-sign-compare" ]
275 }
276 }
277
278 rtc_test("peerconnection_unittests") {
279 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
280 testonly = true
281 sources = [
282 "datachannel_unittest.cc",
283 "dtmfsender_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700284 "iceserverparsing_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800285 "jsepsessiondescription_unittest.cc",
286 "localaudiosource_unittest.cc",
287 "mediaconstraintsinterface_unittest.cc",
288 "mediastream_unittest.cc",
deadbeef1dcb1642017-03-29 21:08:16 -0700289 "peerconnection_integrationtest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800290 "peerconnectionendtoend_unittest.cc",
291 "peerconnectionfactory_unittest.cc",
292 "peerconnectioninterface_unittest.cc",
293 "proxy_unittest.cc",
294 "rtcstats_integrationtest.cc",
295 "rtcstatscollector_unittest.cc",
296 "rtpsenderreceiver_unittest.cc",
297 "sctputils_unittest.cc",
298 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800299 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800300 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800301 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800302 "videocapturertracksource_unittest.cc",
303 "videotrack_unittest.cc",
304 "webrtcsdp_unittest.cc",
305 "webrtcsession_unittest.cc",
306 ]
307
308 if (rtc_enable_sctp) {
309 defines = [ "HAVE_SCTP" ]
310 }
311
312 configs += [ ":peerconnection_unittests_config" ]
313
314 if (!build_with_chromium && is_clang) {
315 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
316 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
317 }
318
319 # TODO(jschuh): Bug 1348: fix this warning.
320 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
321
322 if (is_win) {
323 cflags = [
324 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
325 "/wd4389", # signed/unsigned mismatch.
326 ]
327 }
328
329 if (rtc_use_quic) {
330 public_deps = [
331 "//third_party/libquic",
332 ]
333 sources += [
334 "quicdatachannel_unittest.cc",
335 "quicdatatransport_unittest.cc",
336 ]
337 }
338
339 deps = []
340 if (is_android) {
341 sources += [
342 "test/androidtestinitializer.cc",
343 "test/androidtestinitializer.h",
344 ]
345 deps += [
346 "//testing/android/native_test:native_test_support",
347 "//webrtc/sdk/android:libjingle_peerconnection_java",
348 "//webrtc/sdk/android:libjingle_peerconnection_jni",
349 ]
350 }
351
352 deps += [
353 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800354 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800355 "..:webrtc_common",
356 "../api:fakemetricsobserver",
mbonadei9087d492017-04-25 00:35:35 -0700357 "../base:rtc_base_tests_main",
ossu7bb87ee2017-01-23 04:56:25 -0800358 "../base:rtc_base_tests_utils",
mbonadei9087d492017-04-25 00:35:35 -0700359 "../media:rtc_media_tests_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800360 "../pc:rtc_pc",
361 "../system_wrappers:metrics_default",
362 "//testing/gmock",
363 ]
364
365 if (is_android) {
366 deps += [ "//testing/android/native_test:native_test_support" ]
367
368 shard_timeout = 900
369 }
370 }
kjellander142f8c52016-06-13 00:08:24 -0700371}