From 47750c8800a08b768066842a51113bb0c2141962 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Mon, 6 Jan 2020 16:47:16 -0500 Subject: 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 --- var/spack/repos/builtin/packages/qt/package.py | 89 ++++++++++++++++---------- 1 file changed, 56 insertions(+), 33 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index b210026927..44b0b35b42 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -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 @@ class Qt(Package): 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 @@ class Qt(Package): 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 + + 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 not MACOS_VERSION: + 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() -- cgit v1.2.3-70-g09d2