From 78797cc7e97c8337c14a094928b0843874e0bf89 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 24 Nov 2010 22:20:01 -0600 Subject: [PATCH] Make qt.prf use new qt_module.pri structure for QT variable This change requires the new resolve_depends(var, prefix) function in qmake. --- mkspecs/features/qt.prf | 87 ++++++------------------------- mkspecs/features/qt_functions.prf | 63 ++++++++++++++++++++++ src/qbase.pri | 4 +- 3 files changed, 82 insertions(+), 72 deletions(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 191a449719..4d8e4655b6 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -35,19 +35,6 @@ plugin { #Qt plugins INCLUDEPATH = $$QMAKE_INCDIR_QT $$INCLUDEPATH #prepending prevents us from picking up "stale" includes win32:INCLUDEPATH += $$QMAKE_INCDIR_QT/ActiveQt -# As order does matter for static libs, we reorder the QT variable here -TMPLIBS = declarative webkit phonon multimedia dbus testlib script scripttools svg qt3support sql xmlpatterns xml egl opengl openvg gui network core meegographicssystemhelper -for(QTLIB, $$list($$TMPLIBS)) { - contains(QT, $$QTLIB): QT_ORDERED += $$QTLIB -} - -QT_UNKNOWN = $$QT -QT_UNKNOWN -= $$QT_ORDERED -QT = $$QT_ORDERED -for(QTLIB, $$list($$QT_UNKNOWN)) { - !contains(TMPLIBS, $$QTLIB):message("Warning: unknown QT: $$QTLIB") -} - QT_PLUGIN_VERIFY = QTPLUGIN DEPLOYMENT_PLUGIN for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { for(QTPLUG, $$list($$lower($$unique($$QT_CURRENT_VERIFY)))) { @@ -128,69 +115,27 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { } } } + + + #specific module settings !isEmpty(QT_BUILD_TREE):QMAKE_LIBDIR = $$QT_BUILD_TREE/lib $$QMAKE_LIBDIR #as above, prepending prevents us from picking up "stale" libs QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT + +# Topological ordering of modules based on their QT..depends variable +QT = $$resolve_depends($$QT, "QT.") + for(QTLIB, $$list($$lower($$unique(QT)))) { - unset(qlib_style) - !qt_debug:!qt_release { - CONFIG(debug, debug|release):qlib_style = debug - else:qlib_style = release - } else:CONFIG(qt_debug, qt_debug|qt_release) { - qlib_style = debug - } else { - qlib_style = release - } + isEmpty(QT.$${QTLIB}.name) { + message("Warning: unknown QT module: $$QTLIB") + next() + } - unset(qlib) - isEqual(QTLIB, gui):qlib = QtGui - else:isEqual(QTLIB, network):qlib = QtNetwork - else:isEqual(QTLIB, xml):qlib = QtXml - else:isEqual(QTLIB, xmlpatterns):qlib = QtXmlPatterns - else:isEqual(QTLIB, opengl):qlib = QtOpenGL - else:isEqual(QTLIB, openvg):qlib = QtOpenVG - else:isEqual(QTLIB, sql):qlib = QtSql - else:isEqual(QTLIB, core):qlib = QtCore - else:isEqual(QTLIB, canvas):qlib = QtCanvas - else:isEqual(QTLIB, qt3support):qlib = Qt3Support - else:isEqual(QTLIB, svg):qlib = QtSvg - else:isEqual(QTLIB, script):qlib = QtScript - else:isEqual(QTLIB, scripttools):qlib = QtScriptTools - else:isEqual(QTLIB, testlib):qlib = QtTest - else:isEqual(QTLIB, dbus):qlib = QtDBus - else:isEqual(QTLIB, phonon) { - qlib = phonon - INCLUDEPATH += $$QMAKE_INCDIR_QT/phonon_compat - - # The Helix backend requires this. Since we can't let a plugin set it, - # we bump the values for all Symbian Phonon plugins. - symbian:isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x040000 0x1600000 - - } else:isEqual(QTLIB, webkit) { - qlib = QtWebKit - aix-xlc { - # Flags recommended by IBM when using WebKit - QMAKE_LFLAGS -= -bmaxdata:0x80000000 - QMAKE_LFLAGS += -bmaxdata:0xD0000000/dsa - } - } else:isEqual(QTLIB, declarative):qlib = QtDeclarative - else:isEqual(QTLIB, multimedia):qlib = QtMultimedia - else:isEqual(QTLIB, meegographicssystemhelper):qlib = QtMeeGoGraphicsSystemHelper - else:message("Unknown QT: $$QTLIB"):qlib = - !isEmpty(qlib) { - target_qt:isEqual(TARGET, qlib) { - warning($$TARGET cannot have a QT of $$QTLIB) - } else { - DEFINES *= $$upper(QT_$${QTLIB}_LIB) - isEqual(QTLIB, opengl):CONFIG += opengl - isEqual(QTLIB, openvg):CONFIG += openvg - isEqual(QTLIB, qt3support):DEFINES *= QT3_SUPPORT - isEqual(QTLIB, testlib):CONFIG += console - isEqual(QTLIB, dbus):CONFIG += dbusadaptors dbusinterfaces - - qtAddLibrary($$qlib) - } - } + target_qt:isEqual(TARGET, QTLIB) { + warning($$TARGET cannot have a QT of $$QTLIB) + next() + } + qtAddModule($$QTLIB) } qt_compat { diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 5baf7ce2b4..b9b0fd839b 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -92,6 +92,69 @@ defineTest(qtAddLibrary) { return(true) } +defineTest(qtAddModule) { + MODULE_NAME = $$eval(QT.$${1}.name) + MODULE_INCLUDES = $$eval(QT.$${1}.includes) + MODULE_LIBS = $$eval(QT.$${1}.libs) + + CONFIG += $$eval(QT.$${1}.CONFIG) + DEFINES += $$eval(QT.$${1}.DEFINES) + + INCLUDEPATH -= $$MODULE_INCLUDES + INCLUDEPATH = $$MODULE_INCLUDES $$INCLUDEPATH + + unset(LINKAGE) + mac { + CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced + QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT} + FRAMEWORK_INCLUDE = $$MODULE_INCLUDES.framework/Headers + !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) { + INCLUDEPATH -= $$FRAMEWORK_INCLUDE + INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH + } + LINKAGE = -framework $${MODULE_NAME}$${QT_LIBINFIX} + } else:!qt_no_framework { #detection + for(frmwrk_dir, $$list($$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) { + exists($${frmwrk_dir}/$${MODULE_NAME}.framework) { + QMAKE_FRAMEWORKPATH *= $${frmwrk_dir} + FRAMEWORK_INCLUDE = $$frmwrk_dir/$${MODULE_NAME}.framework/Headers + !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) { + INCLUDEPATH -= $$FRAMEWORK_INCLUDE + INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH + } + LINKAGE = -framework $${MODULE_NAME} + break() + } + } + } + } + isEmpty(LINKAGE) { + # Make sure we can link to uninstalled libraries + !isEqual(MODULE_LIBS, $[QT_INSTALL_LIBS]) { + QMAKE_LFLAGS *= -L$$MODULE_LIBS + unix:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS" + } + if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { + win32:LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}d + mac:LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX}_debug + } + isEmpty(LINKAGE):LINKAGE = -l$${MODULE_NAME}$${QT_LIBINFIX} + } + !isEmpty(QMAKE_LSB) { + QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT + QMAKE_LFLAGS *= -L/opt/lsb/lib + QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX} + } + LIBS += $$LINKAGE + export(CONFIG) + export(DEFINES) + export(LIBS) + export(INCLUDEPATH) + export(QMAKE_FRAMEWORKPATH) + export(QMAKE_LFLAGS) + return(true) +} + # variable, default defineTest(qtPrepareTool) { isEmpty($$1) { diff --git a/src/qbase.pri b/src/qbase.pri index ce69757378..8b29eae69c 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -1,5 +1,7 @@ isEmpty(TARGET):error("You must set TARGET before include()'ing $${_FILE_}") -INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat + +MODULE_INCLUDES = $$eval(QT.$${MODULE}.includes) +INCLUDEPATH *= $$MODULE_INCLUDES $$MODULE_INCLUDES/.. #just for today to have some compat !isEmpty(RCC_DIR): INCLUDEPATH += $$RCC_DIR isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib