[QBS] Precompile Job

Kandeler Christian Christian.Kandeler at digia.com
Tue Dec 17 16:54:26 CET 2013

Hi Gunter,

your generated header files should be in a dedicated product which the products that require them depend on. 
Here's a sketch:

---- generated-headers.qbs ---
Product {
    name: "Generated Headers"
    type: "my generated header"
    files: [ /* input files, if any */ ]
    Transformer { // Or use a Rule if the number of artifacts depends on the number of input files.
        inputs: product.files

        // One artifact for each generated header.
        Artifact {
            fileName: // ...
            fileTags: "my generated header"

        prepare: {
            // Your header generation code goes here.

--- app1.qbs ---
CppApplication {
    Depends { name: "Generated Headers" }
    // ...

Christian (top-posting due to circumstances, sorry)

From: qbs-bounces+christian.kandeler=digia.com at qt-project.org [qbs-bounces+christian.kandeler=digia.com at qt-project.org] on behalf of Gunter Spöcker [gunter at hs-grafik.net]
Sent: 15 December 2013 16:26
To: qbs at qt-project.org
Subject: [QBS] Precompile Job


I would like to use abs to compile my C++ project but at the moment I am stuck. My project/application
consists of several libraries and executables, which depend on another. Just as a simple example something like this:
- lib1
- lib2 depends on lib1
- app1 depends on lib1 and lib2

So far I think everything is fine with Qbs. But I need to realize a step prior to any compiling (this step is required to generate some
header files)
So compiling could work like this:
1, run precompile script for lib1, which generates some header files
2, compile lib1 and maybe at the same time proceed with step 3 at the same time
3, run precompile script for lib2, which generates some header files
4, compile lib2 and maybe at the same time proceed with step 5 at the same time
5, run precompile script for app1, which generates some header files
6, compile app1

Currently I don't know how to declare this kind of dependency in qbs, as lib2 and app1 already get compiled prior to
the precompile script of lib1 has being finished running. This obviously results in build errors, as still some header files are

Is there any way to express this kind of dependency in Qbs?

Thanks in advance

More information about the Qbs mailing list