On Thu, 30 Nov 2017 23:45:51 +0100 Ola Røer Thorsen <[email protected]> wrote:
> what's the recommended way to configure qbs to build C++ code with GCC > using the -O3 optimizer level? I see it's using -O2 for the "fast" > qbs.optimization setting. 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/). > My intended workflow is to use -O3 when building from QtCreator in release > mode, while not having to set properties from the command line manually. > This is a somewhat large codebase with several static libraries and > applications (similar in structure as the Qt source tree), currently being > built using qmake. > > I might also want to add more default compiler flags "globally" > (-ffast-math etc) at some point. Is it best to create my own > "CustomStaticLibrary" and "CustomApplication"-items and make sure to use > those everywhere instead of the regular ones provided with Qbs? 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" } } Christian _______________________________________________ Qbs mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/qbs
