libav:avviddec: Add videometa if there is no videometa in output buffer
[platform/upstream/gstreamer.git] / subprojects / gst-editing-services / meson.build
1 project('gst-editing-services', 'c',
2   version : '1.22.8',
3   meson_version : '>= 0.62',
4   default_options : [ 'warning_level=1',
5                       'buildtype=debugoptimized' ])
6
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version = meson.project_version()
10 version_arr = gst_version.split('.')
11 gst_version_major = version_arr[0].to_int()
12 gst_version_minor = version_arr[1].to_int()
13 gst_version_micro = version_arr[2].to_int()
14  if version_arr.length() == 4
15   gst_version_nano = version_arr[3].to_int()
16 else
17   gst_version_nano = 0
18 endif
19 gst_version_is_stable = gst_version_minor.is_even()
20 gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
21
22 apiversion = '1.0'
23 soversion = 0
24 # maintaining compatibility with the previous libtool versioning
25 # current = minor * 100 + micro
26 curversion = gst_version_minor * 100 + gst_version_micro
27 libversion = '@0@.@1@.0'.format(soversion, curversion)
28 osxversion = curversion + 1
29
30 glib_req = '>= 2.62.0'
31
32 if gst_version_is_stable
33   gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
34 else
35   gst_req = '>= ' + gst_version
36 endif
37
38 cc = meson.get_compiler('c')
39 mathlib = cc.find_library('m', required : false)
40
41 cdata = configuration_data()
42
43 prefix = get_option('prefix')
44 datadir = prefix / get_option('datadir')
45
46 if cc.get_id() == 'msvc'
47   msvc_args = [
48       # Ignore several spurious warnings for things gstreamer does very commonly
49       # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
50       # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
51       # NOTE: Only add warnings here if you are sure they're spurious
52       '/wd4018', # implicit signed/unsigned conversion
53       '/wd4146', # unary minus on unsigned (beware INT_MIN)
54       '/wd4244', # lossy type conversion (e.g. double -> int)
55       '/wd4305', # truncating type conversion (e.g. double -> float)
56       cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
57
58       # Enable some warnings on MSVC to match GCC/Clang behaviour
59       '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
60       '/w14101', # 'identifier' : unreferenced local variable
61       '/w14189', # 'identifier' : local variable is initialized but not referenced
62   ]
63   add_project_arguments(msvc_args, language: 'c')
64 endif
65
66 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
67   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
68 endif
69
70 # glib doesn't support unloading, which means that unloading and reloading
71 # any library that registers static types will fail
72 if cc.has_link_argument('-Wl,-z,nodelete')
73   add_project_link_arguments('-Wl,-z,nodelete', language: 'c')
74 endif
75
76 # Symbol visibility
77 if cc.has_argument('-fvisibility=hidden')
78   add_project_arguments('-fvisibility=hidden', language: 'c')
79 endif
80
81 # Disable strict aliasing
82 if cc.has_argument('-fno-strict-aliasing')
83   add_project_arguments('-fno-strict-aliasing', language: 'c')
84 endif
85
86 cdata.set('VERSION', '"@0@"'.format(gst_version))
87 cdata.set('PACKAGE', '"gst-editing-services"')
88 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
89 cdata.set('PACKAGE_BUGREPORT', '"https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/new"')
90 cdata.set('PACKAGE_NAME', '"GStreamer Editing Services"')
91 cdata.set('GST_PACKAGE_NAME', '"GStreamer Editing Services"')
92 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
93 cdata.set('GST_LICENSE', '"LGPL"')
94
95 # Mandatory GST deps
96 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
97     fallback : ['gstreamer', 'gst_dep'])
98 gstpbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
99     fallback : ['gst-plugins-base', 'pbutils_dep'])
100 gstvideo_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
101     fallback : ['gst-plugins-base', 'video_dep'])
102 gstaudio_dep = dependency('gstreamer-audio-' + apiversion, version : gst_req,
103     fallback : ['gst-plugins-base', 'audio_dep'])
104 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
105     fallback : ['gstreamer', 'gst_base_dep'])
106 if host_machine.system() != 'windows'
107   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
108     required : get_option('tests'),
109     fallback : ['gstreamer', 'gst_check_dep'])
110 endif
111 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
112   fallback : ['gstreamer', 'gst_controller_dep'])
113 gstvalidate_dep = dependency('gstreamer-validate-1.0', version : gst_req, required : get_option('validate'),
114   fallback : ['gst-devtools', 'validate_dep'])
115
116 gio_dep = dependency('gio-2.0', version: glib_req)
117 gmodule_dep = dependency('gmodule-no-export-2.0')
118 libxml_dep = dependency('libxml-2.0', required: get_option('xptv'))
119 cdata.set('DISABLE_XPTV', not libxml_dep.found())
120
121 # TODO Properly port to Gtk 3
122 # gtk_dep = dependency('gtk+-3.0', required : false)
123
124 libges_deps = [gst_dep, gstbase_dep, gstvideo_dep, gstpbutils_dep,
125                gstcontroller_dep, gio_dep, libxml_dep, mathlib]
126
127 if gstvalidate_dep.found()
128     libges_deps = libges_deps + [gstvalidate_dep]
129     cdata.set('HAVE_GST_VALIDATE', 1)
130 endif
131
132 gir = find_program('g-ir-scanner', required : get_option('introspection'))
133 gnome = import('gnome')
134
135 # Fixme, not very elegant.
136 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
137 gir_init_section = [ '--add-init-section=' + \
138     'extern void gst_init(gint*,gchar**);' + \
139     'extern void ges_init(void);' + \
140     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
141     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
142     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
143     'g_setenv("GST_DEBUG", "0", TRUE);' + \
144     'gst_init(NULL,NULL);' + \
145     'ges_init();', '--quiet']
146
147 has_python = false
148 static_build = get_option('default_library') == 'static'
149 if static_build
150   if get_option('python').enabled()
151     error('Want to build python based modules but it is not supported while static building')
152   else
153     message('Disabling python support as it is not supported on static builds')
154   endif
155 elif build_gir
156   pymod = import('python')
157   python = pymod.find_installation(required: get_option('python'))
158   if python.found()
159     # Workaround for https://github.com/mesonbuild/meson/issues/5629
160     pythonver = python.language_version()
161     python_dep = dependency('python-@0@-embed'.format(pythonver), version: '>=3', required: false)
162     if not python_dep.found()
163       python_dep = python.dependency(required : get_option('python'))
164     endif
165   else
166     python_dep = dependency('', required: false)
167   endif
168   if python_dep.found()
169     python_abi_flags = python.get_variable('ABIFLAGS', '')
170     pylib_loc = get_option('libpython-dir')
171
172     error_msg = ''
173     if not cc.compiles('#include <Python.h>', dependencies: [python_dep])
174       error_msg = 'Could not compile a simple program against python'
175     elif pylib_loc == ''
176       fsmod = import('fs')
177       pylib_loc = python.get_variable('LIBPL', '')
178       if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
179         pylib_ldlibrary = python.get_variable('LDLIBRARY', '')
180         if not fsmod.exists(pylib_loc / pylib_ldlibrary)
181           # Workaround for Fedora
182           pylib_loc = python.get_variable('LIBDIR', '')
183           message('pylib_loc = @0@'.format(pylib_loc))
184         endif
185
186         if not fsmod.exists(pylib_loc / pylib_ldlibrary)
187           error_msg = '@0@ doesn\' exist, can\'t use python'.format(join_paths(pylib_loc, pylib_ldlibrary))
188         endif
189       endif
190       if error_msg == ''
191         pylib_suffix = 'so'
192         if host_machine.system() == 'windows'
193           pylib_suffix = 'dll'
194         elif host_machine.system() == 'darwin'
195           pylib_suffix = 'dylib'
196         endif
197
198         libges_deps = libges_deps + [python_dep, gmodule_dep]
199         has_python = true
200         message('python_abi_flags = @0@'.format(python_abi_flags))
201         message('pylib_loc = @0@'.format(pylib_loc))
202         cdata.set('HAS_PYTHON', true)
203         cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
204         cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
205         cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
206         cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
207       else
208           if get_option('python').enabled()
209             error(error_msg)
210           else
211             message(error_msg)
212           endif
213       endif
214     endif
215   endif
216 endif
217
218 # TIZEN BUILD OPTION
219 cdata.set('TIZEN_FEATURE_GES_DISABLE_HW_CODEC', true)
220 cdata.set('TIZEN_FEATURE_GES_TEXT_OVERLAY', true)
221 # TIZEN BUILD OPTION end
222
223 ges_c_args = ['-DHAVE_CONFIG_H', '-DG_LOG_DOMAIN="GES"']
224 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
225
226 pkgconfig = import('pkgconfig')
227 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
228 if get_option('default_library') == 'shared'
229   # If we don't build static plugins there is no need to generate pc files
230   plugins_pkgconfig_install_dir = disabler()
231 endif
232
233 if gst_dep.type_name() == 'internal'
234   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
235 else
236   # We can't check that in the case of subprojects as we won't
237   # be able to build against an internal dependency (which is not built yet)
238   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
239 endif
240
241 if gst_debug_disabled and cc.has_argument('-Wno-unused')
242   add_project_arguments('-Wno-unused', language: 'c')
243 endif
244
245 warning_flags = [
246   '-Wmissing-declarations',
247   '-Wmissing-prototypes',
248   '-Wredundant-decls',
249   '-Wundef',
250   '-Wwrite-strings',
251   '-Wformat',
252   '-Wformat-security',
253   '-Winit-self',
254   '-Wmissing-include-dirs',
255   '-Waddress',
256   '-Wno-multichar',
257   '-Wvla',
258   '-Wpointer-arith',
259 ]
260
261 foreach extra_arg : warning_flags
262   if cc.has_argument (extra_arg)
263     add_project_arguments([extra_arg], language: 'c')
264   endif
265 endforeach
266
267 python3 = import('python').find_installation()
268 pkgconfig = import('pkgconfig')
269 pkgconfig_subdirs = ['gstreamer-1.0']
270
271 configinc = include_directories('.')
272 gst_libraries = []
273
274 subdir('ges')
275 subdir('plugins')
276 subdir('tools')
277
278 subdir('tests')
279 if not get_option('examples').disabled()
280   subdir('examples')
281 endif
282 subdir('docs')
283
284 pygi_override_dir = get_option('pygi-overrides-dir')
285 #if pygi_override_dir == ''
286 #  pygi_override_dir = python3.get_install_dir(
287 #    subdir : join_paths('gi', 'overrides')
288 #  )
289 #endif
290
291 #message('pygobject overrides directory = @0@'.format(pygi_override_dir))
292 #subdir('bindings/python')
293
294 # Set release date
295 if gst_version_nano == 0
296   extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
297   run_result = run_command(extract_release_date, gst_version, files('gst-editing-services.doap'), check: true)
298   release_date = run_result.stdout().strip()
299   cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
300   message('Package release date: ' + release_date)
301 endif
302
303 if gio_dep.version().version_compare('< 2.67.4')
304   cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)')
305 endif
306
307 configure_file(output: 'config.h', configuration: cdata)
308
309 meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.20.0', meson.project_version())
310
311 plugin_names = []
312 gst_plugins = []
313 foreach plugin: plugins
314   pkgconfig.generate(plugin, install_dir: plugins_pkgconfig_install_dir)
315   dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
316   meson.override_dependency(plugin.name(), dep)
317   gst_plugins += [dep]
318   if plugin.name().startswith('gst')
319     plugin_names += [plugin.name().substring(3)]
320   else
321     plugin_names += [plugin.name()]
322   endif
323 endforeach
324
325 summary({
326     'Plugins': plugin_names,
327 }, list_sep: ', ')