diff options
author | Nacho GarcÃa <nacho.garglez@gmail.com> | 2019-02-21 18:53:06 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2019-03-18 09:51:31 +0000 |
commit | 222a973918fe01ae0c4051a821797dde96f018af (patch) | |
tree | e9627525ec878f0e8f3bda588b23e32f1bb4cd44 | |
parent | eb76ba7031f053a3c1e69ce79f52bf84a222fa48 (diff) | |
download | meson-222a973918fe01ae0c4051a821797dde96f018af.zip meson-222a973918fe01ae0c4051a821797dde96f018af.tar.gz meson-222a973918fe01ae0c4051a821797dde96f018af.tar.bz2 |
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'
-rw-r--r-- | mesonbuild/dependencies/misc.py | 10 | ||||
-rw-r--r-- | mesonbuild/modules/python.py | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index df3a053..c95acff 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -450,10 +450,14 @@ class Python3Dependency(ExternalDependency): if pyplat.startswith('win'): vernum = sysconfig.get_config_var('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(sysconfig.get_config_var('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(sysconfig.get_config_var('base')) / libpath elif pyplat == 'mingw': if self.static: libname = sysconfig.get_config_var('LIBRARY') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 049c457..34fe5a5 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') |