From 222a973918fe01ae0c4051a821797dde96f018af Mon Sep 17 00:00:00 2001 From: Nacho GarcĂ­a Date: Thu, 21 Feb 2019 18:53:06 +0100 Subject: dependencies: fix Python linking for windows+mingw For dynamic linking, some mingw releases don't link correctly with pythonXX.lib in all cases. This patch forces mingw to link against pyhthonXX.dll instead of the .lib file, which has a better compatiblity. Note that msys 1.0 old platform is detected as windows instead of 'mingw' --- mesonbuild/modules/python.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/python.py') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 049c457f4..34fe5a588 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -184,10 +184,14 @@ class PythonDependency(ExternalDependency): if self.platform.startswith('win'): vernum = self.variables.get('py_version_nodot') if self.static: - libname = 'libpython{}.a'.format(vernum) + libpath = Path('libs') / 'libpython{}.a'.format(vernum) else: - libname = 'python{}.lib'.format(vernum) - lib = Path(self.variables.get('base')) / 'libs' / libname + comp = self.get_compiler() + if comp.id == "gcc": + libpath = 'python{}.dll'.format(vernum) + else: + libpath = Path('libs') / 'python{}.lib'.format(vernum) + lib = Path(self.variables.get('base')) / libpath elif self.platform == 'mingw': if self.static: libname = self.variables.get('LIBRARY') -- cgit v1.2.3