Qbs

Blog Documentation Get Qbs Community

Qbs 2.4.0 released

The Qbs build tool version 2.4.0 is available.

What’s new

The main feature in this release is the support for the Conan package manager. We’ve added the new conan module provider which creates Qbs modules from JSON files generated by Conan.

Conan Module provider

The Conan module provider requires the QbsDeps generator which is present in Conan 2.5.0. For each dependency specified in the conanfile, this generator creates a JSON file with the information required for the conan module provider. This information includes paths to libraries, include directories, build tools, compiler and linker flags. Conan module provider reads those files and converts them to Qbs modules.

Condider an example of an application that uses the zlib compression library:

CppApplication {
    Depends { name: "zlib" }
    qbsModuleProviders: "conan"
    consoleApplication: true
    files: "main.c"
}

In order to install and build an application, we would also need a conanfile.py:

from conan import ConanFile
from conan.tools.qbs import Qbs

class Recipe(ConanFile):
    name = "conan-zlib"
    version = "1.0"

    exports_sources = "*.c", "*.qbs",
    settings = "os", "compiler", "arch", "build_type"
    generators = ["QbsDeps"]

    def build(self):
        qbs = Qbs(self)
        qbs.resolve()
        qbs.build()

Now we can easily build the application using Conan:

$ conan create . --build=missing

Note that the new provider only works with Conan version 2.5.0 and above; for Conan version 1.x please use the ConanfileProbe.

For more details on the provider as well as how to use Conan only for installing dependencies, see the provider page in the documentation.

Other changes

  • We’ve added new FlatBuffers modules, for C and C++ languages. These modules require runtime dependencies that can be installed using Conan module provider (QBS-1666).
  • Rules trying to create artifacts outside the build directory is now a hard error (QBS-1268).
  • More details are now printed when a command times out (QBS-1750).
  • Updated the bundled quickjs library.
  • The pkg-config based fallback provider was removed. That provider was not flexible enough and didn’t give users control over providers priorities. Also, that provider created files even for non-present modules which also happens in case of misconfiguration. This was inconvenient since those files had to be cleaned up manually.
  • It is no longer allowed to attach a QML id to a module item. This feature violated various preconditions and triggered asserts in debug builds of Qbs. Please update you modules and remove usages of id property. You can replace it with the raw propertyName in module context, with parent.propertyName in module sub items, e.g. Probes or with product.yourModule.propertyName in Rules.

What’s next

Currently, we are working on even better Conan integration - the one thing that is still missing, is the generator that sets up Qbs settings and profiles based on Conan toolhain. Another big feature we are working on, is the support for C++20 modules. All basic cases are already working, but such a huge feature requires some additional changes in Qbs internals. Stay tuned!

Try it

Qbs is available for download on the download page.

Please report issues in our bug tracker.

Join our Discord server for live discussions.

You can use our mailing list for questions and discussions.

The documentation and wiki are also good places to get started.

Qbs is also available from a number of package repositories (Chocolatey, MacPorts, Homebrew) and is 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. Please find a complete overview on repology.org.

Qbs 2.4.0 is also included in Qt Creator 14.0.0.

Contribute

If You are a happy user of Qbs, please tell others about it. But maybe you would like to contribute something. Everything that makes Qbs better is highly appreciated. Contributions may consist of reporting bugs or fixing them right away. But also new features are very welcome. Your patches will be automatically sanity-checked, built and verified on Linux, macOS and Windows by our CI bot. Get started with instructions in the Qbs Wiki.

Thanks to everybody who made the 2.4 release happen:

  • Christian Kandeler
  • Ivan Komissarov
  • Kai Dohmen
  • Raphael Cotty