[Qbs] How to set GCC optimization -O3 in releasebuilds?
Christian Kandeler
christian.kandeler at qt.io
Fri Dec 1 12:36:54 CET 2017
On Fri, 1 Dec 2017 12:12:16 +0100
Ola Røer Thorsen <ola at silentwings.no> wrote:
> 2017-12-01 10:03 GMT+01:00 Christian Kandeler <christian.kandeler at qt.io>:
> > 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?
Yes, but you can combine this with inheritance and add the dependency in the base item. The advantage to a purely inheritance-based approach is that you can have different base items that share these settings without duplication (except for the dependency on the module).
Christian
More information about the Qbs
mailing list