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'
This commit is contained in:
parent
eb76ba7031
commit
222a973918
|
@ -450,10 +450,14 @@ class Python3Dependency(ExternalDependency):
|
||||||
if pyplat.startswith('win'):
|
if pyplat.startswith('win'):
|
||||||
vernum = sysconfig.get_config_var('py_version_nodot')
|
vernum = sysconfig.get_config_var('py_version_nodot')
|
||||||
if self.static:
|
if self.static:
|
||||||
libname = 'libpython{}.a'.format(vernum)
|
libpath = Path('libs') / 'libpython{}.a'.format(vernum)
|
||||||
else:
|
else:
|
||||||
libname = 'python{}.lib'.format(vernum)
|
comp = self.get_compiler()
|
||||||
lib = Path(sysconfig.get_config_var('base')) / 'libs' / libname
|
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':
|
elif pyplat == 'mingw':
|
||||||
if self.static:
|
if self.static:
|
||||||
libname = sysconfig.get_config_var('LIBRARY')
|
libname = sysconfig.get_config_var('LIBRARY')
|
||||||
|
|
|
@ -184,10 +184,14 @@ class PythonDependency(ExternalDependency):
|
||||||
if self.platform.startswith('win'):
|
if self.platform.startswith('win'):
|
||||||
vernum = self.variables.get('py_version_nodot')
|
vernum = self.variables.get('py_version_nodot')
|
||||||
if self.static:
|
if self.static:
|
||||||
libname = 'libpython{}.a'.format(vernum)
|
libpath = Path('libs') / 'libpython{}.a'.format(vernum)
|
||||||
else:
|
else:
|
||||||
libname = 'python{}.lib'.format(vernum)
|
comp = self.get_compiler()
|
||||||
lib = Path(self.variables.get('base')) / 'libs' / libname
|
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':
|
elif self.platform == 'mingw':
|
||||||
if self.static:
|
if self.static:
|
||||||
libname = self.variables.get('LIBRARY')
|
libname = self.variables.get('LIBRARY')
|
||||||
|
|
Loading…
Reference in New Issue