Fix QT on Linux+clang (#13684)

* Add platform flag to QT for linux+clang

* Extend QT platform support to more compilers and systems

* Unify QT5 configure options

* fixup! Unify QT5 configure options

* fixup! Unify QT5 configure options

* fixup! Unify QT5 configure options

* Fix newer flake8 and mac qt5 configure
This commit is contained in:
Seth R. Johnson 2020-01-06 16:47:16 -05:00 committed by Adam J. Stewart
parent 7cde359eb8
commit 47750c8800

View File

@ -169,6 +169,9 @@ class Qt(Package):
use_xcode = True
# Mapping for compilers in the QT 'mkspecs'
compiler_mapping = {'intel': 'icc', 'clang': 'clang-libc++', 'gcc': 'g++'}
def url_for_version(self, version):
# URL keeps getting more complicated with every release
url = self.list_url
@ -415,16 +418,31 @@ def common_config_args(self):
if MACOS_VERSION:
config_args.append('-{0}framework'.format(
'' if '+framework' in self.spec else 'no-'))
if '@5:' in self.spec and MACOS_VERSION:
config_args.extend([
'-no-xcb-xlib',
'-no-pulseaudio',
'-no-alsa',
])
if self.spec.satisfies('@:5.11'):
config_args.append('-no-xinput2')
# FIXME: else: -system-xcb ?
# Note: QT defaults to the following compilers
# QT4 mac: gcc
# QT5 mac: clang
# linux: gcc
# In QT4, unsupported compilers lived under an 'unsupported'
# subdirectory but are now in the main platform directory.
spec = self.spec
cname = spec.compiler.name
cname = self.compiler_mapping.get(cname, cname)
is_new_qt = spec.satisfies('@5:')
platform = None
if MACOS_VERSION:
if is_new_qt and cname != "clang-libc++":
platform = 'macx-' + cname
elif not is_new_qt and cname != "g++":
platform = 'unsupported/macx-' + cname
elif cname != 'g++':
if is_new_qt:
platform = 'linux-' + cname
else:
platform = 'unsupported/linux-' + cname
if platform is not None:
config_args.extend(['-platform', platform])
return config_args
@ -472,51 +490,56 @@ def configure(self, spec, prefix):
sdkpath = which('xcrun')('--show-sdk-path', output=str).strip()
config_args.extend([
'-cocoa',
'-platform', 'unsupported/macx-clang-libc++',
'-sdk', sdkpath])
configure(*config_args)
@when('@5.0:5.6')
def configure(self, spec, prefix):
webkit_args = [] if '+webkit' in spec else ['-skip', 'qtwebkit']
configure('-no-eglfs',
'-no-directfb',
'-{0}gtkstyle'.format('' if '+gtk' in spec else 'no-'),
*(webkit_args + self.common_config_args))
@when('@5.7:')
@when('@5')
def configure(self, spec, prefix):
config_args = self.common_config_args
version = self.version
if not MACOS_VERSION:
config_args.extend([
'-no-eglfs',
'-no-directfb',
'-{0}gtk{1}'.format(
'' if '+gtk' in spec else 'no-',
'' if version >= Version('5.8') else 'style')
])
if MACOS_VERSION:
config_args.extend([
'-system-xcb',
'-no-xcb-xlib',
'-no-pulseaudio',
'-no-alsa',
])
if version < Version('5.12'):
config_args.append('-no-xinput2')
else:
# Linux-only QT5 dependencies
config_args.append('-system-xcb')
if '~webkit' in spec:
config_args.extend([
'-skip', 'webengine',
'-skip',
'webengine' if version >= Version('5.7') else 'qtwebkit',
])
if '~opengl' in spec and spec.satisfies('@5.10:'):
config_args.extend([
'-skip', 'webglplugin',
])
if spec.satisfies('@5.7'):
config_args.extend(['-skip', 'virtualkeyboard'])
if self.version > Version('5.8'):
if version >= Version('5.8'):
# relies on a system installed wayland, i.e. no spack package yet
# https://wayland.freedesktop.org/ubuntu16.04.html
# https://wiki.qt.io/QtWayland
config_args.extend(['-skip', 'wayland'])
if spec.satisfies('@5.7'):
config_args.extend(['-skip', 'virtualkeyboard'])
if version >= Version('5.10') and '~opengl' in spec:
config_args.extend([
'-skip', 'webglplugin',
])
configure('-no-eglfs',
'-no-directfb',
'-{0}gtk'.format('' if '+gtk' in spec else 'no-'),
*config_args)
configure(*config_args)
def build(self, spec, prefix):
make()