blob: 1dd79bc35c7680200b11324de2423e136a2a73cb [file] [log] [blame]
hjonaa32c3e2015-12-13 19:58:11 -08001# Copyright (c) 2015 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
9import("../build/webrtc.gni")
kjellanderfd5b4e92016-06-13 12:08:33 -070010import("//testing/test.gni")
kjellanderc76dc952016-06-03 03:09:32 -070011
12group("api") {
13 deps = [
14 ":libjingle_peerconnection",
15 ]
16}
17
18config("libjingle_peerconnection_warnings_config") {
19 # GN orders flags on a target before flags from configs. The default config
20 # adds these flags so to cancel them out they need to come from a config and
21 # cannot be on the target directly.
kjellander3e33bfe2016-06-20 07:04:09 -070022 if (!is_win && !is_clang) {
23 cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
kjellanderc76dc952016-06-03 03:09:32 -070024 }
25}
26
27source_set("libjingle_peerconnection") {
28 cflags = []
29 sources = [
30 "audiotrack.cc",
31 "audiotrack.h",
32 "datachannel.cc",
33 "datachannel.h",
34 "datachannelinterface.h",
kjellanderc76dc952016-06-03 03:09:32 -070035 "dtlsidentitystore.h",
36 "dtmfsender.cc",
37 "dtmfsender.h",
38 "dtmfsenderinterface.h",
39 "jsep.h",
40 "jsepicecandidate.cc",
41 "jsepicecandidate.h",
42 "jsepsessiondescription.cc",
43 "jsepsessiondescription.h",
44 "localaudiosource.cc",
45 "localaudiosource.h",
46 "mediaconstraintsinterface.cc",
47 "mediaconstraintsinterface.h",
48 "mediacontroller.cc",
49 "mediacontroller.h",
50 "mediastream.cc",
51 "mediastream.h",
52 "mediastreaminterface.h",
53 "mediastreamobserver.cc",
54 "mediastreamobserver.h",
55 "mediastreamprovider.h",
56 "mediastreamproxy.h",
57 "mediastreamtrack.h",
58 "mediastreamtrackproxy.h",
59 "notifier.h",
60 "peerconnection.cc",
61 "peerconnection.h",
62 "peerconnectionfactory.cc",
63 "peerconnectionfactory.h",
64 "peerconnectionfactoryproxy.h",
65 "peerconnectioninterface.h",
66 "peerconnectionproxy.h",
67 "proxy.h",
68 "remoteaudiosource.cc",
69 "remoteaudiosource.h",
70 "rtpparameters.h",
71 "rtpreceiver.cc",
72 "rtpreceiver.h",
73 "rtpreceiverinterface.h",
74 "rtpsender.cc",
75 "rtpsender.h",
76 "rtpsenderinterface.h",
77 "sctputils.cc",
78 "sctputils.h",
79 "statscollector.cc",
80 "statscollector.h",
81 "statstypes.cc",
82 "statstypes.h",
83 "streamcollection.h",
84 "videocapturertracksource.cc",
85 "videocapturertracksource.h",
86 "videosourceproxy.h",
87 "videotrack.cc",
88 "videotrack.h",
89 "videotracksource.cc",
90 "videotracksource.h",
91 "webrtcsdp.cc",
92 "webrtcsdp.h",
93 "webrtcsession.cc",
94 "webrtcsession.h",
95 "webrtcsessiondescriptionfactory.cc",
96 "webrtcsessiondescriptionfactory.h",
97 ]
98
99 configs += [
100 "..:common_config",
101 ":libjingle_peerconnection_warnings_config",
102 ]
103 public_configs = [ "..:common_inherited_config" ]
104
105 if (is_clang) {
kjellanderfd5b4e92016-06-13 12:08:33 -0700106 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
kjellanderc76dc952016-06-03 03:09:32 -0700107 configs -= [ "//build/config/clang:find_bad_constructs" ]
108 }
109
kjellanderc76dc952016-06-03 03:09:32 -0700110 deps = [
katrielc14897d02016-06-03 13:14:28 -0700111 "../call",
kjellanderc76dc952016-06-03 03:09:32 -0700112 "../media",
113 "../pc",
114 ]
115
116 if (rtc_use_quic) {
117 sources += [
118 "quicdatachannel.cc",
119 "quicdatachannel.h",
120 "quicdatatransport.cc",
121 "quicdatatransport.h",
122 ]
123 deps += [ "//third_party/libquic" ]
124 public_deps = [
125 "//third_party/libquic",
126 ]
127 }
128}
kjellanderfd5b4e92016-06-13 12:08:33 -0700129
kjellander69b34622016-06-21 01:05:16 -0700130# Exclude the targets below from the Chromium build since they cannot be built
131# due to incompability with Chromium's logging implementation.
132if (is_android && !build_with_chromium) {
kjellanderfd5b4e92016-06-13 12:08:33 -0700133 config("libjingle_peerconnection_jni_warnings_config") {
134 # The warnings below are enabled by default. Since GN orders compiler flags
135 # for a target before flags from configs, the only way to disable such
136 # warnings is by having them in a separate config, loaded from the target.
137 if (!is_win) {
138 cflags = [
139 "-Wno-sign-compare",
140 "-Wno-unused-variable",
141 ]
142 }
143 }
144
145 source_set("libjingle_peerconnection_jni") {
146 sources = [
147 "androidvideocapturer.cc",
148 "androidvideocapturer.h",
149 "java/jni/androidmediacodeccommon.h",
150 "java/jni/androidmediadecoder_jni.cc",
151 "java/jni/androidmediadecoder_jni.h",
152 "java/jni/androidmediaencoder_jni.cc",
153 "java/jni/androidmediaencoder_jni.h",
154 "java/jni/androidmetrics_jni.cc",
155 "java/jni/androidnetworkmonitor_jni.cc",
156 "java/jni/androidnetworkmonitor_jni.h",
157 "java/jni/androidvideocapturer_jni.cc",
158 "java/jni/androidvideocapturer_jni.h",
159 "java/jni/classreferenceholder.cc",
160 "java/jni/classreferenceholder.h",
161 "java/jni/jni_helpers.cc",
162 "java/jni/jni_helpers.h",
163 "java/jni/native_handle_impl.cc",
164 "java/jni/native_handle_impl.h",
165 "java/jni/peerconnection_jni.cc",
166 "java/jni/surfacetexturehelper_jni.cc",
167 "java/jni/surfacetexturehelper_jni.h",
168 ]
169
170 configs += [
171 "..:common_config",
172 ":libjingle_peerconnection_jni_warnings_config",
173 ]
174 public_configs = [ "..:common_inherited_config" ]
175
176 if (is_clang) {
177 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
178 configs -= [
179 "//build/config/clang:extra_warnings",
180 "//build/config/clang:find_bad_constructs",
181 ]
182 }
183
184 # TODO(jschuh): Bug 1348: fix this warning.
185 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
186
187 if (is_win) {
188 cflags += [
189 "/wd4245", # conversion from "int" to "size_t", signed/unsigned mismatch.
190 "/wd4389", # signed/unsigned mismatch.
191 ]
192 }
193
194 deps = [
195 ":libjingle_peerconnection",
196 "../system_wrappers:field_trial_default",
197 "../system_wrappers:metrics_default",
198 ]
199
200 if (rtc_build_libyuv) {
201 deps += [ "$rtc_libyuv_dir" ]
202 public_deps = [
203 "$rtc_libyuv_dir",
204 ]
205 } else {
206 # Need to add a directory normally exported by libyuv.
207 include_dirs += [ "$rtc_libyuv_dir/include" ]
208 }
209 }
210}
211
212if (rtc_include_tests) {
213 config("peerconnection_unittests_config") {
214 # The warnings below are enabled by default. Since GN orders compiler flags
215 # for a target before flags from configs, the only way to disable such
216 # warnings is by having them in a separate config, loaded from the target.
217 # TODO(kjellander): Make the code compile without disabling these flags.
218 # See https://bugs.webrtc.org/3307.
219 if (is_clang && is_win) {
220 cflags = [ "-Wno-unused-function" ]
221 }
222
223 if (!is_win) {
224 cflags = [ "-Wno-sign-compare" ]
225 cflags_cc = [ "-Wno-overloaded-virtual" ]
226 }
227 }
228
229 test("peerconnection_unittests") {
230 testonly = true
231 sources = [
232 "datachannel_unittest.cc",
233 "dtmfsender_unittest.cc",
234 "fakemetricsobserver.cc",
235 "fakemetricsobserver.h",
236 "jsepsessiondescription_unittest.cc",
237 "localaudiosource_unittest.cc",
238 "mediaconstraintsinterface_unittest.cc",
239 "mediastream_unittest.cc",
240 "peerconnection_unittest.cc",
241 "peerconnectionendtoend_unittest.cc",
242 "peerconnectionfactory_unittest.cc",
243 "peerconnectioninterface_unittest.cc",
244 "proxy_unittest.cc",
245 "rtpsenderreceiver_unittest.cc",
246 "statscollector_unittest.cc",
247 "test/fakeaudiocapturemodule.cc",
248 "test/fakeaudiocapturemodule.h",
249 "test/fakeaudiocapturemodule_unittest.cc",
250 "test/fakeconstraints.h",
251 "test/fakedatachannelprovider.h",
252 "test/fakeperiodicvideocapturer.h",
253 "test/fakertccertificategenerator.h",
254 "test/fakevideotrackrenderer.h",
255 "test/mockpeerconnectionobservers.h",
256 "test/peerconnectiontestwrapper.cc",
257 "test/peerconnectiontestwrapper.h",
258 "test/testsdpstrings.h",
259 "videocapturertracksource_unittest.cc",
260 "videotrack_unittest.cc",
261 "webrtcsdp_unittest.cc",
262 "webrtcsession_unittest.cc",
263 ]
264
265 defines = [ "HAVE_SCTP" ]
266
267 configs += [
268 "..:common_config",
269 ":peerconnection_unittests_config",
270 ]
271 public_configs = [ "..:common_inherited_config" ]
272
273 if (is_clang) {
274 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
275 configs -= [ "//build/config/clang:find_bad_constructs" ]
276 }
277
278 # TODO(jschuh): Bug 1348: fix this warning.
279 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
280
281 if (is_win) {
282 cflags = [
283 "/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
284 "/wd4389", # signed/unsigned mismatch.
285 ]
286 }
287
288 if (rtc_use_quic) {
289 public_deps = [
290 "//third_party/libquic",
291 ]
292 sources += [
293 "quicdatachannel_unittest.cc",
294 "quicdatatransport_unittest.cc",
295 ]
296 }
297
298 deps = []
299 if (is_android) {
300 sources += [
301 "test/androidtestinitializer.cc",
302 "test/androidtestinitializer.h",
303 ]
304 deps += [
305 ":libjingle_peerconnection_jni",
306 "//testing/android/native_test:native_test_support",
307 ]
308 }
309
310 deps += [
311 ":libjingle_peerconnection",
312 "..:webrtc_common",
313 "../base:rtc_base_tests_utils",
314 "../media:rtc_unittest_main",
315 "../pc:rtc_pc",
316 "../system_wrappers:metrics_default",
317 "//testing/gmock",
318 ]
319
320 if (is_android) {
321 deps += [ "//testing/android/native_test:native_test_support" ]
322 }
323 }
324}