> On May 4, 2017, at 9:05 AM, Christian Kandeler <[email protected]>
> wrote:
>
> On 05/04/2017 04:19 PM, Thomas Ballenthin wrote:
>> I'm currently building my unit tests each as individual CppApplication. This
>> works fine as it is. But now I'm facing the problem to build each unit test
>> twice with different compiler options per set.
>
> Let me make sure I understand the use case correctly: You build your
> project only once, but selected products shuld exist more than once,
> with varying build properties?
>
>> As I understand, each product outputs a single file. What is the most
>> convenient way to produce two binaries with different compiler switches from
>> the same source files?
>
> At the moment, the only way to really multiplex on the product level is
> using (external) profiles. See the "profiles" entry in
> https://doc.qt.io/qbs/product-item.html. As far as I can tell, this
> would more or less map to the "flavor" thing if the profile contents
> could be specified in-place, correct?
The new multiplexing we are working on could also serve this use case well...
>
>> I would like to reduce code duplication and not specify several
>> CppApplications per unit test. Is there a way to have a "product factory",
>> or rules that process groups of files and output binaries.
>
> A less general way that might be sufficient for your needs would be to
> move most of the product specification into a base item and instantiate
> it twice:
> // In TestX.qbs
> CppApplication {
> // Depends { // ... }
> // files: [ ... ]
> // etc
> }
>
> // In your project file
> Project {
> TestX {
> name: "testx1"
> cpp.defines: ["VARIANT1"]
> }
> TestX {
> name: "testx2"
> cpp.defines: ["VARIANT2"]
> }
> }
>
>
>
> Hope this helps,
> Christian
>
> _______________________________________________
> Qbs mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/qbs
--
Jake Petroules - [email protected]
The Qt Company - Silicon Valley
Qbs build tool evangelist - qbs.io
_______________________________________________
Qbs mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs