2016-09-05 14:30:43 +00:00
|
|
|
project('gst-python', 'c', 'cpp',
|
2021-09-23 00:35:45 +00:00
|
|
|
version : '1.19.2',
|
2020-09-08 15:59:04 +00:00
|
|
|
meson_version : '>= 0.54',
|
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)
|
|
|
|
|
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'])
|
|
|
|
gmodule_dep = dependency('gmodule-2.0')
|
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
|
2019-12-13 08:46:20 +00:00
|
|
|
|
2020-10-08 10:56:10 +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', '')
|
2019-01-22 19:59:02 +00:00
|
|
|
pylib_loc = get_option('libpython-dir')
|
|
|
|
if pylib_loc == ''
|
|
|
|
check_path_exists = 'import os, sys; assert(os.path.exists(sys.argv[1]))'
|
|
|
|
pylib_loc = python.get_variable('LIBPL', '')
|
2019-11-12 23:52:04 +00:00
|
|
|
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
|
2019-01-22 19:59:02 +00:00
|
|
|
pylib_ldlibrary = python.get_variable('LDLIBRARY', '')
|
2019-11-12 23:52:04 +00:00
|
|
|
if run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary)).returncode() != 0
|
|
|
|
# Workaround for Fedora
|
|
|
|
pylib_loc = python.get_variable('LIBDIR', '')
|
|
|
|
message('pylib_loc = @0@'.format(pylib_loc))
|
2019-01-22 19:59:02 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
assert(
|
|
|
|
run_command(python, '-c', check_path_exists, join_paths(pylib_loc, pylib_ldlibrary)).returncode() == 0,
|
|
|
|
'Python dynamic library path could not be determined'
|
|
|
|
)
|
|
|
|
endif
|
2017-03-23 15:09:05 +00:00
|
|
|
endif
|
2019-01-22 19:59:02 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
message('python_abi_flags = @0@'.format(python_abi_flags))
|
|
|
|
message('pylib_loc = @0@'.format(pylib_loc))
|
2017-03-23 15:09:05 +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(
|
|
|
|
subdir : join_paths('gi', 'overrides')
|
|
|
|
)
|
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
|
|
|
pylib_suffix = 'so'
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
pylib_suffix = 'dll'
|
|
|
|
elif host_machine.system() == 'darwin'
|
|
|
|
pylib_suffix = 'dylib'
|
|
|
|
endif
|
|
|
|
cdata = configuration_data()
|
|
|
|
cdata.set('PACKAGE', '"gst-python"')
|
|
|
|
cdata.set('VERSION', '"@0@"'.format(gst_version))
|
|
|
|
cdata.set('GST_PACKAGE_NAME', '"GStreamer Python"')
|
|
|
|
cdata.set('PACKAGE_NAME', '"GStreamer Python"')
|
|
|
|
cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
|
2021-05-11 21:14:41 +00:00
|
|
|
cdata.set('PLUGINDIR', '"@0@/gstreamer-1.0"'.format(libdir))
|
2016-09-05 14:30:43 +00:00
|
|
|
cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
|
|
|
|
cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
|
|
|
|
cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
|
|
|
|
cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
|
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('.')
|
|
|
|
|
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')
|
|
|
|
subdir('plugin')
|
2016-11-03 11:36:23 +00:00
|
|
|
subdir('testsuite')
|
2021-05-11 21:14:41 +00:00
|
|
|
|
2018-05-14 08:05:15 +00:00
|
|
|
run_command(python, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
|