clang: Compiler tweaks to make android build for x64
[chromium-blink-merge.git] / third_party / libjingle / BUILD.gn
blob51b790bc6ca57ac3df8506d6d44d91b02983aed5
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 if (enable_webrtc) {
298   source_set("libjingle_webrtc") {
299     sources = [
300       "overrides/init_webrtc.cc",
301       "overrides/init_webrtc.h",
302     ]
303     configs += [ ":jingle_unexported_configs" ]
304     public_configs = [ ":jingle_public_configs" ]
305     deps = [
306       ":libjingle_webrtc_common",
307     ]
308   }
310   # Note: this does not support the shared library build of libpeerconnection
311   # as is supported in the GYP build. It's not clear what this is used for.
312   source_set("libjingle_webrtc_common") {
313     sources = [
314       "overrides/talk/media/webrtc/webrtcexport.h",
315       "source/talk/app/webrtc/audiotrack.cc",
316       "source/talk/app/webrtc/audiotrack.h",
317       "source/talk/app/webrtc/audiotrackrenderer.cc",
318       "source/talk/app/webrtc/audiotrackrenderer.h",
319       "source/talk/app/webrtc/datachannel.cc",
320       "source/talk/app/webrtc/datachannel.h",
321       "source/talk/app/webrtc/dtlsidentityservice.cc",
322       "source/talk/app/webrtc/dtlsidentityservice.h",
323       "source/talk/app/webrtc/dtlsidentitystore.cc",
324       "source/talk/app/webrtc/dtlsidentitystore.h",
325       "source/talk/app/webrtc/dtmfsender.cc",
326       "source/talk/app/webrtc/dtmfsender.h",
327       "source/talk/app/webrtc/jsep.h",
328       "source/talk/app/webrtc/jsepicecandidate.cc",
329       "source/talk/app/webrtc/jsepicecandidate.h",
330       "source/talk/app/webrtc/jsepsessiondescription.cc",
331       "source/talk/app/webrtc/jsepsessiondescription.h",
332       "source/talk/app/webrtc/localaudiosource.cc",
333       "source/talk/app/webrtc/localaudiosource.h",
334       "source/talk/app/webrtc/mediaconstraintsinterface.cc",
335       "source/talk/app/webrtc/mediaconstraintsinterface.h",
336       "source/talk/app/webrtc/mediastream.cc",
337       "source/talk/app/webrtc/mediastream.h",
338       "source/talk/app/webrtc/mediastreamhandler.cc",
339       "source/talk/app/webrtc/mediastreamhandler.h",
340       "source/talk/app/webrtc/mediastreaminterface.h",
341       "source/talk/app/webrtc/mediastreamprovider.h",
342       "source/talk/app/webrtc/mediastreamproxy.h",
343       "source/talk/app/webrtc/mediastreamsignaling.cc",
344       "source/talk/app/webrtc/mediastreamsignaling.h",
345       "source/talk/app/webrtc/mediastreamtrack.h",
346       "source/talk/app/webrtc/mediastreamtrackproxy.h",
347       "source/talk/app/webrtc/notifier.h",
348       "source/talk/app/webrtc/peerconnection.cc",
349       "source/talk/app/webrtc/peerconnection.h",
350       "source/talk/app/webrtc/peerconnectionfactory.cc",
351       "source/talk/app/webrtc/peerconnectionfactory.h",
352       "source/talk/app/webrtc/peerconnectioninterface.h",
353       "source/talk/app/webrtc/portallocatorfactory.cc",
354       "source/talk/app/webrtc/portallocatorfactory.h",
355       "source/talk/app/webrtc/remoteaudiosource.cc",
356       "source/talk/app/webrtc/remoteaudiosource.h",
357       "source/talk/app/webrtc/remotevideocapturer.cc",
358       "source/talk/app/webrtc/remotevideocapturer.h",
359       "source/talk/app/webrtc/sctputils.cc",
360       "source/talk/app/webrtc/sctputils.h",
361       "source/talk/app/webrtc/statscollector.cc",
362       "source/talk/app/webrtc/statscollector.h",
363       "source/talk/app/webrtc/statstypes.cc",
364       "source/talk/app/webrtc/statstypes.h",
365       "source/talk/app/webrtc/streamcollection.h",
366       "source/talk/app/webrtc/umametrics.h",
367       "source/talk/app/webrtc/videosource.cc",
368       "source/talk/app/webrtc/videosource.h",
369       "source/talk/app/webrtc/videosourceinterface.h",
370       "source/talk/app/webrtc/videosourceproxy.h",
371       "source/talk/app/webrtc/videotrack.cc",
372       "source/talk/app/webrtc/videotrack.h",
373       "source/talk/app/webrtc/videotrackrenderers.cc",
374       "source/talk/app/webrtc/videotrackrenderers.h",
375       "source/talk/app/webrtc/webrtcsdp.cc",
376       "source/talk/app/webrtc/webrtcsdp.h",
377       "source/talk/app/webrtc/webrtcsession.cc",
378       "source/talk/app/webrtc/webrtcsession.h",
379       "source/talk/app/webrtc/webrtcsessiondescriptionfactory.cc",
380       "source/talk/app/webrtc/webrtcsessiondescriptionfactory.h",
381       "source/talk/media/base/audiorenderer.h",
382       "source/talk/media/base/capturemanager.cc",
383       "source/talk/media/base/capturemanager.h",
384       "source/talk/media/base/capturerenderadapter.cc",
385       "source/talk/media/base/capturerenderadapter.h",
386       "source/talk/media/base/codec.cc",
387       "source/talk/media/base/codec.h",
388       "source/talk/media/base/constants.cc",
389       "source/talk/media/base/constants.h",
390       "source/talk/media/base/cryptoparams.h",
391       "source/talk/media/base/hybriddataengine.h",
392       "source/talk/media/base/mediachannel.h",
393       "source/talk/media/base/mediaengine.cc",
394       "source/talk/media/base/mediaengine.h",
395       "source/talk/media/base/rtpdataengine.cc",
396       "source/talk/media/base/rtpdataengine.h",
397       "source/talk/media/base/rtpdump.cc",
398       "source/talk/media/base/rtpdump.h",
399       "source/talk/media/base/rtputils.cc",
400       "source/talk/media/base/rtputils.h",
401       "source/talk/media/base/streamparams.cc",
402       "source/talk/media/base/streamparams.h",
403       "source/talk/media/base/videoadapter.cc",
404       "source/talk/media/base/videoadapter.h",
405       "source/talk/media/base/videocapturer.cc",
406       "source/talk/media/base/videocapturer.h",
407       "source/talk/media/base/videocommon.cc",
408       "source/talk/media/base/videocommon.h",
409       "source/talk/media/base/videoframe.cc",
410       "source/talk/media/base/videoframe.h",
411       "source/talk/media/base/videoframefactory.cc",
412       "source/talk/media/base/videoframefactory.h",
413       "source/talk/media/devices/dummydevicemanager.cc",
414       "source/talk/media/devices/dummydevicemanager.h",
415       "source/talk/media/devices/filevideocapturer.cc",
416       "source/talk/media/devices/filevideocapturer.h",
417       "source/talk/media/webrtc/webrtccommon.h",
418       "source/talk/media/webrtc/webrtcpassthroughrender.cc",
419       "source/talk/media/webrtc/webrtcpassthroughrender.h",
420       "source/talk/media/webrtc/webrtcvideoframe.cc",
421       "source/talk/media/webrtc/webrtcvideoframe.h",
422       "source/talk/media/webrtc/webrtcvideoframefactory.cc",
423       "source/talk/media/webrtc/webrtcvideoframefactory.h",
424       "source/talk/media/webrtc/webrtcvoe.h",
425       "source/talk/session/media/audiomonitor.cc",
426       "source/talk/session/media/audiomonitor.h",
427       "source/talk/session/media/bundlefilter.cc",
428       "source/talk/session/media/bundlefilter.h",
429       "source/talk/session/media/channel.cc",
430       "source/talk/session/media/channel.h",
431       "source/talk/session/media/channelmanager.cc",
432       "source/talk/session/media/channelmanager.h",
433       "source/talk/session/media/currentspeakermonitor.cc",
434       "source/talk/session/media/currentspeakermonitor.h",
435       "source/talk/session/media/externalhmac.cc",
436       "source/talk/session/media/externalhmac.h",
437       "source/talk/session/media/mediamonitor.cc",
438       "source/talk/session/media/mediamonitor.h",
439       "source/talk/session/media/mediasession.cc",
440       "source/talk/session/media/mediasession.h",
441       "source/talk/session/media/mediasink.h",
442       "source/talk/session/media/rtcpmuxfilter.cc",
443       "source/talk/session/media/rtcpmuxfilter.h",
444       "source/talk/session/media/soundclip.cc",
445       "source/talk/session/media/soundclip.h",
446       "source/talk/session/media/srtpfilter.cc",
447       "source/talk/session/media/srtpfilter.h",
448       "source/talk/session/media/typingmonitor.cc",
449       "source/talk/session/media/typingmonitor.h",
450       "source/talk/session/media/voicechannel.h",
451     ]
453     configs -= [ "//build/config/compiler:chromium_code" ]
454     configs += [ "//build/config/compiler:no_chromium_code" ]
456     configs += [ ":jingle_unexported_configs" ]
457     public_configs = [ ":jingle_public_configs" ]
459     deps = [
460       ":libjingle",
461       "//third_party/libsrtp",
462       "//third_party/webrtc/modules/media_file",
463       "//third_party/webrtc/modules/video_capture",
464       "//third_party/webrtc/modules/video_render",
465     ]
467     if (!is_ios) {
468       # TODO(mallinath) - Enable SCTP for iOS.
469       sources += [
470         "source/talk/media/sctp/sctpdataengine.cc",
471         "source/talk/media/sctp/sctpdataengine.h",
472       ]
473       defines = [ "HAVE_SCTP" ]
474       deps += [ "//third_party/usrsctp" ]
475     }
476   }
478   # Note: this does not support the shared library build of libpeerconnection
479   # as is supported in the GYP build. It's not clear what this is used for.
480   source_set("libpeerconnection") {
481     sources = [
482       "source/talk/media/webrtc/simulcast.cc",
483       "source/talk/media/webrtc/simulcast.h",
484       "source/talk/media/webrtc/webrtcmediaengine.cc",
485       "source/talk/media/webrtc/webrtcmediaengine.h",
486       "source/talk/media/webrtc/webrtcvideoengine2.cc",
487       "source/talk/media/webrtc/webrtcvideoengine2.h",
488       "source/talk/media/webrtc/webrtcvoiceengine.cc",
489       "source/talk/media/webrtc/webrtcvoiceengine.h",
490     ]
492     configs += [ ":jingle_unexported_configs" ]
493     public_configs = [ ":jingle_public_configs" ]
494     configs -= [ "//build/config/compiler:chromium_code" ]
495     configs += [ "//build/config/compiler:no_chromium_code" ]
497     deps = [
498       # TODO(GYP): crbug.com/481633. Consider depending on :libjingle_webrtc
499       # instead.
500       ":libjingle_webrtc_common",
501       "//third_party/webrtc",
502       "//third_party/webrtc/system_wrappers",
503       "//third_party/webrtc/voice_engine",
504     ]
505   }
507   source_set("libstunprober") {
508     p2p_dir = "../webrtc/p2p"
509     sources = [
510       "$p2p_dir/stunprober/stunprober.cc",
511     ]
513     deps = [
514       "//third_party/webrtc/base:rtc_base",
515       ":libjingle_webrtc_common",
516     ]
517   }
518 }  # enable_webrtc
519 # TODO(GYP): Port libjingle.gyp's enable_webrtc condition block.