[Qbs] Qbs, generators and automating tedious tasks
christian.kandeler at qt.io
Tue Nov 14 10:38:11 CET 2017
On Mon, 13 Nov 2017 18:46:55 +0100
Jakub Narolewski <izowiuz at gmail.com> wrote:
> Let me start by saying that I am not, by any means, a long time user of Qbs and maybe there is something painfully obvious that I missed which can be used to resolve my situation.
> Some time ago I started researching ways in which Qbs could help me integrate awesome tools from clang land into my dev workflow.
> Many of them [clang-tidy, KDAB’s clazy, even cppcheck] can leverage compile commands json file to do all sorts of static analysis.
> To quote the documentation:
> “To generate a project for another build system, such as Microsoft Visual Studio, use the qbs-generate sub-command and specify a generator using the -g option.
> # For Visual Studio
> qbs generate -g visualstudio2015”
> Obviously, when I use QtCreator to manage my Qbs projects, inputting this command into powershell/cmd leads to errors related to not yet configured Qbs profile and Qt framework instance. I could probably add them by hand and be done with it BUT:
> 1. I often change Qt versions
> 2. I often change compilers and their versions
> 3. I often change my workstations
> 4. I am an extremely lazy person
> I already tried adding custom build step in QtCreator but this is suboptimal. In ideal world I would right click on a Qbs project in QtCreator treeview and select “Generate project files for- > clangdb, vsstudioXXXX, turboC++” or maybe add some custom module in *.qbs file to generate it during build time.
> Is there any sane way to deal with this?
Generators are not exposed in the QtCreator interface at the moment, and I don't think anyone has yet spent time thinking about what that should look like and what the possible use cases and user workflows would be. You could create a task for this at bugreports.qt.io, and we can have that discussion there.
More information about the Qbs