[Qbs] qm-file build as internal resource
Christian Kandeler
christian.kandeler at qt.io
Tue Dec 12 09:49:26 CET 2017
On Mon, 11 Dec 2017 19:58:27 +0300
Карелин Павел <hkarel at yandex.ru> wrote:
> I'm build a third-party project. The peculiarity of the project is that
> qm-files are represented as internal resources.
> Now I solved the problem with a terrible hack:
> 1) Created the 'Translations' product
> Product {
> name: "Translations"
> type: "qm"
> destinationDirectory: project.sourceDirectory + "/translations"
>
> Depends { name: "Qt.core" }
> files: ["*.ts"]
> }
>
> 2) The results of the work 'Translations' are located in the
> project.sourceDirectory + "/translations" directory
> 3) The main product made dependent on 'Translations'
> Depends { name: "Translations" }
>
> 4) In the main product I cling the created qm-files through a qrc-resource
> Group {
> name: "translations"
> files: ["translations/translations.qrc"]
> }
>
> Is it possible to solve this task in another way?
> qm-resources should be placed by the path ":translations/"
You left out some details, so I have to take a guess. I assume you are listing the qm files "manually" in the qrc file, and that's what you want to get rid of?
In that case, something like the following looks adequate:
QtApplication { // Or whatever the main product is
Group {
name: "translations"
files: ["<translation dir>/*.ts"]
}
Group {
fileTagsFilter: ["qm"]
fileTags: ["qt.core.resource_data"]
}
// See doc.qt.io/qbs/qt-modules.html#core-properties
// for details.
Qt.core.resourceSourceBase: Qt.core.qmDir
Qt.core.resourcePrefix: "translations"
}
This should auto-generate the qrc file.
Christian
More information about the Qbs
mailing list