[Qbs] Relation between Product and Export

resurrection at centrum.cz resurrection at centrum.cz
Wed Jul 26 15:26:15 CEST 2017


Thanks for the clarification Christian and Joerg! I am looking forward to the new version. Let me know if I could help in any way like testing out some specific features or so. I like Qbs and what it can do. :-)
Michael
______________________________________________________________
> Od: Christian Kandeler <christian.kandeler at qt.io>
> Komu: qbs at qt-project.org
> Datum: 26.07.2017 10:39
> Předmět: Re: [Qbs] Relation between Product and Export
>
On Tue, 25 Jul 2017 21:13:06 +0200
 <resurrection at centrum.cz> wrote:
 
 > I think I have another possible issue that you may be aware of as well (or I am just missing something). The Export item is a great way to control what the items that use the Product that defined it recieve. While that direction works pretty well I have major
 > problems using the properties defined inside the Export in the Product that defined it. E.g.:
 >  
 > Product {
 >     Export {
 >         Depends { name: "cpp" }
 >         cpp.includePaths: "include/"
 >     }
 >     cpp.defines: MY_SHARED_LIB
 > }
 >  
 > This will emit warning that I use "cpp" without depending on it (located on the Product). 
 
 Correct. The dependencies and properties of the Export item and those of the containing product are entirely distinct. 
 
 >The same warning (located to Export) will happen when I put the Depends before Export. Now as per documentation to access the variable defined outside of Export one has to use "product.cpp." that seems to work 
 
 The canonical way is to use a shared variable, since you generally do not want to export all your properties (as you've noted yourself):
 
 Product {
    // ...
    property stringList exportedDefines: ["X"]
    property stringList privateDefines: ["Y"]
    property stringList commonDefines: ["Z"]
    cpp.defines: commonDefines.concat(privateDefines)
    Export {
        // ...
        cpp.defines: product.commonDefines.concat(product.exportedDefines)
    }
 }
 
 Note how the defines set in the Export item are not a subset of the ones in the product, nor vice versa.
 Do *not* ever export product.cpp.* (whether it seems to work or not), as these are fully expanded properties, meaning they potentially contain values that were not set in the product directly, but in modules that the product (but not the Export item) depends on. That's asking for trouble.
    
 > Another issue that is linked to this one and likely of the same cause (whether it is a (known) bug or WAD) that other Depends { name: "SomeOtherProduct" } or event Depends { name: "Qt"; submodules: "widgets"; } are NOT accessible in the same Product. E.g.:
 >  
 > Product {
 >     Export {
 >         Depends { name: "Qt.core" }
 >         Depends { name: "cpp" }
 >         cpp.includePaths: "include/"
 >     }
 >     cpp.defines: MY_SHARED_LIB
 > }
 >  
 > Will provide access to Qt Core to whomever Depends on that Product but it does NOT provide access to it to this Product itself. Again, a workaround is to Depend on it outside of Export as well. How am I supposed to set these properties as exportable while having them available inside the defining Product? Ideally without duplicating the same code which I find rather silly.
 
 As Jörg has indicated, there are some ideas of how to make this more convenient, e.g. by adding a property to the Depends item indicating whether or not it should be automatically exported.
 
 
 Christian
 _______________________________________________
 Qbs mailing list
 Qbs at qt-project.org
 http://lists.qt-project.org/mailman/listinfo/qbs <http://lists.qt-project.org/mailman/listinfo/qbs>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20170726/cd22bd7c/attachment.html>


More information about the Qbs mailing list