Simplify the Qt5 library detection

This commit is contained in:
Thomas Nagy 2017-01-28 11:40:41 +01:00
parent 107b82a242
commit ee2c5865f9
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 19 additions and 18 deletions

View File

@ -698,7 +698,7 @@ def add_qt5_rpath(self):
def process_rpath(vars_, coreval): def process_rpath(vars_, coreval):
for d in vars_: for d in vars_:
var = d.upper() var = d.upper()
value = env['LIBPATH_'+var] value = env['LIBPATH_' + var]
if value: if value:
core = env[coreval] core = env[coreval]
accu = [] accu = []
@ -707,32 +707,33 @@ def add_qt5_rpath(self):
if lib in core: if lib in core:
continue continue
accu.append('-Wl,--rpath='+lib) accu.append('-Wl,--rpath='+lib)
env['RPATH_'+var] = accu env['RPATH_' + var] = accu
process_rpath(self.qt5_vars, 'LIBPATH_QTCORE') process_rpath(self.qt5_vars, 'LIBPATH_QTCORE')
process_rpath(self.qt5_vars_debug, 'LIBPATH_QTCORE_DEBUG') process_rpath(self.qt5_vars_debug, 'LIBPATH_QTCORE_DEBUG')
@conf @conf
def set_qt5_libs_to_check(self): def set_qt5_libs_to_check(self):
if not hasattr(self, 'qt5_vars'): self.qt5_vars = Utils.to_list(getattr(self, 'qt5_vars', []))
self.qt5_vars = [] if not self.qt5_vars:
dirlst = Utils.listdir(self.env.QTLIBS) dirlst = Utils.listdir(self.env.QTLIBS)
if dirlst:
if self.environ.get('QT5_FORCE_STATIC'): pat = self.env.cxxshlib_PATTERN
libmatch = self.env.cxxstlib_PATTERN % 'Qt5.*' if Utils.is_win32:
else: pat = pat.replace('.dll', '.lib')
libmatch = self.env.cxxshlib_PATTERN % 'Qt5.*' if self.environ.get('QT5_FORCE_STATIC'):
libnamere = re.compile(libmatch + '$') pat = self.env.cxxstlib_PATTERN
qtliblist = filter(libnamere.match, dirlst) re_qt = re.compile(pat % '(?P<name>Qt5.*)' + '$')
for dentry in sorted(qtliblist): for x in dirlst:
self.qt5_vars.append(dentry.split('.')[0][dentry.find('Qt5'):]) m = re_qt.match(x)
if not self.qt5_vars: if m:
self.fatal('cannot find any Qt5 library on the system') self.qt5_vars.append(m.group('name'))
else: if not self.qt5_vars:
self.fatal('cannot find Qt5 library directory on the system') self.fatal('cannot find any Qt5 library (%r)' % self.env.QTLIBS)
self.qt5_vars = Utils.to_list(self.qt5_vars)
qtextralibs = getattr(Options.options, 'qtextralibs', None) qtextralibs = getattr(Options.options, 'qtextralibs', None)
if qtextralibs: if qtextralibs:
self.qt5_vars.extend(qtextralibs.split(',')) self.qt5_vars.extend(qtextralibs.split(','))
if not hasattr(self, 'qt5_vars_debug'): if not hasattr(self, 'qt5_vars_debug'):
self.qt5_vars_debug = [a + '_DEBUG' for a in self.qt5_vars] self.qt5_vars_debug = [a + '_DEBUG' for a in self.qt5_vars]
self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug) self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug)