From 781bde88a6223c5dc731e77bb59ab28b194baa39 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sun, 26 Jul 2026 22:12:56 +1200 Subject: [PATCH] qmake: allow building without KDE Frameworks 5 (CONFIG+=no_kf5) The CMake build has supported building without KF5 since the Qt-only replacements landed in sources/ui/nokde (BUILD_WITH_KF5=OFF). The qmake build had no equivalent: qelectrotech.pro hard-coded QT += ... KWidgetsAddons KCoreAddons ... so a machine without KF5 fails at configure time with Project ERROR: Unknown module(s) in QT: KWidgetsAddons KCoreAddons This is the error reported in discussion #393, where a contributor gave up trying to build on Windows with Qt 5.15.2 / MinGW. Deleting the two modules by hand (the obvious workaround) then fails at link time with undefined references to KAutoSaveFile, because the nokde sources are never compiled. Mirror the four things CMake does when BUILD_WITH_KF5=OFF: - define BUILD_WITHOUT_KF5 (the sources already guard on it) - add sources/ui/nokde to INCLUDEPATH - compile the three nokde replacements (KAutoSaveFile, KColorButton, KColorCombo) - drop KWidgetsAddons/KCoreAddons from QT The default build is unchanged: without CONFIG+=no_kf5 the KF5 modules are still required and sources/ui/nokde is not on the include path. Usage: qmake CONFIG+=no_kf5 qelectrotech.pro Co-Authored-By: Claude Opus 5 --- qelectrotech.pro | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/qelectrotech.pro b/qelectrotech.pro index 35e7408bd..f295a603b 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -238,7 +238,26 @@ RESOURCES += qelectrotech.qrc TRANSLATIONS += lang/*.ts # Modules Qt utilises par l'application -QT += xml svg network sql widgets printsupport concurrent KWidgetsAddons KCoreAddons gui-private +QT += xml svg network sql widgets printsupport concurrent gui-private + +# KDE Frameworks 5 (KWidgetsAddons, KCoreAddons) are optional. +# +# Pass CONFIG+=no_kf5 to qmake to build against the Qt-only replacements in +# sources/ui/nokde instead. This mirrors the CMake option BUILD_WITH_KF5=OFF +# and is the easiest route on Windows/MinGW, where KF5 is awkward to obtain. +# +# qmake CONFIG+=no_kf5 qelectrotech.pro +# +# sources/ui/nokde is only added to the include path in that configuration, so +# a normal KF5 build is unaffected. +no_kf5 { + DEFINES += BUILD_WITHOUT_KF5 + INCLUDEPATH += sources/ui/nokde + HEADERS += $$files(sources/ui/nokde/*.h) + SOURCES += $$files(sources/ui/nokde/*.cpp) +} else { + QT += KWidgetsAddons KCoreAddons +} # Private Qt GUI headers (needed for QPdfEngine::drawHyperlink) # gui-private should add this automatically, but some distros need it explicit