[QBS] How to check minimal supported Qt version?

dismine dismine at gmail.com
Thu Mar 17 16:10:37 CET 2016


Thanks you, i think i have found good example.

import qbs
import QbsFunctions

Product {
    Depends { name: "Qt.core" }
    property string minimumQtVersion: "5.1.0"
    condition: QbsFunctions.versionIsAtLeast(Qt.core.version,
minimumQtVersion)
}

On Thu, Mar 17, 2016 at 4:54 PM, Kandeler Christian <
Christian.Kandeler at theqtcompany.com> wrote:

> I usually just disable my product if a condition is not met:
>
>     Product {
>
>         Depends { name: "Qt.core" }
>
>         condition: Qt.core.versionMajor >= 5
>
>     }
>
> You could also throw an error there, but you normally don't want to,
> because you'd like to be able to open the project in an IDE anyway, even if
> it cannot be built.
>
> For a more generic version number check, you'd write a JavaScript
> function. See for instance qbs-resources/imports/QbsFunctions/functions.js
> in the qbs sources.
>
>
> Christian
> --
> Top-quoting courtesy of web interface
>
> ------------------------------
> *From:* QBS <qbs-bounces+christian.kandeler=
> theqtcompany.com at qt-project.org> on behalf of dismine <dismine at gmail.com>
> *Sent:* Thursday, March 17, 2016 3:11 PM
> *To:* qbs at qt-project.org
> *Subject:* [QBS] How to check minimal supported Qt version?
>
> Hello,
>
> Yesterday i finally decided to start porting my project to qbs. I really
> like ideas behind qbs and feel that it worth time i'll spend on porting.
>
> Can someone help me with my first problem? In qmake i write:
>
> !minQtVersion(5, 0, 0) {
>
>     message("Cannot build Valentina with Qt version $${QT_VERSION}.")
>
>     error("Use at least Qt 5.0.0.")
>
> }
>
>
> Code for the function:
>
> defineTest(minQtVersion) {
>
>     maj = $$1
>
>     min = $$2
>
>     patch = $$3
>
>     isEqual(QT_MAJOR_VERSION, $$maj) {
>
>         isEqual(QT_MINOR_VERSION, $$min) {
>
>             isEqual(QT_PATCH_VERSION, $$patch) {
>
>                 return(true)
>
>             }
>
>             greaterThan(QT_PATCH_VERSION, $$patch) {
>
>                 return(true)
>
>             }
>
>         }
>
>         greaterThan(QT_MINOR_VERSION, $$min) {
>
>             return(true)
>
>         }
>
>     }
>
>     greaterThan(QT_MAJOR_VERSION, $$maj) {
>
>         return(true)
>
>     }
>
>     return(false)
>
> }
>
>
> How can i repeat the same with qbs?
>
> Of course, i can skip this part and go further, but i rather not if i can.
>
> Best regards,
> Roman
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20160317/80d6ed33/attachment.html>


More information about the Qbs mailing list