[QBS] Newbie to QBS

Christian Kandeler christian.kandeler at digia.com
Tue May 13 14:38:43 CEST 2014

On 05/13/2014 01:57 PM, olivier musse wrote:
> First thanks, its really amazing to see how people answer quick and
> precisely in this list. Hope I will be one day able to help also.
> - About post build process, your solution is working nice but I do not
> understand : I can understand that inputs is "application" filetags but
> why do I need to change my product type to "myapp" and set it as output
> of the rule. May you explain me that point ?

The product type is a tag. Tags are attached to files, and there are 
rules responsible for creating files with a certain tag. Files with the 
tag "application" are created by a linker rule. So if you want to run 
something after the application has been produced, the rule doing that 
needs to have a different output file tag. keep in mind that a rule is 
only executed if its output tags are part of a "path" to the product type.

> - windeployqt is amazing and works perfectly. I tried it in the post
> build process as followed
> Rule{
>              inputs:["application"]
>              Artifact  {
>                  fileName:  input.baseName
>                  fileTags:  "myapp"
>              }
>              prepare:  {
>                  var  cmd  =  new  Command("windeployqt",  input.fileName);
>                  cmd.description  =  "Post  build  process"  +  input.fileName;
>                  cmd.highlight  =  "Post  build  processing";
>                  return  cmd;
>              }
>          }
> But in fact I would like to deploy not after the build but after application deployment step
> Group  {
>              name:  "MyApplication"
>              fileTagsFilter:  "application"
>              qbs.install:  true
>              qbs.installDir:  "bin"
>          }
> How can I do that ?

Unfortunately that is not possible from within qbs at the moment, 
because installation is a separate step that comes after building has 
completely finished. As you can see, this design has drawbacks and it is 
currently under review. It's a non-trivial problem that requires some 

> - About install-root, yes I would like to affect it from the qbs file itself.
> In fact I'm using Qcreator plugin and the install-root is defined in qbs.user which we do not share among developer (subversion) : I read that it is not good to share this file.
> Moreover I need to deploy in many different directory (one for the final product, one for the test environnement) which are always relative to the main qbs file.
> So I would like to be able to deploy in subfolders of the qbs file without taking into account the install-root defined automatically in qbs.user file by QCreator.
> Perhaps I'm not thinking the right way but this is how we were working with qmake.

I don't think so. An install root is by definition set from the outside 
and can neither be read or written from the project files (nor should 
it). No matter what you do in qmake, if you say "make INSTALL_ROOT=/tmp 
install", then your data will be installed into /tmp. That's how it is 
supposed to work. It's simply not a project-specific property.


More information about the Qbs mailing list