meson: Pass -DGST_STATIC_COMPILATION for static builds
[platform/upstream/gstreamer.git] / gst / meson.build
1 gst_sources = [
2   'gst.c',
3   'gstobject.c',
4   'gstallocator.c',
5   'gstbin.c',
6   'gstbuffer.c',
7   'gstbufferlist.c',
8   'gstbufferpool.c',
9   'gstbus.c',
10   'gstcaps.c',
11   'gstcapsfeatures.c',
12   'gstchildproxy.c',
13   'gstclock.c',
14   'gstcontext.c',
15   'gstcontrolbinding.c',
16   'gstcontrolsource.c',
17   'gstdatetime.c',
18   'gstdebugutils.c',
19   'gstdevice.c',
20   'gstdeviceprovider.c',
21   'gstdeviceproviderfactory.c',
22   'gstdynamictypefactory.c',
23   'gstelement.c',
24   'gstelementfactory.c',
25   'gsterror.c',
26   'gstevent.c',
27   'gstformat.c',
28   'gstghostpad.c',
29   'gstdevicemonitor.c',
30   'gstinfo.c',
31   'gstiterator.c',
32   'gstatomicqueue.c',
33   'gstmessage.c',
34   'gstmeta.c',
35   'gstmemory.c',
36   'gstminiobject.c',
37   'gstpad.c',
38   'gstpadtemplate.c',
39   'gstparamspecs.c',
40   'gstpipeline.c',
41   'gstplugin.c',
42   'gstpluginfeature.c',
43   'gstpluginloader.c',
44   'gstpoll.c',
45   'gstpreset.c',
46   'gstprotection.c',
47   'gstquark.c',
48   'gstquery.c',
49   'gstregistry.c',
50   'gstregistrychunks.c',
51   'gstpromise.c',
52   'gstsample.c',
53   'gstsegment.c',
54   'gststreamcollection.c',
55   'gststreams.c',
56   'gststructure.c',
57   'gstsystemclock.c',
58   'gsttaglist.c',
59   'gsttagsetter.c',
60   'gsttask.c',
61   'gsttaskpool.c',
62   'gsttoc.c',
63   'gsttocsetter.c',
64   'gsttracer.c',
65   'gsttracerfactory.c',
66   'gsttracerrecord.c',
67   'gsttracerutils.c',
68   'gsttypefind.c',
69   'gsttypefindfactory.c',
70   'gsturi.c',
71   'gstutils.c',
72   'gstvalue.c',
73   'gstparse.c',
74 ]
75
76 gst_headers = [
77   'gst.h',
78   'glib-compat.h',
79   'gstobject.h',
80   'gstallocator.h',
81   'gstbin.h',
82   'gstbuffer.h',
83   'gstbufferlist.h',
84   'gstbufferpool.h',
85   'gstbus.h',
86   'gstcaps.h',
87   'gstcapsfeatures.h',
88   'gstchildproxy.h',
89   'gstclock.h',
90   'gstcompat.h',
91   'gstcontext.h',
92   'gstcontrolbinding.h',
93   'gstcontrolsource.h',
94   'gstdatetime.h',
95   'gstdebugutils.h',
96   'gstelement.h',
97   'gstelementmetadata.h',
98   'gstdevice.h',
99   'gstdeviceprovider.h',
100   'gstdeviceproviderfactory.h',
101   'gstdynamictypefactory.h',
102   'gstelementfactory.h',
103   'gsterror.h',
104   'gstevent.h',
105   'gstformat.h',
106   'gstghostpad.h',
107   'gstdevicemonitor.h',
108   'gstinfo.h',
109   'gstiterator.h',
110   'gstatomicqueue.h',
111   'gstmacros.h',
112   'gstmessage.h',
113   'gstmeta.h',
114   'gstmemory.h',
115   'gstminiobject.h',
116   'gstpad.h',
117   'gstpadtemplate.h',
118   'gstparamspecs.h',
119   'gstpipeline.h',
120   'gstplugin.h',
121   'gstpluginfeature.h',
122   'gstpoll.h',
123   'gstpreset.h',
124   'gstprotection.h',
125   'gstquery.h',
126   'gstpromise.h',
127   'gstsample.h',
128   'gstsegment.h',
129   'gststreamcollection.h',
130   'gststreams.h',
131   'gststructure.h',
132   'gstsystemclock.h',
133   'gsttaglist.h',
134   'gsttagsetter.h',
135   'gsttask.h',
136   'gsttaskpool.h',
137   'gsttoc.h',
138   'gsttocsetter.h',
139   'gsttracer.h',
140   'gsttracerfactory.h',
141   'gsttracerrecord.h',
142   'gsttypefind.h',
143   'gsttypefindfactory.h',
144   'gsturi.h',
145   'gstutils.h',
146   'gstvalue.h',
147   'gstregistry.h',
148   'gstparse.h',
149   'math-compat.h',
150 ]
151 install_headers(gst_headers, subdir : 'gstreamer-1.0/gst')
152
153 gst_registry = get_option('registry')
154 if gst_registry
155   gst_registry_sources = ['gstregistrybinary.c']
156 else
157   gst_registry_sources = []
158 endif
159
160 # Make copy so configure_file consumes the copy and we can
161 # still add to the original cdata later.
162 gst_cdata = cdata
163
164 if gst_debug
165   gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#undef GST_DISABLE_GST_DEBUG')
166 else
167   gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#define GST_DISABLE_GST_DEBUG 1')
168 endif
169
170 if gst_registry
171   gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#undef GST_DISABLE_REGISTRY')
172 else
173   gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#define GST_DISABLE_REGISTRY 1')
174 endif
175
176 gst_parse = get_option('gst_parse')
177 if gst_parse
178   gst_cdata.set('GST_DISABLE_PARSE_DEFINE', '#undef GST_DISABLE_PARSE')
179 else
180   gst_cdata.set('GST_DISABLE_PARSE_DEFINE', '#define GST_DISABLE_PARSE 1')
181 endif
182
183 gst_cdata.set10('GST_DISABLE_CAST_CHECKS_DEFINE', cast_checks.disabled())
184 gst_cdata.set10('GST_DISABLE_GLIB_ASSERTS_DEFINE', glib_asserts.disabled())
185 gst_cdata.set10('GST_DISABLE_GLIB_CHECKS_DEFINE', glib_checks.disabled())
186
187 # FIXME: add --disable-plugin option?
188 gst_cdata.set('GST_DISABLE_PLUGIN_DEFINE', '#undef GST_DISABLE_PLUGIN')
189
190 configure_file(input : 'gstconfig.h.in',
191   output : 'gstconfig.h',
192   install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst'),
193   configuration : gst_cdata)
194
195 version_cdata = configuration_data()
196 version_cdata.set('GST_VERSION_MAJOR', gst_version_major)
197 version_cdata.set('GST_VERSION_MINOR', gst_version_minor)
198 version_cdata.set('GST_VERSION_MICRO', gst_version_micro)
199 version_cdata.set('GST_VERSION_NANO', gst_version_nano)
200
201 gst_version_h = configure_file(input : 'gstversion.h.in',
202   output : 'gstversion.h',
203   install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst'),
204   configuration : version_cdata)
205
206 gst_enums = gnome.mkenums_simple('gstenumtypes',
207   sources : gst_headers,
208   header_prefix : '#include <gst/gstconfig.h>',
209   body_prefix : '#include "gst/gst_private.h"\n#include <gst/gst.h>',
210   decorator : 'GST_API',
211   install_header : true,
212   install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst'))
213
214 gstenum_h = gst_enums[1]
215 gstenum_c = gst_enums[0]
216
217 gst_parse_sources = []
218 if gst_parse
219   subdir('parse')
220 endif
221
222 subdir('printf')
223
224 libgst_c_args = gst_c_args + [
225   '-D_GNU_SOURCE',
226   '-DG_LOG_DOMAIN=g_log_domain_gstreamer',
227   '-DGST_DISABLE_DEPRECATED',
228 ]
229
230 tracer_hooks = get_option('tracer_hooks')
231 if not tracer_hooks
232   libgst_c_args += ['-DGST_DISABLE_GST_TRACER_HOOKS']
233 endif
234
235 # Make sure that subproject building gir files work
236 gst_incdirs = [configinc]
237 gst_gen_sources = [gstenum_h]
238 libgst = library('gstreamer-1.0', gst_sources,
239   gstenum_h, gstenum_c, gst_parse_sources, gst_registry_sources,
240   version : libversion,
241   soversion : soversion,
242   darwin_versions : osxversion,
243   c_args : libgst_c_args + ['-DBUILDING_GST'],
244   include_directories : [configinc,
245     # HACK, change include paths in .y and .l in final version.
246     include_directories('parse')],
247   link_with : printf_lib,
248   install : true,
249   dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, dl_dep] + backtrace_deps
250                    + platform_deps,
251 )
252
253 if build_gir
254   gst_gir_extra_args = gir_init_section + [ '--c-include=gst/gst.h' ]
255   if meson.is_subproject()
256     # FIXME: There must be a better way to do this
257     # Need to pass the include path to find gst/gst.h and gst/gstenumtypes.h (built)
258     gst_gir_extra_args += ['--cflags-begin',
259       '-I' + meson.current_source_dir() + '/..',
260       '-I' + meson.current_build_dir() + '/..',
261       '--cflags-end']
262   endif
263
264   gst_incdirs += [configinc]
265   gst_gen_sources += [gnome.generate_gir(libgst,
266     sources : gst_sources + gst_headers + gst_enums + [gst_version_h],
267     namespace : 'Gst',
268     nsversion : apiversion,
269     identifier_prefix : 'Gst',
270     symbol_prefix : 'gst',
271     export_packages : 'gstreamer-1.0',
272     includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0' ],
273     install : true,
274     extra_args : gst_gir_extra_args,
275   )]
276 endif
277
278 gst_compile_args = []
279 if get_option('default_library') == 'static'
280   gst_compile_args += ['-DGST_STATIC_COMPILATION']
281 endif
282
283 gst_dep = declare_dependency(link_with : libgst,
284   compile_args : gst_compile_args,
285   include_directories : gst_incdirs,
286   dependencies : [glib_dep, gobject_dep, gmodule_dep],
287   # Everything that uses libgst needs this built to compile
288   sources : gst_gen_sources,
289 )