blob: 5e38c6b9dda3aa03443bd73d841575e90c9a31ee [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",
91 "jsepicecandidate.cc",
92 "jsepsessiondescription.cc",
93 "localaudiosource.cc",
94 "localaudiosource.h",
95 "mediacontroller.cc",
96 "mediacontroller.h",
97 "mediastream.cc",
98 "mediastream.h",
99 "mediastreamobserver.cc",
100 "mediastreamobserver.h",
101 "mediastreamtrack.h",
ossu7bb87ee2017-01-23 04:56:25 -0800102 "peerconnection.cc",
103 "peerconnection.h",
104 "peerconnectionfactory.cc",
105 "peerconnectionfactory.h",
106 "remoteaudiosource.cc",
107 "remoteaudiosource.h",
108 "rtcstatscollector.cc",
109 "rtcstatscollector.h",
110 "rtpreceiver.cc",
111 "rtpreceiver.h",
112 "rtpsender.cc",
113 "rtpsender.h",
114 "sctputils.cc",
115 "sctputils.h",
116 "statscollector.cc",
117 "statscollector.h",
118 "streamcollection.h",
deadbeef804c1af2017-02-11 19:07:31 -0800119 "trackmediainfomap.cc",
120 "trackmediainfomap.h",
ossu7bb87ee2017-01-23 04:56:25 -0800121 "videocapturertracksource.cc",
122 "videocapturertracksource.h",
123 "videotrack.cc",
124 "videotrack.h",
125 "videotracksource.cc",
126 "videotracksource.h",
127 "webrtcsdp.cc",
128 "webrtcsdp.h",
129 "webrtcsession.cc",
130 "webrtcsession.h",
131 "webrtcsessiondescriptionfactory.cc",
132 "webrtcsessiondescriptionfactory.h",
133 ]
134
135 configs += [ ":libjingle_peerconnection_warnings_config" ]
136
137 if (!build_with_chromium && is_clang) {
138 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
139 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
140 }
141
142 deps = [
143 ":rtc_pc",
144 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800145 "../api:rtc_stats_api",
146 "../call",
147 "../media",
148 "../stats",
149 ]
150
ossuda250062017-01-23 07:37:43 -0800151 public_deps = [
152 "../api:libjingle_peerconnection_api",
153 ]
154
ossu7bb87ee2017-01-23 04:56:25 -0800155 if (rtc_use_quic) {
156 sources += [
157 "quicdatachannel.cc",
158 "quicdatachannel.h",
159 "quicdatatransport.cc",
160 "quicdatatransport.h",
161 ]
162 deps += [ "//third_party/libquic" ]
163 public_deps = [
164 "//third_party/libquic",
165 ]
166 }
167}
168
kjellander142f8c52016-06-13 00:08:24 -0700169if (rtc_include_tests) {
170 config("rtc_pc_unittests_config") {
171 # GN orders flags on a target before flags from configs. The default config
172 # adds -Wall, and this flag have to be after -Wall -- so they need to
173 # come from a config and can't be on the target directly.
174 if (!is_win && !is_clang) {
175 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
176 }
177 }
178
ehmaldonado38a21322016-09-02 04:10:34 -0700179 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700180 testonly = true
181
182 sources = [
183 "bundlefilter_unittest.cc",
184 "channel_unittest.cc",
185 "channelmanager_unittest.cc",
186 "currentspeakermonitor_unittest.cc",
187 "mediasession_unittest.cc",
188 "rtcpmuxfilter_unittest.cc",
189 "srtpfilter_unittest.cc",
190 ]
191
192 include_dirs = [ "//third_party/libsrtp/srtp" ]
193
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700194 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700195
kjellandere40a7ee2016-10-16 23:56:12 -0700196 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700197 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700198 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700199 }
200
201 if (is_win) {
202 libs = [ "strmiids.lib" ]
203 }
204
205 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800206 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700207 ":rtc_pc",
kjellander142f8c52016-06-13 00:08:24 -0700208 "../base:rtc_base_tests_utils",
209 "../media:rtc_unittest_main",
210 "../system_wrappers:metrics_default",
211 ]
212
213 if (rtc_build_libsrtp) {
214 deps += [ "//third_party/libsrtp" ]
215 }
216
217 if (is_android) {
218 deps += [ "//testing/android/native_test:native_test_support" ]
219 }
220 }
ossu7bb87ee2017-01-23 04:56:25 -0800221
deadbeefe814a0d2017-02-25 18:15:09 -0800222 rtc_source_set("pc_test_utils") {
223 testonly = true
224 sources = [
225 "test/fakeaudiocapturemodule.cc",
226 "test/fakeaudiocapturemodule.h",
227 "test/fakedatachannelprovider.h",
228 "test/fakeperiodicvideocapturer.h",
229 "test/fakertccertificategenerator.h",
230 "test/fakevideotrackrenderer.h",
231 "test/fakevideotracksource.h",
232 "test/mock_datachannel.h",
233 "test/mock_peerconnection.h",
234 "test/mock_webrtcsession.h",
235 "test/mockpeerconnectionobservers.h",
236 "test/peerconnectiontestwrapper.cc",
237 "test/peerconnectiontestwrapper.h",
238 "test/rtcstatsobtainer.h",
239 "test/testsdpstrings.h",
240 ]
241
242 deps = [
243 ":libjingle_peerconnection",
244 "../base:rtc_base_tests_utils",
245 "//testing/gmock",
246 ]
247
248 if (!build_with_chromium && is_clang) {
249 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
250 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
251 }
252 }
253
ossu7bb87ee2017-01-23 04:56:25 -0800254 config("peerconnection_unittests_config") {
255 # The warnings below are enabled by default. Since GN orders compiler flags
256 # for a target before flags from configs, the only way to disable such
257 # warnings is by having them in a separate config, loaded from the target.
258 # TODO(kjellander): Make the code compile without disabling these flags.
259 # See https://bugs.webrtc.org/3307.
260 if (is_clang && is_win) {
261 cflags = [
262 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
263 # for -Wno-sign-compare
264 "-Wno-sign-compare",
265 "-Wno-unused-function",
266 ]
267 }
268
269 if (!is_win) {
270 cflags = [ "-Wno-sign-compare" ]
271 }
272 }
273
274 rtc_test("peerconnection_unittests") {
275 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
276 testonly = true
277 sources = [
278 "datachannel_unittest.cc",
279 "dtmfsender_unittest.cc",
280 "fakemediacontroller.h",
281 "jsepsessiondescription_unittest.cc",
282 "localaudiosource_unittest.cc",
283 "mediaconstraintsinterface_unittest.cc",
284 "mediastream_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800285 "peerconnection_unittest.cc",
286 "peerconnectionendtoend_unittest.cc",
287 "peerconnectionfactory_unittest.cc",
288 "peerconnectioninterface_unittest.cc",
289 "proxy_unittest.cc",
290 "rtcstats_integrationtest.cc",
291 "rtcstatscollector_unittest.cc",
292 "rtpsenderreceiver_unittest.cc",
293 "sctputils_unittest.cc",
294 "statscollector_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800295 "test/fakeaudiocapturemodule_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800296 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800297 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800298 "videocapturertracksource_unittest.cc",
299 "videotrack_unittest.cc",
300 "webrtcsdp_unittest.cc",
301 "webrtcsession_unittest.cc",
302 ]
303
304 if (rtc_enable_sctp) {
305 defines = [ "HAVE_SCTP" ]
306 }
307
308 configs += [ ":peerconnection_unittests_config" ]
309
310 if (!build_with_chromium && is_clang) {
311 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
312 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
313 }
314
315 # TODO(jschuh): Bug 1348: fix this warning.
316 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
317
318 if (is_win) {
319 cflags = [
320 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
321 "/wd4389", # signed/unsigned mismatch.
322 ]
323 }
324
325 if (rtc_use_quic) {
326 public_deps = [
327 "//third_party/libquic",
328 ]
329 sources += [
330 "quicdatachannel_unittest.cc",
331 "quicdatatransport_unittest.cc",
332 ]
333 }
334
335 deps = []
336 if (is_android) {
337 sources += [
338 "test/androidtestinitializer.cc",
339 "test/androidtestinitializer.h",
340 ]
341 deps += [
342 "//testing/android/native_test:native_test_support",
343 "//webrtc/sdk/android:libjingle_peerconnection_java",
344 "//webrtc/sdk/android:libjingle_peerconnection_jni",
345 ]
346 }
347
348 deps += [
349 ":libjingle_peerconnection",
deadbeefe814a0d2017-02-25 18:15:09 -0800350 ":pc_test_utils",
ossu7bb87ee2017-01-23 04:56:25 -0800351 "..:webrtc_common",
352 "../api:fakemetricsobserver",
353 "../base:rtc_base_tests_utils",
354 "../media:rtc_unittest_main",
355 "../pc:rtc_pc",
356 "../system_wrappers:metrics_default",
357 "//testing/gmock",
358 ]
359
360 if (is_android) {
361 deps += [ "//testing/android/native_test:native_test_support" ]
362
363 shard_timeout = 900
364 }
365 }
kjellander142f8c52016-06-13 00:08:24 -0700366}