meson: remove vs_module_defs
[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   'gstsample.c',
52   'gstsegment.c',
53   'gststreamcollection.c',
54   'gststreams.c',
55   'gststructure.c',
56   'gstsystemclock.c',
57   'gsttaglist.c',
58   'gsttagsetter.c',
59   'gsttask.c',
60   'gsttaskpool.c',
61   'gsttoc.c',
62   'gsttocsetter.c',
63   'gsttracer.c',
64   'gsttracerfactory.c',
65   'gsttracerrecord.c',
66   'gsttracerutils.c',
67   'gsttypefind.c',
68   'gsttypefindfactory.c',
69   'gsturi.c',
70   'gstutils.c',
71   'gstvalue.c',
72   'gstparse.c',
73 ]
74
75 gst_headers = [
76   'gst.h',
77   'glib-compat.h',
78   'gstobject.h',
79   'gstallocator.h',
80   'gstbin.h',
81   'gstbuffer.h',
82   'gstbufferlist.h',
83   'gstbufferpool.h',
84   'gstbus.h',
85   'gstcaps.h',
86   'gstcapsfeatures.h',
87   'gstchildproxy.h',
88   'gstclock.h',
89   'gstcompat.h',
90   'gstcontext.h',
91   'gstcontrolbinding.h',
92   'gstcontrolsource.h',
93   'gstdatetime.h',
94   'gstdebugutils.h',
95   'gstelement.h',
96   'gstelementmetadata.h',
97   'gstdevice.h',
98   'gstdeviceprovider.h',
99   'gstdeviceproviderfactory.h',
100   'gstdynamictypefactory.h',
101   'gstelementfactory.h',
102   'gsterror.h',
103   'gstevent.h',
104   'gstformat.h',
105   'gstghostpad.h',
106   'gstdevicemonitor.h',
107   'gstinfo.h',
108   'gstiterator.h',
109   'gstatomicqueue.h',
110   'gstmacros.h',
111   'gstmessage.h',
112   'gstmeta.h',
113   'gstmemory.h',
114   'gstminiobject.h',
115   'gstpad.h',
116   'gstpadtemplate.h',
117   'gstparamspecs.h',
118   'gstpipeline.h',
119   'gstplugin.h',
120   'gstpluginfeature.h',
121   'gstpoll.h',
122   'gstpreset.h',
123   'gstprotection.h',
124   'gstquery.h',
125   'gstsample.h',
126   'gstsegment.h',
127   'gststreamcollection.h',
128   'gststreams.h',
129   'gststructure.h',
130   'gstsystemclock.h',
131   'gsttaglist.h',
132   'gsttagsetter.h',
133   'gsttask.h',
134   'gsttaskpool.h',
135   'gsttoc.h',
136   'gsttocsetter.h',
137   'gsttracer.h',
138   'gsttracerfactory.h',
139   'gsttracerrecord.h',
140   'gsttypefind.h',
141   'gsttypefindfactory.h',
142   'gsturi.h',
143   'gstutils.h',
144   'gstvalue.h',
145   'gstregistry.h',
146   'gstparse.h',
147   'math-compat.h',
148 ]
149 install_headers(gst_headers, subdir : 'gstreamer-1.0/gst')
150
151 disable_registry = get_option('disable_registry')
152 if not disable_registry
153   gst_registry = ['gstregistrybinary.c']
154 else
155   gst_registry = []
156 endif
157
158 # Make copy so configure_file consumes the copy and we can
159 # still add to the original cdata later.
160 gst_cdata = cdata
161
162 if disable_gst_debug
163   gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#define GST_DISABLE_GST_DEBUG 1')
164 else
165   gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#undef GST_DISABLE_GST_DEBUG')
166 endif
167
168 if disable_registry
169   gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#define GST_DISABLE_REGISTRY 1')
170 else
171   gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#undef GST_DISABLE_REGISTRY')
172 endif
173
174 # FIXME: add --disable-parse option? (but autotools doesn't seem to set this
175 # define properly at all either even though it does expose the option)
176 gst_cdata.set('GST_DISABLE_PARSE_DEFINE', '#undef GST_DISABLE_PARSE')
177
178 # FIXME: add --disable-plugin option?
179 gst_cdata.set('GST_DISABLE_PLUGIN_DEFINE', '#undef GST_DISABLE_PLUGIN')
180
181 configure_file(input : 'gstconfig.h.in',
182   output : 'gstconfig.h',
183   install_dir : 'include/gstreamer-1.0/gst',
184   configuration : gst_cdata)
185
186 version_cdata = configuration_data()
187 version_cdata.set('GST_VERSION_MAJOR', gst_version_major)
188 version_cdata.set('GST_VERSION_MINOR', gst_version_minor)
189 version_cdata.set('GST_VERSION_MICRO', gst_version_micro)
190 version_cdata.set('GST_VERSION_NANO', gst_version_nano)
191
192 gst_version_h = configure_file(input : 'gstversion.h.in',
193   output : 'gstversion.h',
194   install_dir : 'include/gstreamer-1.0/gst',
195   configuration : version_cdata)
196
197 gst_enums = gnome.mkenums('gstenumtypes',
198   sources : gst_headers,
199   h_template : 'gstenumtypes.h.template',
200   c_template : 'gstenumtypes.c.template',
201   install_header : true,
202   install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst'))
203
204 gstenum_h = gst_enums[1]
205 gstenum_c = gst_enums[0]
206
207
208 subdir('parse')
209 subdir('printf')
210
211 libgst_c_args = gst_c_args + [
212   '-D_GNU_SOURCE',
213   '-DGST_EXPORTS',
214   '-DG_LOG_DOMAIN=g_log_domain_gstreamer',
215   '-DGST_DISABLE_DEPRECATED',
216 ]
217
218 disable_tracer_hooks = get_option('disable_tracer_hooks')
219 if disable_tracer_hooks
220   libgst_c_args += ['-DGST_DISABLE_GST_TRACER_HOOKS']
221 endif
222
223 # Make it possible to build both static and shared versions
224 # at the same time. By default use shared for unit tests etc.
225 # This choice is arbitrary.
226 if libtype != 'shared'
227   libgst_static = static_library('gstreamer-1.0', gst_sources,
228     gstenum_h, gstenum_c, grammar, parser, gst_registry,
229     c_args : [libgst_c_args],
230     include_directories : [configinc,
231       # HACK, change include paths in .y and .l in final version.
232       include_directories('parse')],
233     install : true,
234     link_with : printf_lib,
235     dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib] + backtrace_deps  + platform_deps,
236   )
237   libgst = libgst_static
238 endif
239
240 # Make sure that subproject building gir files work
241 gst_incdirs = [configinc]
242 gst_gen_sources = [gstenum_h]
243 if libtype != 'static'
244   libgst_shared = shared_library('gstreamer-1.0', gst_sources,
245     gstenum_h, gstenum_c, grammar, parser, gst_registry,
246     version : libversion,
247     soversion : soversion,
248     c_args : libgst_c_args,
249     include_directories : [configinc,
250       # HACK, change include paths in .y and .l in final version.
251       include_directories('parse')],
252     link_with : printf_lib,
253     install : true,
254     dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, dl_dep] + backtrace_deps
255                      + platform_deps,
256   )
257   libgst = libgst_shared
258   if build_gir
259     gst_gir_extra_args = gir_init_section + [ '--c-include=gst/gst.h' ]
260     if meson.is_subproject()
261       # FIXME: There must be a better way to do this
262       # Need to pass the include path to find gst/gst.h and gst/gstenumtypes.h (built)
263       gst_gir_extra_args += ['--cflags-begin',
264           '-I' + meson.current_source_dir() + '/..',
265           '-I' + meson.current_build_dir() + '/..',
266           '--cflags-end']
267     endif
268
269     gst_incdirs += [configinc]
270     gst_gen_sources += [gnome.generate_gir(libgst_shared,
271       sources : gst_sources + gst_headers + gst_enums + [gst_version_h],
272       namespace : 'Gst',
273       nsversion : apiversion,
274       identifier_prefix : 'Gst',
275       symbol_prefix : 'gst',
276       export_packages : 'gstreamer-1.0',
277       includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0' ],
278       install : true,
279       extra_args : gst_gir_extra_args,
280     )]
281   endif
282 endif
283
284 gst_dep = declare_dependency(link_with : libgst,
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 )