blob: 54471c6620dafc995e62df97298cd640b8db3fda [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") {
deadbeef40610e22016-12-22 10:53:38 -080022 defines = [ "HAVE_SRTP" ]
23 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",
41 "mediamonitor.cc",
42 "mediamonitor.h",
43 "mediasession.cc",
44 "mediasession.h",
kjellanderc76dc952016-06-03 03:09:32 -070045 "rtcpmuxfilter.cc",
46 "rtcpmuxfilter.h",
47 "srtpfilter.cc",
48 "srtpfilter.h",
49 "voicechannel.h",
50 ]
51
52 deps = [
kjellandera69d9732016-08-31 07:33:05 -070053 "../api:call_api",
kjellanderc76dc952016-06-03 03:09:32 -070054 "../base:rtc_base",
55 "../media",
56 ]
57
58 if (build_with_chromium) {
59 sources += [
60 "externalhmac.cc",
61 "externalhmac.h",
62 ]
63 }
64 if (rtc_build_libsrtp) {
65 deps += [ "//third_party/libsrtp" ]
66 }
67
ehmaldonadoe9cc6862016-09-05 06:10:18 -070068 public_configs = [ ":rtc_pc_config" ]
kjellanderc76dc952016-06-03 03:09:32 -070069
kjellandere40a7ee2016-10-16 23:56:12 -070070 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -070071 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -070072 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellanderc76dc952016-06-03 03:09:32 -070073 }
74}
kjellander142f8c52016-06-13 00:08:24 -070075
ossu7bb87ee2017-01-23 04:56:25 -080076config("libjingle_peerconnection_warnings_config") {
77 # GN orders flags on a target before flags from configs. The default config
78 # adds these flags so to cancel them out they need to come from a config and
79 # cannot be on the target directly.
80 if (!is_win && !is_clang) {
81 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
82 }
83}
84
85rtc_static_library("libjingle_peerconnection") {
86 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
87 cflags = []
88 sources = [
89 "audiotrack.cc",
90 "audiotrack.h",
91 "datachannel.cc",
92 "datachannel.h",
93 "dtmfsender.cc",
94 "dtmfsender.h",
95 "jsepicecandidate.cc",
96 "jsepsessiondescription.cc",
97 "localaudiosource.cc",
98 "localaudiosource.h",
99 "mediacontroller.cc",
100 "mediacontroller.h",
101 "mediastream.cc",
102 "mediastream.h",
103 "mediastreamobserver.cc",
104 "mediastreamobserver.h",
105 "mediastreamtrack.h",
106 "ortcfactory.cc",
107 "ortcfactory.h",
108 "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",
150 "../api:call_api",
ossu7bb87ee2017-01-23 04:56:25 -0800151 "../api:rtc_stats_api",
152 "../call",
153 "../media",
154 "../stats",
155 ]
156
ossuda250062017-01-23 07:37:43 -0800157 public_deps = [
158 "../api:libjingle_peerconnection_api",
159 ]
160
ossu7bb87ee2017-01-23 04:56:25 -0800161 if (rtc_use_quic) {
162 sources += [
163 "quicdatachannel.cc",
164 "quicdatachannel.h",
165 "quicdatatransport.cc",
166 "quicdatatransport.h",
167 ]
168 deps += [ "//third_party/libquic" ]
169 public_deps = [
170 "//third_party/libquic",
171 ]
172 }
173}
174
kjellander142f8c52016-06-13 00:08:24 -0700175if (rtc_include_tests) {
176 config("rtc_pc_unittests_config") {
177 # GN orders flags on a target before flags from configs. The default config
178 # adds -Wall, and this flag have to be after -Wall -- so they need to
179 # come from a config and can't be on the target directly.
180 if (!is_win && !is_clang) {
181 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
182 }
183 }
184
ehmaldonado38a21322016-09-02 04:10:34 -0700185 rtc_test("rtc_pc_unittests") {
kjellander142f8c52016-06-13 00:08:24 -0700186 testonly = true
187
188 sources = [
189 "bundlefilter_unittest.cc",
190 "channel_unittest.cc",
191 "channelmanager_unittest.cc",
192 "currentspeakermonitor_unittest.cc",
193 "mediasession_unittest.cc",
194 "rtcpmuxfilter_unittest.cc",
195 "srtpfilter_unittest.cc",
196 ]
197
198 include_dirs = [ "//third_party/libsrtp/srtp" ]
199
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700200 configs += [ ":rtc_pc_unittests_config" ]
kjellander142f8c52016-06-13 00:08:24 -0700201
kjellandere40a7ee2016-10-16 23:56:12 -0700202 if (!build_with_chromium && is_clang) {
kjellander142f8c52016-06-13 00:08:24 -0700203 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
ehmaldonado38a21322016-09-02 04:10:34 -0700204 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander142f8c52016-06-13 00:08:24 -0700205 }
206
207 if (is_win) {
208 libs = [ "strmiids.lib" ]
209 }
210
211 deps = [
ossu7bb87ee2017-01-23 04:56:25 -0800212 ":libjingle_peerconnection",
kjellander142f8c52016-06-13 00:08:24 -0700213 ":rtc_pc",
kjellander142f8c52016-06-13 00:08:24 -0700214 "../base:rtc_base_tests_utils",
215 "../media:rtc_unittest_main",
216 "../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
228 config("peerconnection_unittests_config") {
229 # The warnings below are enabled by default. Since GN orders compiler flags
230 # for a target before flags from configs, the only way to disable such
231 # warnings is by having them in a separate config, loaded from the target.
232 # TODO(kjellander): Make the code compile without disabling these flags.
233 # See https://bugs.webrtc.org/3307.
234 if (is_clang && is_win) {
235 cflags = [
236 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
237 # for -Wno-sign-compare
238 "-Wno-sign-compare",
239 "-Wno-unused-function",
240 ]
241 }
242
243 if (!is_win) {
244 cflags = [ "-Wno-sign-compare" ]
245 }
246 }
247
248 rtc_test("peerconnection_unittests") {
249 check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
250 testonly = true
251 sources = [
252 "datachannel_unittest.cc",
253 "dtmfsender_unittest.cc",
254 "fakemediacontroller.h",
255 "jsepsessiondescription_unittest.cc",
256 "localaudiosource_unittest.cc",
257 "mediaconstraintsinterface_unittest.cc",
258 "mediastream_unittest.cc",
259 "ortcfactory_unittest.cc",
260 "peerconnection_unittest.cc",
261 "peerconnectionendtoend_unittest.cc",
262 "peerconnectionfactory_unittest.cc",
263 "peerconnectioninterface_unittest.cc",
264 "proxy_unittest.cc",
265 "rtcstats_integrationtest.cc",
266 "rtcstatscollector_unittest.cc",
267 "rtpsenderreceiver_unittest.cc",
268 "sctputils_unittest.cc",
269 "statscollector_unittest.cc",
270 "test/fakeaudiocapturemodule.cc",
271 "test/fakeaudiocapturemodule.h",
272 "test/fakeaudiocapturemodule_unittest.cc",
273 "test/fakedatachannelprovider.h",
274 "test/fakeperiodicvideocapturer.h",
275 "test/fakertccertificategenerator.h",
276 "test/fakevideotrackrenderer.h",
277 "test/fakevideotracksource.h",
278 "test/mock_datachannel.h",
279 "test/mock_peerconnection.h",
280 "test/mock_webrtcsession.h",
281 "test/mockpeerconnectionobservers.h",
282 "test/peerconnectiontestwrapper.cc",
283 "test/peerconnectiontestwrapper.h",
284 "test/rtcstatsobtainer.h",
285 "test/testsdpstrings.h",
deadbeef804c1af2017-02-11 19:07:31 -0800286 "trackmediainfomap_unittest.cc",
ossu7bb87ee2017-01-23 04:56:25 -0800287 "videocapturertracksource_unittest.cc",
288 "videotrack_unittest.cc",
289 "webrtcsdp_unittest.cc",
290 "webrtcsession_unittest.cc",
291 ]
292
293 if (rtc_enable_sctp) {
294 defines = [ "HAVE_SCTP" ]
295 }
296
297 configs += [ ":peerconnection_unittests_config" ]
298
299 if (!build_with_chromium && is_clang) {
300 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
301 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
302 }
303
304 # TODO(jschuh): Bug 1348: fix this warning.
305 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
306
307 if (is_win) {
308 cflags = [
309 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
310 "/wd4389", # signed/unsigned mismatch.
311 ]
312 }
313
314 if (rtc_use_quic) {
315 public_deps = [
316 "//third_party/libquic",
317 ]
318 sources += [
319 "quicdatachannel_unittest.cc",
320 "quicdatatransport_unittest.cc",
321 ]
322 }
323
324 deps = []
325 if (is_android) {
326 sources += [
327 "test/androidtestinitializer.cc",
328 "test/androidtestinitializer.h",
329 ]
330 deps += [
331 "//testing/android/native_test:native_test_support",
332 "//webrtc/sdk/android:libjingle_peerconnection_java",
333 "//webrtc/sdk/android:libjingle_peerconnection_jni",
334 ]
335 }
336
337 deps += [
338 ":libjingle_peerconnection",
339 "..:webrtc_common",
340 "../api:fakemetricsobserver",
341 "../base:rtc_base_tests_utils",
342 "../media:rtc_unittest_main",
343 "../pc:rtc_pc",
344 "../system_wrappers:metrics_default",
345 "//testing/gmock",
346 ]
347
348 if (is_android) {
349 deps += [ "//testing/android/native_test:native_test_support" ]
350
351 shard_timeout = 900
352 }
353 }
kjellander142f8c52016-06-13 00:08:24 -0700354}