Jake Petroules

Qbs 1.7 released

Published Tuesday January 31st, 2017
20 Comments on Qbs 1.7 released
Posted in Announcements, Build system, Dev Loop, Releases

We are delighted to announce the release of Qbs 1.7 “Technical Ecstasy”!

While Qbs 1.7.0 was actually released back in mid-December, we decided to postpone the announcement until after last week’s 1.7.1 patch release in order to get in a few more bug fixes.

What’s new?

In addition to lots of bugfixes and smaller improvements, as well as some significant performance enhancements, this release also brings a number of new features. Let’s start with the largest and most interesting:

Generators

Generators are a major new feature in Qbs 1.7 that enables deep integration with your favorite third-party development tools.

The Generators API is designed to be very generic. It provides a means for developers to create “plugins” that perform arbitrary processing on the build graph. So, far we’ve used this to create several generators which output Xcode* and Visual Studio project files. This allows you to develop your projects in your favorite IDE, while still retaining the full power and expressibility of the Qbs build engine.

We’ve also received a community contribution that outputs a Clang compilation database file. This allows Clang-based tools to scan the sources exactly like the compiler, independently of the build system. We’re excited to see what other generators the community might come up with.

To get started with generators, try the qbs generate command on your project. The generators documentation will be available in the manual in a future release.

Note that the generators features are still very experimental. We will greatly appreciate your feedback in this area.

the Xcode generator is scheduled for release in Qbs 1.8

Other new features

  • Group items can now be nested. This allows Groups to be structured more naturally, as a Group’s condition property is logically ANDed with its parent’s. It also makes Groups more useful when placed into dedicated files as the inherited QML-like syntax requires a root element.
  • qrc files can be automatically generated from your project file, obviating the need to manually maintain multiple identical file lists. This functionality is part of the Qt.core module and introduces a couple of new properties which allow you to control how files in your project should be automatically added to a generated qrc file.
  • There is now much more complete documentation on Rule authoring. This has been one of our biggest requests in the documentation area.
  • Stricter type checking for properties in Qbs project files, which should help make certain syntax errors much clearer.
  • Microsoft Visual Studio 2017 support in the C/C++ module.
  • QtScxml support in the Qt modules.
  • Support for building Inno Setup installers.

One last thing worth mentioning is that the Open Source C++ package manager Conan has added support for Qbs. We believe integrations like this which make it easier to integrate third-party content with your projects are a great ecosystem boon.

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 on #qt-qbs on chat.freenode.net, and on the mailing list. The documentation and wiki are also great places to get started.

Qbs is also available on most major 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, and Arch Linux.

Qbs 1.7.1 is also included in Qt Creator 4.2.1, which was released last week.

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

Posted in Announcements, Build system, Dev Loop, Releases

20 comments

Zack says:

How does the Visual Studio integration work? Any limitation?
Is it the same principal like CMake does?

Jake Petroules Jake Petroules says:

Yes, the Visual Studio integration works in a similar way to CMake – you provide Qbs project files and then run qbs generate to create a .sln file and a series of .vcxproj files which you can then build in Visual Studio.

As far as limitations, there’s always going to be *some* degree of limitation when translating from one build system to another — whether it’s Qbs, CMake, or any other build tool. However, nothing in particular stands out to me; is there anything you had in mind?

Note that one interesting aspect of qbs’s generator is that you can actually generate a single solution for both debug and release builds, something that CMake cannot do as far as I am aware.

Zack says:

In CMake you have for a VS Solution:
* Debug
* MinSizeRel
* RelWithDebInfo
* Release
However, what is not possible is, that you can mix win32/x64 in one solution and its AFAIK not possible to have other configs then the one mentioned above.

However, I will give it a try, this was the biggest downside from stop using qbs because of lack support for VS. I will give it a try.

Jake Petroules Jake Petroules says:

Ah, I didn’t realize CMake supports multi-config. But unlike CMake, qbs is not limited to a specific set of configurations; you can specify as many as you want, with completely arbitrary names.

Mixing 32-bit and 64-bit products in a single project is supported by qbs; for the Visual Studio generator the Platform (architecture) is set per target rather than for the solution as a whole so this should already work, though I don’t think I personally tested this case yet. Let me know if you run into any issues doing that.

LukasT says:

Note that one interesting aspect of qbs’s generator is that you can actually generate a single solution for both debug and release builds, something that CMake cannot do as far as I am aware.

Nope, cmake can does that by default.

Alex says:

Keep in mind that the build process is done by qbs itself, not by Visual Studio (Visual Studio calls qbs).
So far it works fine for me. Thanks for developers!

