[QBS] share functionnality between projects

olivier musse olivier.musse at sfr.fr
Wed May 14 17:26:21 CEST 2014

Le 14/05/2014 16:53, Joerg Bornemann a écrit :

Hi Joerg,

Thanks for help.
Yes, source file collections feature should be really nice.
About Transformer in a separate file, thanks for the solution. Another 
question then : is it possible to do the same but with multiple elements 
in the separate file. I mean for example not only one Transformer, but 
multiple ones and Rules and so on.  I imagine we need a main container 
item but do not know which one I can use?
QBS is really nice but it's hard to change the way of thinking compared 
to qmake ;o)



> On 14-May-14 14:31, olivier musse wrote:
>> What is the best way to share source files and functionality among
>> different projects.
> If you don't the source compiled built with different build settings, 
> then I recommend creating a static library, like you did.
> Source file collections (like .pri files) are not supported yet. But 
> there's suggestion QBS-59 for this feature.
> One can achieve something similar by using inheritance and/or .js 
> files. It's just not that nice.
>> 2) How to share functionality between projects.
>>   As an example, imagine I want to automatically generate a file
>> according to project properties
> [...]
>> I would like the transformer to be share among many projects so that I
>> only need to include in the project file a qbs file only containing this
>> transformer.
>> What is the best solution to do that ?
> Put the transformer to a separate file, e.g. mytrafo.qbs.
> Then import it
>    import "somewhere/mytrafo.qbs" as MyTrafo
> and instantiate it
>    MyTrafo {
>        // and maybe override properties here
>    }
> BR,
> Joerg

More information about the Qbs mailing list