1 project('gst-python', 'c', 'cpp',
3 meson_version : '>= 0.54',
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-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')
37 check_path_exists = 'import os, sys; assert(os.path.exists(sys.argv[1]))'
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 run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary)).returncode() != 0
42 # Workaround for Fedora
43 pylib_loc = python.get_variable('LIBDIR', '')
44 message('pylib_loc = @0@'.format(pylib_loc))
48 run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary)).returncode() == 0,
49 'Python dynamic library path could not be determined'
54 message('python_abi_flags = @0@'.format(python_abi_flags))
55 message('pylib_loc = @0@'.format(pylib_loc))
57 pygi_override_dir = get_option('pygi-overrides-dir')
59 if pygi_override_dir == ''
60 pygi_override_dir = python.get_install_dir(
61 subdir : join_paths('gi', 'overrides')
65 message('pygobject overrides directory = @0@'.format(pygi_override_dir))
67 # libdir has to be built from pieces.
68 libdir = get_option('prefix')+'/'+get_option('libdir')
72 if host_machine.system() == 'windows'
74 elif host_machine.system() == 'darwin'
75 pylib_suffix = 'dylib'
77 cdata = configuration_data()
78 cdata.set('PACKAGE', '"gst-python"')
79 cdata.set('VERSION', '"@0@"'.format(gst_version))
80 cdata.set('GST_PACKAGE_NAME', '"GStreamer Python"')
81 cdata.set('PACKAGE_NAME', '"GStreamer Python"')
82 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
83 cdata.set('PLUGINDIR', '"@0@/gstreamer-1.0"'.format(libdir))
84 cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
85 cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
86 cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
87 cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
88 configure_file(output : 'config.h', configuration : cdata)
89 configinc = include_directories('.')
91 pkgconfig = import('pkgconfig')
92 plugins_install_dir = join_paths(libdir, 'gstreamer-1.0')
93 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
94 if get_option('default_library') == 'shared'
95 # If we don't build static plugins there is no need to generate pc files
96 plugins_pkgconfig_install_dir = disabler()
100 if get_option('default_library') != 'static'
103 warning('Python plugin not supported with `static` builds yet.')
105 if not get_option('tests').disabled()