summaryrefslogtreecommitdiff
path: root/gst/meson.build
blob: 92250541d878d03e8a5c125534e5a7d2927a1c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
gst_sources = [
  'gst.c',
  'gstobject.c',
  'gstallocator.c',
  'gstbin.c',
  'gstbuffer.c',
  'gstbufferlist.c',
  'gstbufferpool.c',
  'gstbus.c',
  'gstcaps.c',
  'gstcapsfeatures.c',
  'gstchildproxy.c',
  'gstclock.c',
  'gstcontext.c',
  'gstcontrolbinding.c',
  'gstcontrolsource.c',
  'gstdatetime.c',
  'gstdebugutils.c',
  'gstdevice.c',
  'gstdeviceprovider.c',
  'gstdeviceproviderfactory.c',
  'gstdynamictypefactory.c',
  'gstelement.c',
  'gstelementfactory.c',
  'gsterror.c',
  'gstevent.c',
  'gstformat.c',
  'gstghostpad.c',
  'gstdevicemonitor.c',
  'gstinfo.c',
  'gstiterator.c',
  'gstatomicqueue.c',
  'gstmessage.c',
  'gstmeta.c',
  'gstmemory.c',
  'gstminiobject.c',
  'gstpad.c',
  'gstpadtemplate.c',
  'gstparamspecs.c',
  'gstpipeline.c',
  'gstplugin.c',
  'gstpluginfeature.c',
  'gstpluginloader.c',
  'gstpoll.c',
  'gstpreset.c',
  'gstprotection.c',
  'gstquark.c',
  'gstquery.c',
  'gstregistry.c',
  'gstregistrychunks.c',
  'gstpromise.c',
  'gstsample.c',
  'gstsegment.c',
  'gststreamcollection.c',
  'gststreams.c',
  'gststructure.c',
  'gstsystemclock.c',
  'gsttaglist.c',
  'gsttagsetter.c',
  'gsttask.c',
  'gsttaskpool.c',
  'gsttoc.c',
  'gsttocsetter.c',
  'gsttracer.c',
  'gsttracerfactory.c',
  'gsttracerrecord.c',
  'gsttracerutils.c',
  'gsttypefind.c',
  'gsttypefindfactory.c',
  'gsturi.c',
  'gstutils.c',
  'gstvalue.c',
  'gstparse.c',
]

gst_headers = [
  'gst.h',
  'glib-compat.h',
  'gstobject.h',
  'gstallocator.h',
  'gstbin.h',
  'gstbuffer.h',
  'gstbufferlist.h',
  'gstbufferpool.h',
  'gstbus.h',
  'gstcaps.h',
  'gstcapsfeatures.h',
  'gstchildproxy.h',
  'gstclock.h',
  'gstcompat.h',
  'gstcontext.h',
  'gstcontrolbinding.h',
  'gstcontrolsource.h',
  'gstdatetime.h',
  'gstdebugutils.h',
  'gstelement.h',
  'gstelementmetadata.h',
  'gstdevice.h',
  'gstdeviceprovider.h',
  'gstdeviceproviderfactory.h',
  'gstdynamictypefactory.h',
  'gstelementfactory.h',
  'gsterror.h',
  'gstevent.h',
  'gstformat.h',
  'gstghostpad.h',
  'gstdevicemonitor.h',
  'gstinfo.h',
  'gstiterator.h',
  'gstatomicqueue.h',
  'gstmacros.h',
  'gstmessage.h',
  'gstmeta.h',
  'gstmemory.h',
  'gstminiobject.h',
  'gstpad.h',
  'gstpadtemplate.h',
  'gstparamspecs.h',
  'gstpipeline.h',
  'gstplugin.h',
  'gstpluginfeature.h',
  'gstpoll.h',
  'gstpreset.h',
  'gstprotection.h',
  'gstquery.h',
  'gstpromise.h',
  'gstsample.h',
  'gstsegment.h',
  'gststreamcollection.h',
  'gststreams.h',
  'gststructure.h',
  'gstsystemclock.h',
  'gsttaglist.h',
  'gsttagsetter.h',
  'gsttask.h',
  'gsttaskpool.h',
  'gsttoc.h',
  'gsttocsetter.h',
  'gsttracer.h',
  'gsttracerfactory.h',
  'gsttracerrecord.h',
  'gsttypefind.h',
  'gsttypefindfactory.h',
  'gsturi.h',
  'gstutils.h',
  'gstvalue.h',
  'gstregistry.h',
  'gstparse.h',
  'math-compat.h',
]
install_headers(gst_headers, subdir : 'gstreamer-1.0/gst')

disable_registry = get_option('disable_registry')
if not disable_registry
  gst_registry = ['gstregistrybinary.c']
else
  gst_registry = []
endif

# Make copy so configure_file consumes the copy and we can
# still add to the original cdata later.
gst_cdata = cdata

