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