[QBS] Combination of imports and module

Johannes.Matokic at microchip.com Johannes.Matokic at microchip.com
Fri Jun 28 16:27:17 CEST 2013


how would someone do a module that provides its own imports?
I want to do a module that has a few common product types and rules how they could be combined when used as dependencies in the final product.

I don't want to use Group for this as there are multiple files building a unit in the input of FinalProduct.
Those files could differ in some properties while other properties need one (unique) value for the whole unit.
"normal" products like Application could be used as input too.

This is an example of what I intend to do:

---- fancy/FancyProduct.qbs ----
    Product {
        // ... some special properties ...
        property int fanciness // could be different for each file
        property string fancyId // is unique for each product
        type: "fancyProduct"
        Depends { name: "fancy" }
        fancy.fanciness: fanciness
        fancy.fancyId: fancyId
---- fancy/module.qbs ----
    import qbs.base 1.0
    Module {
        readonly property int extreme: 42
        readonly property string fancyId
        property int fanciness
        // some other properties, rules and similar
---- myproject.qbs ----
    import qbs.base 1.0
    import fancy as fancy
    Project {
        moduleSearchPaths: '.'
        fancy.FancyProduct {
            name: "myFancyProduct"
            files: [ "example.bin", "example.txt" ]
            fanciness: fancy.extreme
            fancyId: "firstId"

        Application {
            name: "myFancyApp"
            files: ["main.cpp"]
            Depends: { name: "cpp" }
            Depends: { name: "fancy" }
            fancy.fanciness: 1
            fancy.fancyId: "secondId"

        Product {
            Name: "FinalProduct"
            type: "fancyFinal"
            Depends { name: "fancy" }
            Depends { name: "myFancyProduct" }
            Depends { name: "myFancyApp" }

How would the directory-hierarchy look like if done right?
Is it ok to put the module.qbs into the same dir as the imports?
Are there any (other) obvious (fatal) mistakes?

This example is already very similar to what I really want to do.
So if there is a better way to achieve the same this would be ok, too.

Thanks in advance,

Johannes Matokic

Microchip Technology Germany II GmbH & Co. KG
Friedrichshafener Straße 3 | 82205 Gilching | Germany
Tel: +49 (0) 8153 88 969-73 | Fax: +49 (0) 8153 88 969-9
johannes.matokic at microchip.com 
Haftender Gesellschafter: Microchip Technology Germany GmbH, Gilching
Geschäftsführer: Mohammed Nawaz Sharif, J. Eric Bjornholt, Ulrich Hallerberg
Sitz: 85737 Ismaning | HRA 98692

More information about the Qbs mailing list