[QBS] build configuration (apologies for accidental premature post!)

Bornemann Joerg Joerg.Bornemann at digia.com
Sun Oct 21 16:57:18 CEST 2012


Hi Tobias,

> > I'd rather (automatically?) define a new buildVariant if a property is
> > altered on command line. Note that this is not possible yet.

> So builds will end up in directories with names partially made up of
> automatically generated names? I do not want build/myproject-debug25
> nor build/myproject-af4235de. How am I ever going to know which one of
> those I want to keep around or which ones I can delete?

You know of course that I'm against magic hash numbers in build directory 
names. I've complained about Qt Creator doing this before. ;)
Note, that "automatically generated" doesn't always mean "impossible to 
read".

This is about command-line usage only. The use case is: User wants to 
build with buildVariant xyz but with just this little detail changed.
Like
   qbs debug optimization:fast
would automatically create a new build variant of the name 
debug-optimization-fast or such. You don't want to specify too many
properties on the command line anyways.
If the desired build differs a lot one would create a new build variant
and just call
   qbs blues-clues

> A simple solution to this issue is to expect the user to create build
> directories with a reasonable name himself. Basically that is a lot
> like shadow-building in qmake: You set up a directory
> "build-with-debug-enabled-and-blue-background", cd into it and run qmake
> from
> there. I would really like to see something like this being possible.

You can of course just create your special build dir, cd there and call
   qbs -f ../src/myproject
like you are used with qmake. You still have the build subdir though.

> Build variants are then just what the name applies: Variations of
> "normal" builds that are widely used by almost everybody (like debug,
> release, maybe things like profiling and others). Project-specific
> configuration should be possible in qbs, _without_ changing those basic
> build settings.

At the end of the day are build variants not more nor less than named
collections of properties. Together with the profile (and platform) they
define a named build configuration.
Creating a build with the build variant "debug" and "background:blue" is
a build config that's different from just "debug" and should get its own
distinct name - automatically generated or user defined. Both should be 
possible. The latter by creating a new build variant "blues-debug" that 
is "debug" plus the blue background.

> The downside is that the build directory becomes more prominent again,
> which will bring out the same problems we had with qmake:
> People treating the build directory as if it was an installed instance
> of their software (wondering why files that need not be build are
> not in their places, etc.).

One major point of having a build subdir and having multiple builds in 
there is that you can build for multiple architectures and configuration
in parallel. To achieve this with the classical "one build dir per build
config" approach we would have to change the usage to something like
   qbs --project-file ~/dev/src/myproject.qbs --build-dir ~/dev/builds/myproject/debug --build-dir ~/dev/builds/myproject/release
or alike.
Now I can just say 
   qbs debug release
in the source directory. Every build is in the build subdir and doesn't 
interfere with other builds nor the source tree.
 

Cheers,

Jörg



More information about the Qbs mailing list