Christian Kandeler

qbs 1.12 released

Published Thursday July 19th, 2018
12 Comments on qbs 1.12 released
Posted in Announcements, Build system, cross-platform, Dev Loop, Releases

We are happy to announce version 1.12.0 of the Qbs build tool.

What’s new?

Generating Interfaces for Qbs and pkg-config

When distributing software components such as libraries, you’d like to make it as simple as possible for other projects to make use of them. To this end, we have added two new modules: The Exporter.qbs module creates a Qbs module from a product, while the Exporter.pkgconfig module generates a .pc file.

For example:

DynamicLibrary {
    name: "mylib"
    version: "1.0"
    Depends { name: "cpp" }
    Depends { name: "Exporter.qbs" }
    Depends { name: "Exporter.pkgconfig" }
    files: "mylib.cpp"
    Group { 
        fileTagsFilter: "dynamiclibrary"
        qbs.install: true
        qbs.installDir: "lib"
    }
    Group { 
        fileTagsFilter: "Exporter.qbs.module"
        qbs.installDir: "lib/qbs/modules/mylib" 
    }
    Group {
        fileTagsFilter: "Exporter.pkgconfig.pc"
        qbs.install: true
        qbs.installDir: "lib/pkgconfig"
    }
}

When building this project, a Qbs module file mylib.qbs and a pkg-config file mylib.pc will be generated. They contain the information that is necessary to build against this library using the respective tools. The mylib.qbs file might look like this (the concrete content depends on the target platform):

Module {
    Group {
        filesAreTargets: true
        fileTags: "dynamiclibrary"
        files: "../../../libmylib.so.1.0.0"
    }
}

As you can see, the library file is specified using relative paths in order to make the installation relocatable.

Now anyone who wants to make use of the mylib library in their Qbs project can simply do so by declaring a dependency on it: Depends { name: "mylib" }.

System-level Settings

Until now, Qbs settings were always per-user. However, some settings should be shared between all users, for instance global search paths. Therefore, Qbs now supports system-level settings as well. These are considered in addition to the user-level ones, which take precedence in the case of conflicts. System-level settings can be written using the new --system option of the qbs-config tool. This operation usually requires administrator rights.

Language Improvements

We have added a new property type varList for lists of objects. You could already have those by using var properties, but the new type has proper list semantics, that is, values from different modules accumulate.

The FileInfo extension has two new functions suffix and completeSuffix.

Two changes have been done to the Rule item:

C/C++ Support

The cLanguageVersion and cxxLanguageVersion properties are now arrays. If they contain more than one value, then the one corresponding to the highest version of the respective language standard is chosen. This allows different modules to declare different minimum requirements.

Autotest Support

The AutotestRunner item has a new property auxiliaryInputs that can help ensuring that additional resources needed for autotest execution (such as helper applications) are built before the autotests run.

The working directory of an autotest is now the directory in which the respective test executable is located or AutotestRunner.workingDirectory, if it is specified. In the future, it will also be possible to set this directory per test executable.

Various things

All command descriptions now list the product name to which the generated artifact belongs. This is particularly helpful for larger projects where several products contain files of the same name, or even use the same source file.

The vcs module no longer requires a repository to create the header file. If the project is not in a repository, then the VCS_REPO_STATE macro will evaluate to a placeholder string.

It is now possible to generate Makefiles from Qbs projects. While it is unlikely that complex Qbs projects are completely representable in the Makefile format, this feature might still be helpful for debugging purposes.

Try It!

The Open Source version is available on the download page, and you can find commercially licensed packages on the Qt Account Portal. Please post issues in our bug tracker. You can also find us on IRC in #qbs on chat.freenode.net, and on the mailing list. The documentation and wiki are also good places to get started.

Qbs is also available on a number of packaging systems (Chocolatey, MacPorts, Homebrew) and updated on each release by the Qbs development team. It can also be installed through the native package management system on a number of Linux distributions including but not limited to Debian, Ubuntu, Fedora, and Arch Linux.

Qbs 1.12.0 is also included in Qt Creator 4.7.0, which was released this week as well.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Announcements, Build system, cross-platform, Dev Loop, Releases

12 comments

Ilb says:

Thanks for those examples! Qbs is much easier than the rest;

QtUser says:

Well Done!
So, what about Android and iOS building?

Maxim B. says:

Is Android deployment (deploy/run) still not available for Qbs projects in QtCreator 4.7?

Christian Kandeler Christian Kandeler says:

Qt Creator’s Android and iOS support have been qmake-only from the start. The problem is being recognized, but will still need some time to fix.

Benoît Gradit says:

What is the current status on that topic ? Can we help in any way on it ?

BogDan says:

Qt for Android support has nothing to do with QtCreator integration. 🙂
Basically QBS it’s missing a way to compile Qt’s java wrapper and copy Qt libs into .apk (what androiddeployqt does for qmake).

DISCLAIMER: I’m the Android platform maintainer.

Aleksey says:

Is it possible to build QtC with qbs already?

Christian Kandeler Christian Kandeler says:

If by “QtC” you mean “Qt Creator”, then yes, that has been possible for years now.

Jakub Narolewski says:

Awesome.

I must say I’m really impressed with flexibility of Qbs. I’m using it to build my multiplatform game server and writing nonstandard, complicated build steps is very easy.

Good job!

tr3w says:

Like the Exporter modules, it would be nice to have an Exporter.cmakeconfig.
And it would be nice to have a simple way to import .cmake configs or convert them to qbs modules.
Obviously I don’t expect a full CMake interpereter, but interpreting/converting the simplest autogerated .config-s should be possible…

Christian Kandeler Christian Kandeler says:

Exporting to cmake is tracked here: https://bugreports.qt.io/browse/QBS-1233. Importing is currently not on the agenda.

Alexey says:

Can i build my app for iOs and Android? As i know, qbs in QtCreator does not support it yet.

Commenting closed.

Get started today with Qt Download now