mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
meson: Fix Python library searching on Windows
Neither LIBDIR nor LIBPL are set with the native windows Python (unlike MSYS2), so we need to use `prefix` which takes us to the rootdir of the Python installation. The name is also different: it's python312.dll, not python3.12.dll. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6734>
This commit is contained in:
parent
753aeccde7
commit
d7eeb62f38
1 changed files with 20 additions and 6 deletions
|
@ -45,39 +45,53 @@ pylib_loc = get_option('libpython-dir')
|
|||
fsmod = import('fs')
|
||||
pylib_prefix = 'lib'
|
||||
pylib_suffix = 'so'
|
||||
pylib_ver = python_dep.version()
|
||||
pylib_locs = []
|
||||
if host_system == 'windows'
|
||||
if cc.get_argument_syntax() == 'msvc'
|
||||
pylib_prefix = ''
|
||||
endif
|
||||
pylib_suffix = 'dll'
|
||||
pylib_ver = pylib_ver.replace('.', '')
|
||||
elif host_system == 'darwin'
|
||||
pylib_suffix = 'dylib'
|
||||
endif
|
||||
pylib_fnames = []
|
||||
# Library name with soversion, non-devel package
|
||||
if python.has_variable('INSTSONAME')
|
||||
# For example, libpython3.12.so.1.0 (Linux), libpython3.11.dll.a (MSYS2), etc.
|
||||
pylib_fnames += python.get_variable('INSTSONAME')
|
||||
endif
|
||||
# Library name without soversion, devel package, framework, etc.
|
||||
if python.has_variable('LDLIBRARY')
|
||||
# For example, libpython3.12.so (Linux), libpython3.11.dll.a (MSYS2), etc.
|
||||
pylib_fnames += python.get_variable('LDLIBRARY')
|
||||
endif
|
||||
# Manually construct name as a fallback
|
||||
pylib_fnames += [
|
||||
pylib_prefix + 'python' + python_dep.version() + python_abi_flags + '.' + pylib_suffix
|
||||
pylib_prefix + 'python' + pylib_ver + python_abi_flags + '.' + pylib_suffix
|
||||
]
|
||||
if pylib_loc != ''
|
||||
pylib_locs = [pylib_loc]
|
||||
else
|
||||
pylib_locs = [
|
||||
python.get_variable('LIBDIR', ''),
|
||||
python.get_variable('LIBPL', ''),
|
||||
]
|
||||
if python.has_variable('LIBDIR')
|
||||
pylib_locs += python.get_variable('LIBDIR')
|
||||
endif
|
||||
if python.has_variable('LIBPL')
|
||||
pylib_locs += python.get_variable('LIBPL')
|
||||
endif
|
||||
# On Windows, python312.dll is in the rootdir where Python is installed,
|
||||
# which is configured as the "prefix" in sysconfig.
|
||||
if host_system == 'windows'
|
||||
pylib_locs += python.get_variable('prefix')
|
||||
endif
|
||||
endif
|
||||
pylib_fname = ''
|
||||
foreach loc: pylib_locs
|
||||
foreach fname: pylib_fnames
|
||||
if fsmod.exists(loc / fname)
|
||||
fpath = loc / fname
|
||||
debug(f'Looking for Python library at: @fpath@')
|
||||
if fsmod.exists(fpath)
|
||||
pylib_fname = fname
|
||||
message(f'PY_LIB_FNAME = @fname@ (@loc@)')
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue