[QBS] Qt4/Phonon not correctly supported by qtprofilesetup

Thomas Epting thomas.epting.stryker at gmail.com
Thu May 8 17:00:50 CEST 2014


Hi,

We're using Qbs 1.2 (distributed via QtCreator 3.1) and are very happy with
it. Really great work guys!

However we figured out a problem with Qt4 projects using the "phonon"
submodule. The qtModuleName contained in the generated module.qbs file is
obviously wrong ("onon"), and the library name results in "Qtonon4", which
is also not correct.

I had a look at the source code and found out that line 305 of
qtprofilesetup.cpp seems to be responsible for the wrong module name, since
the first two characters of the module name are always removed (which
shortens "phonon" to "onon"). Fixing this along with additional code for
adapting the library name would be a possible solution. However I think it
would be better to use a specific phonon.qbs module. So I've created a
patch which fixes the problem for me (see attachment). Maybe you can
include this on the 1.2 branch?

Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20140508/bc6b5fb6/attachment.html>
-------------- next part --------------
diff --git a/src/lib/qtprofilesetup/qtprofilesetup.cpp b/src/lib/qtprofilesetup/qtprofilesetup.cpp
index dca51c1..31b6950 100644
--- a/src/lib/qtprofilesetup/qtprofilesetup.cpp
+++ b/src/lib/qtprofilesetup/qtprofilesetup.cpp
@@ -293,6 +293,8 @@ static void createModules(Profile &profile, Settings *settings,
             copyTemplateFile(QLatin1String("moc.js"), qbsQtModuleDir, profile.name());
         } else if (module.qbsName == QLatin1String("gui")) {
             copyTemplateFile(QLatin1String("gui.qbs"), qbsQtModuleDir, profile.name());
+        } else if (module.qbsName == QLatin1String("phonon")) {
+            copyTemplateFile(QLatin1String("phonon.qbs"), qbsQtModuleDir, profile.name());
         } else {
             copyTemplateFile(QLatin1String("module.qbs"), qbsQtModuleDir, profile.name());
             QFile moduleFile(qbsQtModuleDir + QLatin1String("/module.qbs"));
diff --git a/src/lib/qtprofilesetup/templates.qrc b/src/lib/qtprofilesetup/templates.qrc
index 66c228e..bc326c9 100644
--- a/src/lib/qtprofilesetup/templates.qrc
+++ b/src/lib/qtprofilesetup/templates.qrc
@@ -2,6 +2,7 @@
     <qresource prefix="/">
         <file>templates/core.qbs</file>
         <file>templates/gui.qbs</file>
+        <file>templates/phonon.qbs</file>
         <file>templates/module.qbs</file>
         <file>templates/QtModule.qbs</file>
         <file>templates/moc.js</file>
diff --git a/src/lib/qtprofilesetup/templates/phonon.qbs b/src/lib/qtprofilesetup/templates/phonon.qbs
new file mode 100644
index 0000000..383b0ea
--- /dev/null
+++ b/src/lib/qtprofilesetup/templates/phonon.qbs
@@ -0,0 +1,11 @@
+import qbs 1.0
+import '../QtModule.qbs' as QtModule
+
+QtModule {
+    qtModuleName: "Phonon"
+    Depends { name: "Qt"; submodules: ['core'] }
+    includeDirName: 'phonon'
+    internalLibraryName: "phonon" + qtLibInfix + Qt.core.versionMajor
+    hasLibrary: true
+    cpp.includePaths: base.concat([])
+}


More information about the Qbs mailing list