1 project('gst-python', 'c',
3 meson_version : '>= 0.62',
4 default_options : [ 'warning_level=1',
6 'buildtype=debugoptimized' ])
8 gst_version = meson.project_version()
9 version_arr = gst_version.split('.')
10 gst_version_major = version_arr[0]
11 gst_version_minor = version_arr[1]
12 api_version = '@0@.0'.format(gst_version_major)
14 add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
16 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
18 gst_dep = dependency('gstreamer-1.0', version : gst_req,
19 fallback : ['gstreamer', 'gst_dep'])
20 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
21 fallback : ['gstreamer', 'gst_base_dep'])
22 gmodule_dep = dependency('gmodule-no-export-2.0')
23 pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_dep'], version : '>= 3.8')
25 pymod = import('python')
26 python = pymod.find_installation(get_option('python'))
27 pythonver = python.language_version()
28 if pythonver.version_compare('<3.0')
29 error('Python2 is not supported anymore, please port your code to python3 (@0@ specified)'.format(python.language_version()))
32 python_dep = python.dependency(embed:true, required : true)
34 python_abi_flags = python.get_variable('ABIFLAGS', '')
35 pylib_loc = get_option('libpython-dir')
38 pylib_loc = python.get_variable('LIBPL', '')
39 if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
40 pylib_ldlibrary = python.get_variable('LDLIBRARY', '')
41 if not fsmod.exists(pylib_loc / pylib_ldlibrary)
42 # Workaround for Fedora
43 pylib_loc = python.get_variable('LIBDIR', '')
44 message('pylib_loc = @0@'.format(pylib_loc))
47 if not fsmod.exists(pylib_loc / pylib_ldlibrary)
48 error('Python dynamic library path could not be determined')
53 message('python_abi_flags = @0@'.format(python_abi_flags))
54 message('pylib_loc = @0@'.format(pylib_loc))
56 pygi_override_dir = get_option('pygi-overrides-dir')
58 if pygi_override_dir == ''
59 pygi_override_dir = python.get_install_dir(
60 subdir : join_paths('gi', 'overrides')
64 message('pygobject overrides directory = @0@'.format(pygi_override_dir))
66 # libdir has to be built from pieces.
67 libdir = get_option('prefix')+'/'+get_option('libdir')
71 if host_machine.system() == 'windows'
73 elif host_machine.system() == 'darwin'
74 pylib_suffix = 'dylib'
76 cdata = configuration_data()
77 cdata.set('PACKAGE', '"gst-python"')
78 cdata.set('VERSION', '"@0@"'.format(gst_version))
79 cdata.set('GST_PACKAGE_NAME', '"GStreamer Python"')
80 cdata.set('PACKAGE_NAME', '"GStreamer Python"')
81 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
82 cdata.set('PLUGINDIR', '"@0@/gstreamer-1.0"'.format(libdir))
83 cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
84 cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
85 cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
86 cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
87 configure_file(output : 'config.h', configuration : cdata)
88 configinc = include_directories('.')
90 pkgconfig = import('pkgconfig')
91 plugins_install_dir = join_paths(libdir, 'gstreamer-1.0')
92 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
93 if get_option('default_library') == 'shared'
94 # If we don't build static plugins there is no need to generate pc files
95 plugins_pkgconfig_install_dir = disabler()
99 if not get_option('plugin').disabled()
100 if get_option('default_library') != 'static'
103 warning('Python plugin not supported with `static` builds yet.')
106 if not get_option('tests').disabled()