[Qbs] How to set GCC optimization -O3 in releasebuilds?

Ola Røer Thorsen ola at silentwings.no
Fri Dec 1 12:12:16 CET 2017


2017-12-01 10:03 GMT+01:00 Christian Kandeler <christian.kandeler at qt.io>:

>
> In this case, do not set cpp.optimization and use cpp.cxxFlags directly.
> We've decided against allowing more values for cpp.optimization because of
> the difficulties to abstract away the differences between the platforms
> (see https://codereview.qt-project.org/#/c/183884/).
>
>
Makes sense.


> Inheritance is one possibility. Another one is a project-specific module.
> For instance:
>
> // <project dir>/modules/myprojectsettings/myprojectsettings.qbs
> Module {
>     // ...
>     Properties {
>         condition: qbs.buildVariant === "release" &&
> qbs.toolchain.contains("gcc")
>         cpp.cxxFlags: ["-ffast-math", "-O3"]
>     }
> }
>
> // someproduct.qbs
> Product {
>     // ...
>     Depends { name: "myprojectsettings" }
> }
>
>
I quite like the module-solution. I'll have to include the Depends-item in
every product file, right?

Thanks!
Ola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20171201/fd823cb5/attachment.html>


More information about the Qbs mailing list