Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Richard Weickelt
On 10.07.2020 14:18, Иван Комиссаров wrote:
> You can access the original value via input.cpp.prop:
> 
> fileTags:[tag],
> 
> filePath:outputDir+"/"+FileInfo.baseName(input.fileName)+suffix,
> 
> cpp:{
> 
> includePaths:[].concat(input.cpp.includePaths,outputDir),
> 
> warningLevel:"none",
> 
> }
> 

Product should be available as well:

Artifact {
// ...
cpp.cxxFlags: product.cpp.cxxFlags.concat(["-flag"])
}

Another way would be, to add an additional unique filetag to your generated
artifacts and then use a Group to assign the additional cpp properties to
them. Something like that:

Module {
// ...
Rule {
// ...
Artifact {
// ...
fileTags: ["cpp", "specialtag"]
}
}
Group {
fileTagsFilter: "specialtag"
cpp.cxxFlags: outer.concat(["-flag"])
}
}

The Group item has the (fortunate or unfortunate) side effect that the
matching artifacts appear in Qt Creator as files of the product.




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


Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Christian Kandeler
On Fri, 10 Jul 2020 16:42:51 +0500
Dan Pat  wrote:

> I have checked out the solution and discovered an inconvenience. As it
> stands, Artifacts are passed to the "cpp" module  with flags set by the
> Product (and product imported Modules) in the context of which the
> Artifacts are built. But as soon as I set the Artifact specific
> "cpp.cxxFlags" , they seem to replace, instead of being appended to
> (desired behaviour), the Product-wise flags. 

Right, list properties are overwritten, not appended to. Groups behave the same 
way. 

> Can you suggest any clean way to deal with this?

cpp.cxxFlags: product.cpp.cxxFlags.concat([/*artifact-specific stuff*/])


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


Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Иван Комиссаров
You can access the original value via input.cpp.prop:

fileTags: [tag],
filePath: outputDir + "/" + FileInfo.baseName(input.fileName) + suffix,
cpp: {
includePaths: [].concat(input.cpp.includePaths, outputDir),
warningLevel: "none",
}

> 10 июля 2020 г., в 13:42, Dan Pat  написал(а):
> 
> I have checked out the solution and discovered an inconvenience. As it 
> stands, Artifacts are passed to the "cpp" module  with flags set by the 
> Product (and product imported Modules) in the context of which the Artifacts 
> are built. But as soon as I set the Artifact specific "cpp.cxxFlags" , they 
> seem to replace, instead of being appended to (desired behaviour), the 
> Product-wise flags. Can you suggest any clean way to deal with this?
> 
> 
> пт, 10 июл. 2020 г. в 14:34, Dan Pat  >:
> Ah, I was looking directly at it and still didn't notice the 
> "cpp.cxxLanguageVersion" part. Thank you.
> 
> пт, 10 июл. 2020 г. в 13:33, Richard Weickelt  >:
> > Hi. I have a code generator, encapsulated in a dedicated Module, producing
> > c++ source files. The generator's artifacts are then picked up by the
> > "cpp"
> > module according to the rules. For such generated files (and for them
> > only)
> > I would like to pass certain flags to the compiler (to suppress certain
> > warnings) but I cannot figure out how. Any ideas are welcome. Regards.
> 
> Have a look at the code example here: 
> https://doc.qt.io/qbs/qml-qbslanguageitems-artifact.html 
> 
> 
> If you use the outputArtifacts property of the Rule item instead, it should 
> work very similar:
> 
> outputArtifacts: [{filePath: "myfile.cpp", fileTags: ["cpp"], cpp: { 
> someFlag: "value" }}]
> 
> 
> ___
> Qbs mailing list
> Qbs@qt-project.org
> https://lists.qt-project.org/listinfo/qbs

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


Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Dan Pat
I have checked out the solution and discovered an inconvenience. As it
stands, Artifacts are passed to the "cpp" module  with flags set by the
Product (and product imported Modules) in the context of which the
Artifacts are built. But as soon as I set the Artifact specific
"cpp.cxxFlags" , they seem to replace, instead of being appended to
(desired behaviour), the Product-wise flags. Can you suggest any clean way
to deal with this?


пт, 10 июл. 2020 г. в 14:34, Dan Pat :

> Ah, I was looking directly at it and still didn't notice the "cpp.
> cxxLanguageVersion" part. Thank you.
>
> пт, 10 июл. 2020 г. в 13:33, Richard Weickelt :
>
>> > Hi. I have a code generator, encapsulated in a dedicated Module,
>> producing
>> > c++ source files. The generator's artifacts are then picked up by the
>> > "cpp"
>> > module according to the rules. For such generated files (and for them
>> > only)
>> > I would like to pass certain flags to the compiler (to suppress certain
>> > warnings) but I cannot figure out how. Any ideas are welcome. Regards.
>>
>> Have a look at the code example here:
>> https://doc.qt.io/qbs/qml-qbslanguageitems-artifact.html
>>
>> If you use the outputArtifacts property of the Rule item instead, it
>> should work very similar:
>>
>> outputArtifacts: [{filePath: "myfile.cpp", fileTags: ["cpp"], cpp: {
>> someFlag: "value" }}]
>>
>>
>>
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Dan Pat
Ah, I was looking directly at it and still didn't notice the "cpp.
cxxLanguageVersion" part. Thank you.

пт, 10 июл. 2020 г. в 13:33, Richard Weickelt :

> > Hi. I have a code generator, encapsulated in a dedicated Module,
> producing
> > c++ source files. The generator's artifacts are then picked up by the
> > "cpp"
> > module according to the rules. For such generated files (and for them
> > only)
> > I would like to pass certain flags to the compiler (to suppress certain
> > warnings) but I cannot figure out how. Any ideas are welcome. Regards.
>
> Have a look at the code example here:
> https://doc.qt.io/qbs/qml-qbslanguageitems-artifact.html
>
> If you use the outputArtifacts property of the Rule item instead, it
> should work very similar:
>
> outputArtifacts: [{filePath: "myfile.cpp", fileTags: ["cpp"], cpp: {
> someFlag: "value" }}]
>
>
>
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Richard Weickelt
> Hi. I have a code generator, encapsulated in a dedicated Module, producing
> c++ source files. The generator's artifacts are then picked up by the
> "cpp"
> module according to the rules. For such generated files (and for them
> only)
> I would like to pass certain flags to the compiler (to suppress certain
> warnings) but I cannot figure out how. Any ideas are welcome. Regards.

Have a look at the code example here: 
https://doc.qt.io/qbs/qml-qbslanguageitems-artifact.html

If you use the outputArtifacts property of the Rule item instead, it should 
work very similar:

outputArtifacts: [{filePath: "myfile.cpp", fileTags: ["cpp"], cpp: { someFlag: 
"value" }}]


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


[Qbs] Applying cxxFlags to certain files

2020-07-10 Thread Dan Pat
Hi. I have a code generator, encapsulated in a dedicated Module, producing
c++ source files. The generator's artifacts are then picked up by the "cpp"
module according to the rules. For such generated files (and for them only)
I would like to pass certain flags to the compiler (to suppress certain
warnings) but I cannot figure out how. Any ideas are welcome. Regards.
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs