[Qbs] Any novice tickets

Christian Kandeler christian.kandeler at qt.io
Thu Aug 9 11:16:54 CEST 2018

On Thu, 9 Aug 2018 03:53:50 +0300
Иван Комиссаров <abbapoh at gmail.com> wrote:

> Im a bit stuck with protobuf module. I’m trying to make the module behave different for different languages, i.e. generate .cc files for cpp project, java for java project and so on.
> I am trying to use product.dependencies[i].name == «cpp» condition. It works in the outputArtifacts section, but i can’t provide a conditionally exported cpp.staticLibraries: ["protobuf»]

I  assume you are referring to the suggestion in the bug report to auto-detect the target language? I'm not sure this is so valuable, and we could easily guess wrong. What if a project has both a cpp and a Java dependency? What about C++ vs Objective-C? Both come from the cpp module...
I suggest providing a property targetLanguages where the user can set the language(s) explicitly and have matching conditions in the respective rules (or have just one rule, but different ones might be cleaner).
Coming up with a good default value seems a bit tricky, but perhaps we can just leave it empty and inform the user that it needs to be set.

> Here’s the code https://pastebin.com/gNMiNg7G <https://pastebin.com/gNMiNg7G>
> I tried to tie cpp.staticLibraries to each artifact (but i guess the libraries are ignored for cpp tags) and i tried to use a Properties but it seems my condition function is not called at all (at least, throwing in it makes no result)

It makes no sense to set cpp.*Libraries on an artifact. The linker rule reads this property from the product level.


More information about the Qbs mailing list