Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / libjingle / BUILD.gn
blobade2f66f00e07545346eb07285e04b7baa0eea4a
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
8 # From third_party/libjingle/libjingle.gyp's target_defaults.
9 config("jingle_unexported_configs") {
10   defines = [
11     "EXPAT_RELATIVE_PATH",
12     "FEATURE_ENABLE_SSL",
13     "GTEST_RELATIVE_PATH",
14     "HAVE_SRTP",
15     "HAVE_WEBRTC_VIDEO",
16     "HAVE_WEBRTC_VOICE",
17     "LOGGING_INSIDE_WEBRTC",
18     "NO_MAIN_THREAD_WRAPPING",
19     "NO_SOUND_SYSTEM",
20     "SRTP_RELATIVE_PATH",
21     "USE_WEBRTC_DEV_BRANCH",
22     "ENABLE_EXTERNAL_AUTH",
23     "WEBRTC_CHROMIUM_BUILD",
24   ]
26   include_dirs = [
27     "overrides",
28     "../../third_party/webrtc/overrides",
29     "source",
30     "../../testing/gtest/include",
31     "../../third_party",
32     "../../third_party/libyuv/include",
33     "../../third_party/usrsctp",
34   ]
36   # Assumes libpeer is linked statically.
37   defines += [ "LIBPEERCONNECTION_LIB=1" ]
39   if (is_win && current_cpu == "x86") {
40     defines += [ "_USE_32BIT_TIME_T" ]
41   }
43   if (use_openssl) {
44     defines += [
45       "SSL_USE_OPENSSL",
46       "HAVE_OPENSSL_SSL_H",
47     ]
48   } else {
49     defines += [
50       "SSL_USE_NSS",
51       "HAVE_NSS_SSL_H",
52       "SSL_USE_NSS_RNG",
53     ]
54   }
57 # From third_party/libjingle/libjingle.gyp's target_defaults.
58 config("jingle_public_configs") {
59   include_dirs = [
60     "../../third_party/webrtc/overrides",
61     "overrides",
62     "source",
63     "../../testing/gtest/include",
64     "../../third_party",
65   ]
66   defines = [
67     "FEATURE_ENABLE_SSL",
68     "FEATURE_ENABLE_VOICEMAIL",
69     "EXPAT_RELATIVE_PATH",
70     "GTEST_RELATIVE_PATH",
71     "NO_MAIN_THREAD_WRAPPING",
72     "NO_SOUND_SYSTEM",
73   ]
75   # TODO(GYP): Port is_win blocks.
76   if (is_linux) {
77     defines += [
78       "LINUX",
79       "WEBRTC_LINUX",
80     ]
81   }
82   if (is_mac) {
83     defines += [
84       "OSX",
85       "WEBRTC_MAC",
86     ]
87   }
88   if (is_ios) {
89     defines += [
90       "IOS",
91       "WEBRTC_MAC",
92       "WEBRTC_IOS",
93     ]
94   }
95   if (is_win) {
96     defines += [ "WEBRTC_WIN" ]
97   }
98   if (is_android) {
99     defines += [ "ANDROID" ]
100   }
101   if (is_posix) {
102     defines += [ "WEBRTC_POSIX" ]
103   }
105   # TODO(GYP): Support these in GN.
106   # if (is_bsd) {
107   #   defines += [ "BSD" ]
108   # }
109   # if (is_openbsd) {
110   #   defines += [ "OPENBSD" ]
111   # }
112   # if (is_freebsd) {
113   #   defines += [ "FREEBSD" ]
114   # }
115   if (is_chromeos) {
116     defines += [ "CHROMEOS" ]
117   }
120 # From third_party/libjingle/libjingle.gyp's target_defaults.
121 config("jingle_all_dependent_configs") {
122   if (is_debug) {
123     # TODO(sergeyu): Fix libjingle to use NDEBUG instead of
124     # _DEBUG and remove this define. See GYP file as well.
125     defines = [ "_DEBUG" ]
126   }
129 # From third_party/libjingle/libjingle.gyp's target_defaults.
130 group("jingle_deps") {
131   public_deps = [
132     "//third_party/expat",
133   ]
134   deps = [
135     "//base",
136     "//net",
137     "//crypto:platform",
138   ]
141 # GYP version: third_party/libjingle.gyp:libjingle
142 static_library("libjingle") {
143   p2p_dir = "../webrtc/p2p"
144   xmllite_dir = "../webrtc/libjingle/xmllite"
145   xmpp_dir = "../webrtc/libjingle/xmpp"
146   sources = [
147     # List from third_party/libjingle/libjingle_common.gypi
148     "$p2p_dir/base/asyncstuntcpsocket.cc",
149     "$p2p_dir/base/asyncstuntcpsocket.h",
150     "$p2p_dir/base/basicpacketsocketfactory.cc",
151     "$p2p_dir/base/basicpacketsocketfactory.h",
152     "$p2p_dir/base/candidate.h",
153     "$p2p_dir/base/common.h",
154     "$p2p_dir/base/constants.cc",
155     "$p2p_dir/base/constants.h",
156     "$p2p_dir/base/dtlstransport.h",
157     "$p2p_dir/base/dtlstransportchannel.cc",
158     "$p2p_dir/base/dtlstransportchannel.h",
159     "$p2p_dir/base/p2ptransport.cc",
160     "$p2p_dir/base/p2ptransport.h",
161     "$p2p_dir/base/p2ptransportchannel.cc",
162     "$p2p_dir/base/p2ptransportchannel.h",
163     "$p2p_dir/base/port.cc",
164     "$p2p_dir/base/port.h",
165     "$p2p_dir/base/portallocator.cc",
166     "$p2p_dir/base/portallocator.h",
167     "$p2p_dir/base/pseudotcp.cc",
168     "$p2p_dir/base/pseudotcp.h",
169     "$p2p_dir/base/rawtransport.cc",
170     "$p2p_dir/base/rawtransport.h",
171     "$p2p_dir/base/rawtransportchannel.cc",
172     "$p2p_dir/base/rawtransportchannel.h",
173     "$p2p_dir/base/relayport.cc",
174     "$p2p_dir/base/relayport.h",
175     "$p2p_dir/base/session.cc",
176     "$p2p_dir/base/session.h",
177     "$p2p_dir/base/sessiondescription.cc",
178     "$p2p_dir/base/sessiondescription.h",
179     "$p2p_dir/base/sessionid.h",
180     "$p2p_dir/base/stun.cc",
181     "$p2p_dir/base/stun.h",
182     "$p2p_dir/base/stunport.cc",
183     "$p2p_dir/base/stunport.h",
184     "$p2p_dir/base/stunrequest.cc",
185     "$p2p_dir/base/stunrequest.h",
186     "$p2p_dir/base/tcpport.cc",
187     "$p2p_dir/base/tcpport.h",
188     "$p2p_dir/base/transport.cc",
189     "$p2p_dir/base/transport.h",
190     "$p2p_dir/base/transportchannel.cc",
191     "$p2p_dir/base/transportchannel.h",
192     "$p2p_dir/base/transportchannelimpl.h",
193     "$p2p_dir/base/transportchannelproxy.cc",
194     "$p2p_dir/base/transportchannelproxy.h",
195     "$p2p_dir/base/transportdescription.cc",
196     "$p2p_dir/base/transportdescription.h",
197     "$p2p_dir/base/transportdescriptionfactory.cc",
198     "$p2p_dir/base/transportdescriptionfactory.h",
199     "$p2p_dir/base/turnport.cc",
200     "$p2p_dir/base/turnport.h",
201     "$p2p_dir/client/basicportallocator.cc",
202     "$p2p_dir/client/basicportallocator.h",
203     "$p2p_dir/client/httpportallocator.cc",
204     "$p2p_dir/client/httpportallocator.h",
205     "$p2p_dir/client/socketmonitor.cc",
206     "$p2p_dir/client/socketmonitor.h",
207     "$xmllite_dir/qname.cc",
208     "$xmllite_dir/qname.h",
209     "$xmllite_dir/xmlbuilder.cc",
210     "$xmllite_dir/xmlbuilder.h",
211     "$xmllite_dir/xmlconstants.cc",
212     "$xmllite_dir/xmlconstants.h",
213     "$xmllite_dir/xmlelement.cc",
214     "$xmllite_dir/xmlelement.h",
215     "$xmllite_dir/xmlnsstack.cc",
216     "$xmllite_dir/xmlnsstack.h",
217     "$xmllite_dir/xmlparser.cc",
218     "$xmllite_dir/xmlparser.h",
219     "$xmllite_dir/xmlprinter.cc",
220     "$xmllite_dir/xmlprinter.h",
221     "$xmpp_dir/asyncsocket.h",
222     "$xmpp_dir/constants.cc",
223     "$xmpp_dir/constants.h",
224     "$xmpp_dir/jid.cc",
225     "$xmpp_dir/jid.h",
226     "$xmpp_dir/plainsaslhandler.h",
227     "$xmpp_dir/prexmppauth.h",
228     "$xmpp_dir/saslcookiemechanism.h",
229     "$xmpp_dir/saslhandler.h",
230     "$xmpp_dir/saslmechanism.cc",
231     "$xmpp_dir/saslmechanism.h",
232     "$xmpp_dir/saslplainmechanism.h",
233     "$xmpp_dir/xmppclient.cc",
234     "$xmpp_dir/xmppclient.h",
235     "$xmpp_dir/xmppclientsettings.h",
236     "$xmpp_dir/xmppengine.h",
237     "$xmpp_dir/xmppengineimpl.cc",
238     "$xmpp_dir/xmppengineimpl.h",
239     "$xmpp_dir/xmppengineimpl_iq.cc",
240     "$xmpp_dir/xmpplogintask.cc",
241     "$xmpp_dir/xmpplogintask.h",
242     "$xmpp_dir/xmppstanzaparser.cc",
243     "$xmpp_dir/xmppstanzaparser.h",
244     "$xmpp_dir/xmpptask.cc",
245     "$xmpp_dir/xmpptask.h",
246   ]
247   sources -= [
248     # Compiled as part of libjingle_p2p_constants.
249     "$p2p_dir/base/constants.cc",
250     "$p2p_dir/base/constants.h",
251   ]
253   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
254   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
256   public_deps = [
257     ":jingle_deps",
258   ]
259   deps = [
260     "//third_party/webrtc/base:rtc_base",
261     ":libjingle_p2p_constants",
262   ]
264   # From libjingle_common.gypi's conditions list.
265   if (is_win) {
266     cflags = [ "/wd4005" ]
267   }
269   configs += [ ":jingle_unexported_configs" ]
270   public_configs = [ ":jingle_public_configs" ]
271   all_dependent_configs = [ ":jingle_all_dependent_configs" ]
274 # This has to be is a separate project due to a bug in MSVS 2008 and the
275 # current toolset on android.  The problem is that we have two files named
276 # "constants.cc" and MSVS/android doesn't handle this properly.
277 # GYP currently has guards to catch this, so if you want to remove it,
278 # run GYP and if GYP has removed the validation check, then we can assume
279 # that the toolchains have been fixed (we currently use VS2010 and later,
280 # so VS2008 isn't a concern anymore).
282 # GYP version: third_party/libjingle.gyp:libjingle_p2p_constants
283 static_library("libjingle_p2p_constants") {
284   p2p_dir = "../webrtc/p2p"
285   sources = [
286     "$p2p_dir/base/constants.cc",
287     "$p2p_dir/base/constants.h",
288   ]
289   public_deps = [
290     ":jingle_deps",
291   ]
292   configs += [ ":jingle_unexported_configs" ]
293   public_configs = [ ":jingle_public_configs" ]
294   all_dependent_configs = [ ":jingle_all_dependent_configs" ]
297 # GYP version: third_party/libjingle.gyp:peerconnnection_server
298 #TODO(GYP): Switch to executable when WebRTC dependency is resolved.
299 source_set("peerconnnection_server") {
300   sources = [
301     "source/talk/examples/peerconnection/server/data_socket.cc",
302     "source/talk/examples/peerconnection/server/data_socket.h",
303     "source/talk/examples/peerconnection/server/main.cc",
304     "source/talk/examples/peerconnection/server/peer_channel.cc",
305     "source/talk/examples/peerconnection/server/peer_channel.h",
306     "source/talk/examples/peerconnection/server/utils.cc",
307     "source/talk/examples/peerconnection/server/utils.h",
308   ]
309   include_dirs = [ "source" ]
310   public_deps = [
311     ":jingle_deps",
312   ]
313   deps = [
314     ":libjingle",
315     ":jingle_deps",
316   ]
317   configs += [ ":jingle_unexported_configs" ]
318   public_configs = [ ":jingle_public_configs" ]
319   all_dependent_configs = [ ":jingle_all_dependent_configs" ]
320   if (is_win) {
321     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
322     cflags = [ "/wd4309" ]
323   }
326 if (enable_webrtc) {
327   source_set("libjingle_webrtc") {
328     sources = [
329       "overrides/init_webrtc.cc",
330       "overrides/init_webrtc.h",
331     ]
332     configs += [ ":jingle_unexported_configs" ]
333     public_configs = [ ":jingle_public_configs" ]
334     deps = [
335       ":libjingle_webrtc_common",
336     ]
337   }
339   # Note: this does not support the shared library build of libpeerconnection
340   # as is supported in the GYP build. It's not clear what this is used for.
341   source_set("libjingle_webrtc_common") {
342     sources = [
343       "overrides/talk/media/webrtc/webrtcexport.h",
344       "source/talk/app/webrtc/audiotrack.cc",
345       "source/talk/app/webrtc/audiotrack.h",
346       "source/talk/app/webrtc/audiotrackrenderer.cc",
347       "source/talk/app/webrtc/audiotrackrenderer.h",
348       "source/talk/app/webrtc/datachannel.cc",
349       "source/talk/app/webrtc/datachannel.h",
350       "source/talk/app/webrtc/dtlsidentityservice.cc",
351       "source/talk/app/webrtc/dtlsidentityservice.h",
352       "source/talk/app/webrtc/dtlsidentitystore.cc",
353       "source/talk/app/webrtc/dtlsidentitystore.h",
354       "source/talk/app/webrtc/dtmfsender.cc",
355       "source/talk/app/webrtc/dtmfsender.h",
356       "source/talk/app/webrtc/jsep.h",
357       "source/talk/app/webrtc/jsepicecandidate.cc",
358       "source/talk/app/webrtc/jsepicecandidate.h",
359       "source/talk/app/webrtc/jsepsessiondescription.cc",
360       "source/talk/app/webrtc/jsepsessiondescription.h",
361       "source/talk/app/webrtc/localaudiosource.cc",
362       "source/talk/app/webrtc/localaudiosource.h",
363       "source/talk/app/webrtc/mediaconstraintsinterface.cc",
364       "source/talk/app/webrtc/mediaconstraintsinterface.h",
365       "source/talk/app/webrtc/mediastream.cc",
366       "source/talk/app/webrtc/mediastream.h",
367       "source/talk/app/webrtc/mediastreamhandler.cc",
368       "source/talk/app/webrtc/mediastreamhandler.h",
369       "source/talk/app/webrtc/mediastreaminterface.h",
370       "source/talk/app/webrtc/mediastreamprovider.h",
371       "source/talk/app/webrtc/mediastreamproxy.h",
372       "source/talk/app/webrtc/mediastreamsignaling.cc",
373       "source/talk/app/webrtc/mediastreamsignaling.h",
374       "source/talk/app/webrtc/mediastreamtrack.h",
375       "source/talk/app/webrtc/mediastreamtrackproxy.h",
376       "source/talk/app/webrtc/notifier.h",
377       "source/talk/app/webrtc/peerconnection.cc",
378       "source/talk/app/webrtc/peerconnection.h",
379       "source/talk/app/webrtc/peerconnectionfactory.cc",
380       "source/talk/app/webrtc/peerconnectionfactory.h",
381       "source/talk/app/webrtc/peerconnectioninterface.h",
382       "source/talk/app/webrtc/portallocatorfactory.cc",
383       "source/talk/app/webrtc/portallocatorfactory.h",
384       "source/talk/app/webrtc/remoteaudiosource.cc",
385       "source/talk/app/webrtc/remoteaudiosource.h",
386       "source/talk/app/webrtc/remotevideocapturer.cc",
387       "source/talk/app/webrtc/remotevideocapturer.h",
388       "source/talk/app/webrtc/sctputils.cc",
389       "source/talk/app/webrtc/sctputils.h",
390       "source/talk/app/webrtc/statscollector.cc",
391       "source/talk/app/webrtc/statscollector.h",
392       "source/talk/app/webrtc/statstypes.cc",
393       "source/talk/app/webrtc/statstypes.h",
394       "source/talk/app/webrtc/streamcollection.h",
395       "source/talk/app/webrtc/umametrics.h",
396       "source/talk/app/webrtc/videosource.cc",
397       "source/talk/app/webrtc/videosource.h",
398       "source/talk/app/webrtc/videosourceinterface.h",
399       "source/talk/app/webrtc/videosourceproxy.h",
400       "source/talk/app/webrtc/videotrack.cc",
401       "source/talk/app/webrtc/videotrack.h",
402       "source/talk/app/webrtc/videotrackrenderers.cc",
403       "source/talk/app/webrtc/videotrackrenderers.h",
404       "source/talk/app/webrtc/webrtcsdp.cc",
405       "source/talk/app/webrtc/webrtcsdp.h",
406       "source/talk/app/webrtc/webrtcsession.cc",
407       "source/talk/app/webrtc/webrtcsession.h",
408       "source/talk/app/webrtc/webrtcsessiondescriptionfactory.cc",
409       "source/talk/app/webrtc/webrtcsessiondescriptionfactory.h",
410       "source/talk/media/base/audiorenderer.h",
411       "source/talk/media/base/capturemanager.cc",
412       "source/talk/media/base/capturemanager.h",
413       "source/talk/media/base/capturerenderadapter.cc",
414       "source/talk/media/base/capturerenderadapter.h",
415       "source/talk/media/base/codec.cc",
416       "source/talk/media/base/codec.h",
417       "source/talk/media/base/constants.cc",
418       "source/talk/media/base/constants.h",
419       "source/talk/media/base/cryptoparams.h",
420       "source/talk/media/base/filemediaengine.cc",
421       "source/talk/media/base/filemediaengine.h",
422       "source/talk/media/base/hybriddataengine.h",
423       "source/talk/media/base/mediachannel.h",
424       "source/talk/media/base/mediaengine.cc",
425       "source/talk/media/base/mediaengine.h",
426       "source/talk/media/base/rtpdataengine.cc",
427       "source/talk/media/base/rtpdataengine.h",
428       "source/talk/media/base/rtpdump.cc",
429       "source/talk/media/base/rtpdump.h",
430       "source/talk/media/base/rtputils.cc",
431       "source/talk/media/base/rtputils.h",
432       "source/talk/media/base/streamparams.cc",
433       "source/talk/media/base/streamparams.h",
434       "source/talk/media/base/videoadapter.cc",
435       "source/talk/media/base/videoadapter.h",
436       "source/talk/media/base/videocapturer.cc",
437       "source/talk/media/base/videocapturer.h",
438       "source/talk/media/base/videocommon.cc",
439       "source/talk/media/base/videocommon.h",
440       "source/talk/media/base/videoframe.cc",
441       "source/talk/media/base/videoframe.h",
442       "source/talk/media/base/videoframefactory.cc",
443       "source/talk/media/base/videoframefactory.h",
444       "source/talk/media/devices/dummydevicemanager.cc",
445       "source/talk/media/devices/dummydevicemanager.h",
446       "source/talk/media/devices/filevideocapturer.cc",
447       "source/talk/media/devices/filevideocapturer.h",
448       "source/talk/media/webrtc/webrtccommon.h",
449       "source/talk/media/webrtc/webrtcpassthroughrender.cc",
450       "source/talk/media/webrtc/webrtcpassthroughrender.h",
451       "source/talk/media/webrtc/webrtcvideocapturer.cc",
452       "source/talk/media/webrtc/webrtcvideocapturer.h",
453       "source/talk/media/webrtc/webrtcvideoframe.cc",
454       "source/talk/media/webrtc/webrtcvideoframe.h",
455       "source/talk/media/webrtc/webrtcvideoframefactory.cc",
456       "source/talk/media/webrtc/webrtcvideoframefactory.h",
457       "source/talk/media/webrtc/webrtcvie.h",
458       "source/talk/media/webrtc/webrtcvoe.h",
459       "source/talk/session/media/audiomonitor.cc",
460       "source/talk/session/media/audiomonitor.h",
461       "source/talk/session/media/bundlefilter.cc",
462       "source/talk/session/media/bundlefilter.h",
463       "source/talk/session/media/channel.cc",
464       "source/talk/session/media/channel.h",
465       "source/talk/session/media/channelmanager.cc",
466       "source/talk/session/media/channelmanager.h",
467       "source/talk/session/media/currentspeakermonitor.cc",
468       "source/talk/session/media/currentspeakermonitor.h",
469       "source/talk/session/media/externalhmac.cc",
470       "source/talk/session/media/externalhmac.h",
471       "source/talk/session/media/mediamonitor.cc",
472       "source/talk/session/media/mediamonitor.h",
473       "source/talk/session/media/mediasession.cc",
474       "source/talk/session/media/mediasession.h",
475       "source/talk/session/media/mediasink.h",
476       "source/talk/session/media/rtcpmuxfilter.cc",
477       "source/talk/session/media/rtcpmuxfilter.h",
478       "source/talk/session/media/soundclip.cc",
479       "source/talk/session/media/soundclip.h",
480       "source/talk/session/media/srtpfilter.cc",
481       "source/talk/session/media/srtpfilter.h",
482       "source/talk/session/media/typingmonitor.cc",
483       "source/talk/session/media/typingmonitor.h",
484       "source/talk/session/media/voicechannel.h",
485     ]
487     configs -= [ "//build/config/compiler:chromium_code" ]
488     configs += [ "//build/config/compiler:no_chromium_code" ]
490     configs += [ ":jingle_unexported_configs" ]
491     public_configs = [ ":jingle_public_configs" ]
493     deps = [
494       ":libjingle",
495       "//third_party/libsrtp",
496       "//third_party/webrtc/modules/media_file",
497       "//third_party/webrtc/modules/video_capture",
498       "//third_party/webrtc/modules/video_render",
499     ]
501     if (!is_ios) {
502       # TODO(mallinath) - Enable SCTP for iOS.
503       sources += [
504         "source/talk/media/sctp/sctpdataengine.cc",
505         "source/talk/media/sctp/sctpdataengine.h",
506       ]
507       defines = [ "HAVE_SCTP" ]
508       deps += [ "//third_party/usrsctp" ]
509     }
510   }
512   # Note: this does not support the shared library build of libpeerconnection
513   # as is supported in the GYP build. It's not clear what this is used for.
514   source_set("libpeerconnection") {
515     sources = [
516       "source/talk/media/webrtc/simulcast.cc",
517       "source/talk/media/webrtc/simulcast.h",
518       "source/talk/media/webrtc/webrtcmediaengine.cc",
519       "source/talk/media/webrtc/webrtcmediaengine.h",
520       "source/talk/media/webrtc/webrtcvideoengine.cc",
521       "source/talk/media/webrtc/webrtcvideoengine.h",
522       "source/talk/media/webrtc/webrtcvideoengine2.cc",
523       "source/talk/media/webrtc/webrtcvideoengine2.h",
524       "source/talk/media/webrtc/webrtcvoiceengine.cc",
525       "source/talk/media/webrtc/webrtcvoiceengine.h",
526     ]
528     configs += [ ":jingle_unexported_configs" ]
529     public_configs = [ ":jingle_public_configs" ]
530     configs -= [ "//build/config/compiler:chromium_code" ]
531     configs += [ "//build/config/compiler:no_chromium_code" ]
533     deps = [
534       # TODO(GYP): crbug.com/481633. Consider depending on :libjingle_webrtc
535       # instead.
536       ":libjingle_webrtc_common",
537       "//third_party/webrtc",
538       "//third_party/webrtc/system_wrappers",
539       "//third_party/webrtc/voice_engine",
540     ]
541   }
542 }  # enable_webrtc
543 # TODO(GYP): Port libjingle.gyp's enable_webrtc condition block.