[QBS] ist it possible to have conditional artifacts?

Christian Kandeler christian.kandeler at digia.com
Tue Oct 15 10:36:16 CEST 2013


On 10/14/2013 05:43 PM, Kurt Keller wrote:
> rpcgen generates up to three .c source files and a .h header file
> out of a single .x file. I want to create a module for qbs which
> conditionally creates only those .c / .h files which are wanted by the
> product. Is something like this possible?

This looks very much like 
https://bugreports.qt-project.org/browse/QBS-370. The tentative plan is 
to have this working in a generic way in qbs 1.2.
However, if the maximum number as well as the actual number of outputs 
are known statically (which seems to be the case here), it could work 
already.

> Product {
>    name: 'myrpcclient'
>    Depends { name: 'rpcgen' }
>    rpcgen.generateHDR:  true
>    rpcgen.generateCLNT: true
>    rpcgen.generateXDR:  true
>    rpcgen.generateSVC:  false
>    files: ['myrpcsrc.x']
>    ...
> }
>
> Product {
>    name: 'myrpcserver'
>    Depends { name: 'rpcgen' }
>    rpcgen.generateHDR:  true
>    rpcgen.generateCLNT: false
>    rpcgen.generateXDR:  true
>    rpcgen.generateSVC:  true
>    files: ['myrpcsrc.x']
>    ...
> }
>
> %< ------ >%
>
> Module {
>    ...
>    property bool generateHDR:  true
>    property bool generateXDR:  true
>    property bool generateCLNT: true
>    property bool generateSVC:  true
>
>    FileTagger {
>      pattern "*.x"
>      fileTags: ['rpcsrc']
>    }
>
>    Rule {
>      inputs: ['rpcsrc']
>      Artifact {
>        condition: product.moduleProperty(product.moduleName,"generateCLNT")

This looks like the right approach. Have you tried it?


Christian



More information about the Qbs mailing list