[QBS] How to generate 2 objects from the same source file

Ch'Gans chgans at gna.org
Fri Jul 29 10:04:33 CEST 2016

On 29 July 2016 at 01:20, Christian Kandeler <christian.kandeler at qt.io> wrote:
> On 07/28/2016 03:07 PM, Ch'Gans wrote:
>> For testing the clang DB generator[1] I would like to generate 2
>> objects from the same source file (clang tools should normally check
>> the same source file twice with the 2 different compile commands).
>> Is there a simple way to do that?
>> To keep it simple i would like first.o and second.o to be generated
>> with different preprocessor flags.
> You can
>     - put the files into different products or
>     - make a copy of the file or
>     - parameterize the respective properties (e.g. cpp.defines)
>       and call the generate command twice with different values
>       for that parameter.

I think that what I need is different products with different cpp.defines.

Any way, right now i'm fighting hard to get the test project "loaded".

My first step is simply to get the generator running, i have several choices:
- 1 run qbs with a QProcess like TestBlackbox::runQbs()
- 2 use CommandLineFrontend
- 3 instantiate Project "manually" like TestApi::doBuildProject()

But i'm a bit overwhelmed by the amount of boiler plate i have to write!
Solution 1 seems the less-difficult of all...
Which profile should i use? How to retrieve the profile that has been
used for building Qbs itself? Does it even make sense to attempt to
retrieve it?
Surely, there is to be a way to get a ready-to-use profile for the
auto-tests, still searching tho...

I would highly appreciate if someone could shed some light on how to
get started.


> Christian
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs

More information about the Qbs mailing list