David says:

I am using Qt Creator, but when I want to create a new project I do not see the option for using Qbs, it seems to default to qmake.

Jake Petroules Jake Petroules says:

Not all of the new project templates support Qbs yet; this is a known issue that we plan to correct. Please try the “Plain C Application” or “Plain C++ Application” new project templates for now.

Michael says:

Wanted to give it a try under QtCreator. Used the new project wizard to create a “Plain C++ Application”. After creation the “Projects” tree view has no context menu option to add new or existing source files. Why?

So I used the “File”->”New File or Project…” approach. Via this I could add a class to the qbs file automatically.
However, the “usual” organization in “Headers” and “Sources” is missing. All file are put into the same level in the “Project” tree view…

In the documentation I somehow could not find an example that consists of a typical: main.cpp with some sources for self defined classes: classA.h, classA.cpp, …
How about a more elaborate example qbs-file for a “common” C++ application?
Did I miss it? Could you be so nice and point to one?

In Makefile I have to give dependencies. How does qbs take care? Is there a treeview that I can have a look into, what build dependencies are there?

Is there an Example in QtCreator? Tried “qbs” in the search bar … nada….

It looks like qbs wants to stay a secret weapon for experts!?

Jake Petroules Jake Petroules says:

As far as adding new files to your project, you’re probably just clicking on the wrong node. When you create a new project, the Projects tree in Qt Creator should look something like this:

newproject

newproject.qbs
newproject <= right click THIS node to add new files

newproject.qbs:3
Generated files
main.cpp

Qbs files

You want to click one of the Group nodes to add a file to that Group (the one with the gear icon), not the top-level node with the Qt icon.

The reason that Headers and Sources is missing is because Qbs gives you full control over folder names. For example, if you want to have Headers and Sources groups, your project file might look something like this:

Product {
...
Group {
name: "Headers"
files: ["myclass.h"]
}
Group {
name: "Sources"
files: ["myclass.cpp"]
}
}

Qbs is a vastly different system in terms of how it handles dependencies compared to Makefiles. It’s too much to cover in a single comment but I suggest you start by reading the Language Introduction section of the Qbs manual (https://doc.qt.io/qbs/language-introduction.html) to get a better idea of how all the different pieces fit together.

There’s no tree view in Qt Creator to show qbs’s build dependency tree, but on the command line you can run “qbs dump-nodes-tree” after performing a build, which will display a fairly detailed output of your project’s dependency tree.

There’s no examples in Qt Creator currently, but in the qbs source code we have a few sample projects: https://github.com/qt-labs/qbs/tree/master/examples

We definitely don’t want qbs to stay a secret weapon for experts. We want it to become THE secret weapon for everyone. Your feedback is greatly appreciated and we want to do everything we can to make the getting started experience easier as it’s one of the most critical aspects of ensuring a new product’s success.

Tonda says:

Can something like unity build be achieved in qbs (merge and compile several cpp files, to speed up the compilation/link times)?

Jake Petroules Jake Petroules says:

Not currently but that’s something we could easily add.

Christian Kandeler says:

This will be supported in 1.8: https://codereview.qt-project.org/#/c/183697/

Shawn Rutledge Shawn Rutledge says:

On Arch Linux, the qbs AUR package conflicts with qtcreator. Why is that?

Christian Kandeler says:

We include qbs in our Qt Creator packages, and so do distributions.

Jake Petroules Jake Petroules says:

I maintain the qbs package; the qtcreator one should get a dependency on it. If you can help make that happen, that would be great.

Asti says:

I have a solution with ca. 100 referenced projects (10 qt projects, 90 simple c console apps).
This compiles fast with qt-creator with qbs. But converted to Visual Studio 2013 Solution it compiles very slow, because each subproject calls qbs again. Is there a possibility to make this faster?

Jake Petroules Jake Petroules says:

Currently you can disable qbs from writing dependency specifications into the NMake projects. Since qbs handles dependencies itself anyways, it shouldn’t make a practical difference other than being unable to view product dependencies in the VS GUI. A long term idea to resolve this issue though, is to implement some sort of daemon mode; see https://bugreports.qt.io/browse/QBS-1086

Asti says:

Can you give me a hint how to do that?: “you can disable qbs from writing dependency specifications”

Jake Petroules Jake Petroules says:

I don’t have my Windows machine with me at the moment to double-check, but I believe you should be able to just comment out this statement: https://github.com/qt-labs/qbs/blob/v1.7.1/src/lib/corelib/generators/visualstudio/visualstudiogenerator.cpp#L134

Commenting closed.

Get started today with Qt Download now