[Qbs] Building a product's files into another product

2020-07-29 Thread Alberto Mardegan
Hi!
  The subject is a bit convoluted, but the meaning is this one: I have
product A defined like this:

Product {
type: "linkme"
name: "a"
Depends { name: "cpp" }
files: ["one.cpp"]
}

(in reality, the situation is more complex than this and the input files
are static files with the "qt.core.resource_data" tag, which causes a
"qrc_a.cpp" to be generated)

And I'm trying to use it from a product B:

CppApplication {
name: "b"
Depends { name: "a" }
...
}

Now, I would like that the cpp files from product A would be used when
building product B, that is as if product A was a Group. But it looks
like the Depends item is not effective.

I also tried to change the product's type to "obj", and this at least
causes the files in product A to be compiled; but they are still not
added to product B.

Indeed, it all works if I change product's A type to "staticlibrary",
but that forces me to use Q_INIT_RESOURCE, which I was trying to avoid.

Any ideas?

(the reason why I'm using a product and not a Group is that, under some
configurations, this could indeed be a separate product like a loadable
module)

Ciao,
  Alberto


-- 
http://www.mardy.it - Geek in un lingua international
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Conditionally adding a file tag

2020-07-29 Thread Alberto Mardegan
Hi Ulrich,

On 29/07/20 10:07, Jochen Ulrich wrote:
> I guess the issue here is that FileTaggers are disabled in this case:
> 
>> File taggers are disabled if file tags are set explicitly in a product or 
>> group.
>> For example, the "cpp" tag is not attached to the .cpp files in the 
>> following product
> (see https://doc.qt.io/qbs/qml-qbslanguageitems-filetagger.html#details)

It's not clear to me whether this applies to my case too: my group is
not specifying a file list, but it's using the fileTagsFilter to
populate itself. And in the fileTagsFilter documentation it's written (
https://doc.qt.io/qbs/qml-qbslanguageitems-group.html#fileTagsFilter-prop):

"The file tags that the group's fileTags property specifies will be
added to the matching artifacts."

which seems to be exactly my use-case.

> But normally, it is not a problem to set those tags via a Group when 
> organizing the Groups accordingly.
> For example you could have a dedicated Group for those resources. Something 
> like
> 
> Group {
> name: "Resources"
> fileTags: embedAsResource ? ["qt.core.resource_data"] : []
> qbs.install: !embedAsResource
> qbs.installDir: "share/" + project.relativePluginDir
> qbs.installSourceBase: "../"
> files: [
>   "file1.qml",
>   "file2.qml",
>   "file3..png",
>   "file4.gif",
>  ]
> }

Yes, this would work, but I'm writing a generic QBS item, that's why I
don't want to explicitly list the input files in there.

Ciao,
  Alberto


-- 
http://www.mardy.it - Geek in un lingua international
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Conditionally adding a file tag

2020-07-29 Thread Jochen Ulrich
Hi Alberto!

I guess the issue here is that FileTaggers are disabled in this case:

> File taggers are disabled if file tags are set explicitly in a product or 
> group.
> For example, the "cpp" tag is not attached to the .cpp files in the following 
> product
(see https://doc.qt.io/qbs/qml-qbslanguageitems-filetagger.html#details)

I don't know why the behavior is like this.
But it seems you need to decide to either set the tags via a Group or via a 
FileTagger.

But normally, it is not a problem to set those tags via a Group when organizing 
the Groups accordingly.
For example you could have a dedicated Group for those resources. Something like

Group {
name: "Resources"
fileTags: embedAsResource ? ["qt.core.resource_data"] : []
qbs.install: !embedAsResource
qbs.installDir: "share/" + project.relativePluginDir
qbs.installSourceBase: "../"
files: [
  "file1.qml",
  "file2.qml",
  "file3..png",
  "file4.gif",
 ]
}

Best 
Jochen Ulrich

___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs