2022-04-15 16:58:49 +00:00
|
|
|
project('gst-python', 'c',
|
2024-03-05 12:58:57 +00:00
|
|
|
version : '1.25.0.1',
|
2024-01-28 11:15:01 +00:00
|
|
|
meson_version : '>= 1.1',
|
2016-09-05 14:30:43 +00:00
|
|
|
default_options : [ 'warning_level=1',
|
|
|
|
'c_std=gnu99',
|
|
|
|
'buildtype=debugoptimized' ])
|
|
|
|
|
|
|
|
gst_version = meson.project_version()
|
|
|
|
version_arr = gst_version.split('.')
|
|
|
|
gst_version_major = version_arr[0]
|
|
|
|
gst_version_minor = version_arr[1]
|
|
|
|
api_version = '@0@.0'.format(gst_version_major)
|
2024-02-21 04:24:22 +00:00
|
|
|
host_system = host_machine.system()
|
|
|
|
cc = meson.get_compiler('c')
|
2016-09-05 14:30:43 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
|
|
|
|
|
2016-09-05 14:30:43 +00:00
|
|
|
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
|
|
|
|
|
|
|
|
gst_dep = dependency('gstreamer-1.0', version : gst_req,
|
|
|
|
fallback : ['gstreamer', 'gst_dep'])
|
|
|
|
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
|
|
|
|
fallback : ['gstreamer', 'gst_base_dep'])
|
2022-03-30 15:06:02 +00:00
|
|
|
gmodule_dep = dependency('gmodule-no-export-2.0')
|
2024-02-21 05:56:30 +00:00
|
|
|
libdl = cc.find_library('dl', required: false)
|
2018-10-27 16:04:11 +00:00
|
|
|
pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_dep'], version : '>= 3.8')
|
2016-09-05 14:30:43 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
pymod = import('python')
|
|
|
|
python = pymod.find_installation(get_option('python'))
|
2019-12-13 08:46:20 +00:00
|
|
|
pythonver = python.language_version()
|
|
|
|
if pythonver.version_compare('<3.0')
|
2019-11-19 13:07:09 +00:00
|
|
|
error('Python2 is not supported anymore, please port your code to python3 (@0@ specified)'.format(python.language_version()))
|
|
|
|
endif
|
2023-11-01 17:56:33 +00:00
|
|
|
if pythonver.version_compare('<3.7')
|
|
|
|
error('Could not find a sufficient python version required: 3.7, found @0@'.format(python.language_version()))
|
|
|
|
endif
|
|
|
|
|
2019-12-13 08:46:20 +00:00
|
|
|
|
2024-02-21 04:24:22 +00:00
|
|
|
python_dep = python.dependency(embed: true, required: true)
|
2017-03-23 15:09:05 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
python_abi_flags = python.get_variable('ABIFLAGS', '')
|
2024-02-21 04:24:22 +00:00
|
|
|
message(f'python_abi_flags = @python_abi_flags@')
|
2019-01-22 19:59:02 +00:00
|
|
|
pylib_loc = get_option('libpython-dir')
|
2024-02-21 04:24:22 +00:00
|
|
|
fsmod = import('fs')
|
|
|
|
pylib_prefix = 'lib'
|
|
|
|
pylib_suffix = 'so'
|
|
|
|
if host_system == 'windows'
|
|
|
|
if cc.get_argument_syntax() == 'msvc'
|
|
|
|
pylib_prefix = ''
|
|
|
|
endif
|
|
|
|
pylib_suffix = 'dll'
|
|
|
|
elif host_system == 'darwin'
|
|
|
|
pylib_suffix = 'dylib'
|
|
|
|
endif
|
|
|
|
pylib_fnames = []
|
|
|
|
# Library name with soversion, non-devel package
|
|
|
|
pylib_fnames += python.get_variable('INSTSONAME', [])
|
|
|
|
# Library name without soversion, devel package, framework, etc.
|
|
|
|
pylib_fnames += python.get_variable('LDLIBRARY', [])
|
|
|
|
# Manually construct name as a fallback
|
|
|
|
pylib_fnames += [
|
|
|
|
pylib_prefix + 'python' + python_dep.version() + python_abi_flags + '.' + pylib_suffix
|
|
|
|
]
|
|
|
|
if pylib_loc != ''
|
|
|
|
pylib_locs = [pylib_loc]
|
|
|
|
else
|
|
|
|
pylib_locs = [
|
|
|
|
python.get_variable('LIBDIR', ''),
|
|
|
|
python.get_variable('LIBPL', ''),
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
pylib_fname = ''
|
|
|
|
foreach loc: pylib_locs
|
|
|
|
foreach fname: pylib_fnames
|
|
|
|
if fsmod.exists(loc / fname)
|
|
|
|
pylib_fname = fname
|
|
|
|
message(f'PY_LIB_FNAME = @fname@ (@loc@)')
|
|
|
|
break
|
2022-01-04 20:37:59 +00:00
|
|
|
endif
|
2024-02-21 04:24:22 +00:00
|
|
|
endforeach
|
|
|
|
endforeach
|
|
|
|
if pylib_fname == ''
|
|
|
|
error_msg = 'Could not find python library to load'
|
|
|
|
if python_opt.enabled()
|
|
|
|
error(error_msg)
|
|
|
|
else
|
|
|
|
message(error_msg)
|
2019-01-22 19:59:02 +00:00
|
|
|
endif
|
2017-03-23 15:09:05 +00:00
|
|
|
endif
|
2019-01-22 19:59:02 +00:00
|
|
|
|
2017-02-15 13:48:58 +00:00
|
|
|
pygi_override_dir = get_option('pygi-overrides-dir')
|
2018-10-28 16:52:33 +00:00
|
|
|
|
2017-02-15 13:48:58 +00:00
|
|
|
if pygi_override_dir == ''
|
2018-10-28 16:52:33 +00:00
|
|
|
pygi_override_dir = python.get_install_dir(
|
2022-09-09 04:21:12 +00:00
|
|
|
subdir : join_paths('gi', 'overrides'),
|
|
|
|
pure: false
|
2018-10-28 16:52:33 +00:00
|
|
|
)
|
2017-02-15 13:48:58 +00:00
|
|
|
endif
|
2018-10-28 16:52:33 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
message('pygobject overrides directory = @0@'.format(pygi_override_dir))
|
2016-09-05 14:30:43 +00:00
|
|
|
|
2021-05-11 21:14:41 +00:00
|
|
|
# libdir has to be built from pieces.
|
|
|
|
libdir = get_option('prefix')+'/'+get_option('libdir')
|
|
|
|
|
2016-09-05 14:30:43 +00:00
|
|
|
cdata = configuration_data()
|
2024-02-21 06:28:08 +00:00
|
|
|
cdata.set_quoted('PACKAGE', 'gst-python')
|
|
|
|
cdata.set_quoted('VERSION', gst_version)
|
|
|
|
cdata.set_quoted('GST_PACKAGE_NAME', 'GStreamer Python')
|
|
|
|
cdata.set_quoted('PACKAGE_NAME', 'GStreamer Python')
|
|
|
|
cdata.set_quoted('GST_API_VERSION', api_version)
|
|
|
|
cdata.set_quoted('PLUGINDIR', join_paths(get_option('prefix'), get_option('libdir'), 'gstreamer-1.0'))
|
2024-02-21 04:24:22 +00:00
|
|
|
cdata.set_quoted('PY_LIB_FNAME', pylib_fname)
|
2018-05-01 11:08:54 +00:00
|
|
|
configure_file(output : 'config.h', configuration : cdata)
|
2016-09-05 14:30:43 +00:00
|
|
|
configinc = include_directories('.')
|
|
|
|
|
2024-02-06 16:37:19 +00:00
|
|
|
meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.22.0', meson.project_version())
|
2022-11-07 00:10:39 +00:00
|
|
|
|
2020-10-09 12:34:12 +00:00
|
|
|
pkgconfig = import('pkgconfig')
|
2021-05-11 21:14:41 +00:00
|
|
|
plugins_install_dir = join_paths(libdir, 'gstreamer-1.0')
|
2020-10-09 12:34:12 +00:00
|
|
|
plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
|
|
|
|
if get_option('default_library') == 'shared'
|
|
|
|
# If we don't build static plugins there is no need to generate pc files
|
|
|
|
plugins_pkgconfig_install_dir = disabler()
|
|
|
|
endif
|
|
|
|
|
2016-09-05 14:30:43 +00:00
|
|
|
subdir('gi')
|
2021-11-10 18:38:04 +00:00
|
|
|
if not get_option('plugin').disabled()
|
|
|
|
if get_option('default_library') != 'static'
|
|
|
|
subdir('plugin')
|
|
|
|
else
|
|
|
|
warning('Python plugin not supported with `static` builds yet.')
|
|
|
|
endif
|
2021-09-22 16:12:07 +00:00
|
|
|
endif
|
2021-09-14 21:25:46 +00:00
|
|
|
if not get_option('tests').disabled()
|
|
|
|
subdir('testsuite')
|
|
|
|
endif
|