diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-30 17:06:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-15 14:22:42 +0100 |
commit | 9ca66d7a4042bbd008b493cf82a6b5d69be26443 (patch) | |
tree | c1f82dc6c3700c431ca726c4199e5e26f7904b7f | |
parent | 6409e06118af92766d4dacd3700c9f02eac33c75 (diff) |
qmake: Find metatypes files infixed with build type
There is no clear mapping between qmake and CMake build types.
Therefore, apply a heuristic to find the best one for a given build.
Conversely, if we have an infix build, the explicit infix is
missing from the metatypes file names. Therefore, strip it in
qmltypes.prf, too.
Furthermore, remove the special case for building Qt modules with
qmake. This is rather unlikely to work.
Pick-to: 6.2 6.3
Task-number: QTBUG-91706
Change-Id: I6f43225e94930fc960d51792b7b7b1a5db8de1e8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/qmltyperegistrar/qmltypes.prf | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/qmltyperegistrar/qmltypes.prf b/src/qmltyperegistrar/qmltypes.prf index 27373053a0..b6dea810cc 100644 --- a/src/qmltyperegistrar/qmltypes.prf +++ b/src/qmltyperegistrar/qmltypes.prf @@ -43,16 +43,35 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depen qt_module_deps = $$replace(qt_module_deps, _private$, '') qt_module_deps = $$unique(qt_module_deps) +# We know we need to prefer the CMake debug build type for qmake debug builds. Which of the CMake +# release build types should be preferred for a qmake release build is guesswork. We apply a +# heuristic here: +# +# If you've gone to the trouble of building a "minsizerel" Qt, you probably want to use it for your +# qmake "release" builds. Conversely, if you have both a "release" and a "relwithdebinfo" Qt, you +# probably want to use the "release" Qt build for qmake "release" builds and the "relwithdebinfo" +# one for qmake "debug" builds. +# +# If no fitting build type exists, we accept the others. On linux, for example, we typically +# have only a single "relwithdebinfo" Qt build for both debug and release builds of user projects. +build_types = minsizerel release relwithdebinfo debug +CONFIG(debug, debug|release): build_types = $$reverse(build_types) + for(dep, qt_module_deps) { android:ABI = _$${ANDROID_TARGET_ARCH} - METATYPES_FILENAME = $$lower($$eval(QT.$${dep}.module))$${ABI}_metatypes.json - INSTALLED_METATYPES = $$[QT_INSTALL_LIBS]/metatypes/$$METATYPES_FILENAME - isEmpty(MODULE_BASE_OUTDIR) { - QML_FOREIGN_METATYPES += $$INSTALLED_METATYPES - } else { - MODULE_BASE_METATYPES = $$MODULE_BASE_OUTDIR/lib/metatypes/$$METATYPES_FILENAME - exists($$MODULE_BASE_METATYPES): QML_FOREIGN_METATYPES += $$MODULE_BASE_METATYPES - else: QML_FOREIGN_METATYPES += $$INSTALLED_METATYPES + infixed_module_name = $$eval(QT.$${dep}.module) + + for(build_type, build_types) { + isEmpty(QT_LIBINFIX) { + metatypes_filename = $$lower($${infixed_module_name})$${ABI}_$${build_type}_metatypes.json + } else { + metatypes_filename = $$lower($$replace($${infixed_module_name}, $$QT_LIBINFIX, ''))$${ABI}_$${build_type}_metatypes.json + } + metatypes_filepath = $$[QT_INSTALL_LIBS]/metatypes/$${metatypes_filename} + exists($${metatypes_filepath}) { + QML_FOREIGN_METATYPES += $${metatypes_filepath} + break() + } } } |