if disable_gst_debug
  gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#define GST_DISABLE_GST_DEBUG 1')
else
  gst_cdata.set('GST_DISABLE_GST_DEBUG_DEFINE', '#undef GST_DISABLE_GST_DEBUG')
endif

if disable_registry
  gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#define GST_DISABLE_REGISTRY 1')
else
  gst_cdata.set('GST_DISABLE_REGISTRY_DEFINE', '#undef GST_DISABLE_REGISTRY')
endif

# FIXME: add --disable-parse option? (but autotools doesn't seem to set this
# define properly at all either even though it does expose the option)
gst_cdata.set('GST_DISABLE_PARSE_DEFINE', '#undef GST_DISABLE_PARSE')

# FIXME: add --disable-plugin option?
gst_cdata.set('GST_DISABLE_PLUGIN_DEFINE', '#undef GST_DISABLE_PLUGIN')

configure_file(input : 'gstconfig.h.in',
  output : 'gstconfig.h',
  install_dir : 'include/gstreamer-1.0/gst',
  configuration : gst_cdata)

version_cdata = configuration_data()
version_cdata.set('GST_VERSION_MAJOR', gst_version_major)
version_cdata.set('GST_VERSION_MINOR', gst_version_minor)
version_cdata.set('GST_VERSION_MICRO', gst_version_micro)
version_cdata.set('GST_VERSION_NANO', gst_version_nano)

gst_version_h = configure_file(input : 'gstversion.h.in',
  output : 'gstversion.h',
  install_dir : 'include/gstreamer-1.0/gst',
  configuration : version_cdata)

gst_enums = gnome.mkenums('gstenumtypes',
  sources : gst_headers,
  h_template : 'gstenumtypes.h.template',
  c_template : 'gstenumtypes.c.template',
  install_header : true,
  install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst'))

gstenum_h = gst_enums[1]
gstenum_c = gst_enums[0]


subdir('parse')
subdir('printf')

libgst_c_args = gst_c_args + [
  '-D_GNU_SOURCE',
  '-DGST_EXPORTS',
  '-DG_LOG_DOMAIN=g_log_domain_gstreamer',
  '-DGST_DISABLE_DEPRECATED',
]

disable_tracer_hooks = get_option('disable_tracer_hooks')
if disable_tracer_hooks
  libgst_c_args += ['-DGST_DISABLE_GST_TRACER_HOOKS']
endif

# Make it possible to build both static and shared versions
# at the same time. By default use shared for unit tests etc.
# This choice is arbitrary.
if libtype != 'shared'
  libgst_static = static_library('gstreamer-1.0', gst_sources,
    gstenum_h, gstenum_c, grammar, parser, gst_registry,
    c_args : [libgst_c_args],
    include_directories : [configinc,
      # HACK, change include paths in .y and .l in final version.
      include_directories('parse')],
    install : true,
    link_with : printf_lib,
    dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib] + backtrace_deps  + platform_deps,
  )
  libgst = libgst_static
endif

# Make sure that subproject building gir files work
gst_incdirs = [configinc]
gst_gen_sources = [gstenum_h]
if libtype != 'static'
  libgst_shared = shared_library('gstreamer-1.0', gst_sources,
    gstenum_h, gstenum_c, grammar, parser, gst_registry,
    version : libversion,
    soversion : soversion,
    c_args : libgst_c_args,
    include_directories : [configinc,
      # HACK, change include paths in .y and .l in final version.
      include_directories('parse')],
    link_with : printf_lib,
    install : true,
    dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, dl_dep] + backtrace_deps
                     + platform_deps,
  )
  libgst = libgst_shared
  if build_gir
    gst_gir_extra_args = gir_init_section + [ '--c-include=gst/gst.h' ]
    if meson.is_subproject()
      # FIXME: There must be a better way to do this
      # Need to pass the include path to find gst/gst.h and gst/gstenumtypes.h (built)
      gst_gir_extra_args += ['--cflags-begin',
	  '-I' + meson.current_source_dir() + '/..',
	  '-I' + meson.current_build_dir() + '/..',
	  '--cflags-end']
    endif

    gst_incdirs += [configinc]
    gst_gen_sources += [gnome.generate_gir(libgst_shared,
      sources : gst_sources + gst_headers + gst_enums + [gst_version_h],
      namespace : 'Gst',
      nsversion : apiversion,
      identifier_prefix : 'Gst',
      symbol_prefix : 'gst',
      export_packages : 'gstreamer-1.0',
      includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0' ],
      install : true,
      extra_args : gst_gir_extra_args,
    )]
  endif
endif

gst_dep = declare_dependency(link_with : libgst,
  include_directories : gst_incdirs,
  dependencies : [glib_dep, gobject_dep, gmodule_dep],
  # Everything that uses libgst needs this built to compile
  sources : gst_gen_sources,
)