qt: Assimp dependency specificationa is more nuanced (#30460)

libassimp has been a dependency for all of 5.x but expressing that has
varied significantly throughout the 5.x lifecycle:

  v5.0:  qt3d uses internal-only libassimp
  v5.5:  external-only libassimp
  v5.6:  either internal or external libassimp via autodetection
  v5.9:  user-selectable internal-vs-external via -assimp
  v5.14: additional qtquick3d module uses -assimp
  v5.15: qtquick3d switches to the -quick3d-assimp option
    * current bug where the incorrect target is setup
This commit is contained in:
Chuck Atkins 2022-05-04 13:30:15 -04:00 committed by GitHub
parent 8b0f6187e0
commit 250d5d2c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 18 deletions

View File

@ -134,7 +134,7 @@ class Qt(Package):
patch('qt514.patch', when='@5.14')
patch('qt514-isystem.patch', when='@5.14.2')
# https://bugreports.qt.io/browse/QTBUG-84037
patch('qt514-quick3d-assimp.patch', when='@5.14:5')
patch('qt515-quick3d-assimp.patch', when='@5.15:5')
# https://bugreports.qt.io/browse/QTBUG-90395
patch('https://src.fedoraproject.org/rpms/qt5-qtbase/raw/6ae41be8260f0f5403367eb01f7cd8319779674a/f/qt5-qtbase-gcc11.patch',
sha256='9378afd071ad5c0ec8f7aef48421e4b9fab02f24c856bee9c0951143941913c5',
@ -183,7 +183,7 @@ class Qt(Package):
depends_on("libpng", when='@4:')
depends_on("dbus", when='@4:+dbus')
depends_on("gl", when='@4:+opengl')
depends_on("assimp@5.0.0:5", when='@5.14:+opengl')
depends_on("assimp@5.0.0:5", when='@5.5:+opengl')
depends_on("harfbuzz", when='@5:')
depends_on("double-conversion", when='@5.7:')
@ -510,6 +510,13 @@ def patch(self):
with open(conf_file, 'a') as f:
f.write("QMAKE_CXXFLAGS += -std=gnu++98\n")
def _use_spack_dep(spec, config_args, spack_pkg, qt_name=None):
pkg = spec[spack_pkg]
config_args.append('-system-' + (qt_name or spack_pkg))
if not pkg.external:
config_args.extend(pkg.libs.search_flags.split())
config_args.extend(pkg.headers.include_flags.split())
@property
def common_config_args(self):
spec = self.spec
@ -527,12 +534,8 @@ def common_config_args(self):
'-no-pch',
]
def use_spack_dep(spack_pkg, qt_name=None):
pkg = spec[spack_pkg]
config_args.append('-system-' + (qt_name or spack_pkg))
if not pkg.external:
config_args.extend(pkg.libs.search_flags.split())
config_args.extend(pkg.headers.include_flags.split())
use_spack_dep = lambda spack_pkg, qt_name=None: _use_spack_dep(
spec, config_args, spack_pkg, qt_name)
if '+gui' in spec:
use_spack_dep('freetype')
@ -585,12 +588,6 @@ def use_spack_dep(spack_pkg, qt_name=None):
'-no-nis',
])
if '+opengl' in spec:
if version >= Version('5.14'):
use_spack_dep('assimp')
else:
config_args.append('-no-assimp')
# COMPONENTS
if '~examples' in spec:
@ -677,6 +674,9 @@ def configure(self, spec, prefix):
'' if version >= Version('5.7') else 'style')
])
use_spack_dep = lambda spack_pkg, qt_name=None: _use_spack_dep(
spec, config_args, spack_pkg, qt_name)
if MACOS_VERSION:
if version < Version('5.9'):
config_args.append('-no-xcb-xlib')
@ -724,17 +724,28 @@ def configure(self, spec, prefix):
if '~opengl' in spec:
config_args.extend(['-skip', 'multimedia'])
config_args.extend(['-skip', 'qt3d'])
if version >= Version('5.10'):
config_args.extend([
'-skip', 'webglplugin',
'-skip', 'qt3d',
])
config_args.extend(['-skip', 'webglplugin'])
if version >= Version('5.14'):
config_args.extend(['-skip', 'qtquick3d'])
if version >= Version('5.15'):
config_args.extend(['-skip', 'qtlocation'])
# v5.0: qt3d uses internal-only libassimp
# v5.5: external-only libassimp
# v5.6: either internal or external libassimp via autodetection
# v5.9: user-selectable internal-vs-external via -assimp
# v5.14: additional qtquick3d module uses -assimp
# v5.15: qtquick3d switched to the -quick3d-assimp option
if version >= Version('5.9'):
use_spack_dep('assimp')
if version >= Version('5.15'):
use_spack_dep('assimp', 'quick3d-assimp')
elif MACOS_VERSION:
# These options are only valid if 'multimedia' is enabled, i.e.
# +opengl is selected. Force them to be off on macOS, but let other