[Qbs] Building a product's files into another product

Jochen Ulrich jochen.ulrich at clausmark.com
Thu Jul 30 13:04:05 CEST 2020


Hi Alberto!

Did you try using a Module instead of a Product?
https://doc.qt.io/qbs/qml-qbslanguageitems-module.html
https://doc.qt.io/qbs/custom-modules.html

Module {
    Depends { name: "cpp" }
    Group {
        name: "a"
        files: [ "one.cpp" ]
    }
}

Or export from a Product (which also creates a Module internally):

Product {
    name: "a"
    Export {
        Depends { name: "cpp" } // Maybe not needed?!
        Group {
            name: "a sources"
            files: [ "one.cpp" ]
        }
    }
}

Not sure if this works, though. :-)

Best
 Jochen


Am 29.07.20, 22:52 schrieb "Qbs im Auftrag von Alberto Mardegan" <qbs-bounces at qt-project.org im Auftrag von mardy at users.sourceforge.net>:

    Hi!
      The subject is a bit convoluted, but the meaning is this one: I have
    product A defined like this:

    Product {
        type: "linkme"
        name: "a"
        Depends { name: "cpp" }
        files: ["one.cpp"]
    }

    (in reality, the situation is more complex than this and the input files
    are static files with the "qt.core.resource_data" tag, which causes a
    "qrc_a.cpp" to be generated)

    And I'm trying to use it from a product B:

    CppApplication {
        name: "b"
        Depends { name: "a" }
        ...
    }

    Now, I would like that the cpp files from product A would be used when
    building product B, that is as if product A was a Group. But it looks
    like the Depends item is not effective.

    I also tried to change the product's type to "obj", and this at least
    causes the files in product A to be compiled; but they are still not
    added to product B.

    Indeed, it all works if I change product's A type to "staticlibrary",
    but that forces me to use Q_INIT_RESOURCE, which I was trying to avoid.

    Any ideas?

    (the reason why I'm using a product and not a Group is that, under some
    configurations, this could indeed be a separate product like a loadable
    module)

    Ciao,
      Alberto


    -- 
    http://www.mardy.it - Geek in un lingua international
    _______________________________________________
    Qbs mailing list
    Qbs at qt-project.org
    https://lists.qt-project.org/listinfo/qbs



More information about the Qbs mailing list