Qbs 1.8 released

May 29, 2017 Jake Petroules

Qbs (pronounced “Cubes”) is The Qt Company’s latest build tool, which is planned to be the replacement for qmake in the Qt 6 build system. In addition to its use within Qt, for our customers Qbs will also provide faster build times coupled with a rich feature set in order to reduce build engineering complexity and decrease time to market.

Today, we’re pleased to announce the release of Qbs 1.8! This is primarily a stability-focused release which paves the way for some powerful new features coming in a few months with 1.9.

What’s new?

In addition to the usual bug fixes and performance enhancements, this release provides the following new features:

New Platforms and Toolchains

Qbs now has initial support for building applications for the QNX real-time operating system. We support several versions of the official QNX SDK: SDP 6.5, SDP 6.6, and the recently released SDP 7.0 with support for development on macOS. We may also extend support to additional toolchains in the future, like Intel ICC.

There is also basic support for building FreeBSD applications. While it has always been possible to build for FreeBSD, it is now a recognized target and therefore projects targeting that platform build without any additional environment configuration.

Android Support

Single-architecture Android builds are now handled more gracefully. This means Qbs will be usable in Qt Creator when building for Android, and dependencies on Qt modules should work too. This moves us closer to functional Android support, although there are still many tasks left to do, including support for Clang/LLVM from the Android NDK.

Language Improvements

A new syntax for accessing module properties in JavaScript extensions has been introduced. You can now use the syntax product.modulename.propertyname to access a module property of a product or artifact, so that you get consistent property access syntax between Qbs files and JavaScript files. For example, product.moduleProperty("cpp", "compilerFlags") should now be written as product.cpp.compilerFlags. For module authors, note that the module object might be undefined if the module is not loaded in the given product’s context, so you should check that it is a truthy value before using it (for example: !!product.cpp). Note that the old moduleProperty() function will still be available but its use is discouraged.

Read-only properties are now supported. Declaring a property with the readonly modifier will now cause an error to be emitted if an attempt is made to set a value on it.

Probe items are now allowed within Project items, which should allow more logical project structures for Probes that really aren’t dependent on a particular product’s context.

The loadFile() and loadExtension() function have been replaced by require() and will be deprecated in a future release.

Profiles

Qbs can now be run without a profile. This is a small but enabling change which follows from our new strategy that favors automatic detection and Probes over the use of pre-created profiles in order to push an “it just works” experience. This change makes it easier for new users to get started with Qbs, while also making development environment maintenance easier by reducing reliance on external data that requires manual setup and is likely to become outdated over time. You can of course continue to use profiles just like before, however invoking ‘qbs’ from the command line will now automatically build for the current host platform using the best available toolchain and settings unless a default profile is set. You can also explicitly use the “null” profile by specifying profile:none on the command line.

Currently this has no effect on how projects are built in Qt Creator; Qbs projects in the IDE always use an automatically generated profile which sets a minimal set of properties corresponding to the selected kit.

Other new features

  • Added a new qbs-create-project tool which can help to automatically generate qbs project files from an arbitrary directory structure. This can be a useful starting point when migrating from other build tools such as qmake or CMake.
  • The means to easily combine source files for the C language family in order to support “amalgamation builds”.
  • qbs-setup-toolchains adds support for Visual C++ Build Tools.
  • Better line and column information in error reporting.
  • PkgConfigProbe now provides a higher level API by parsing the raw compiler and linker flags output from pkg-config. There are new properties individually listing the preprocessor defines, include paths, compiler flags, and so on.
  • Fixes to change tracking and general handling of manifests in the Java module.
  • It should now be possible to build qbs itself statically, as the scanner plugins have been fixed to be compatible with static builds.

That’s all for now. The Xcode generator was unfortunately delayed again and thefore is not present in 1.8, but 1.9 will be quite a monumental release bringing some very significant new features around multiplexing and dependency handling. Stay tuned!

Breaking Changes

There are a few breaking changes of note in this release:

First, the cpp.linkerFlags property no longer accepts pre-escaped values. That is, you should not escape linker flags passed to the cpp.linkerFlags property with the -Wl, or -Xlinker escape sequences, as Qbs will automatically apply them based on whether the linker in use is the compiler driver (like clang++ or g++) or the system linker (like ld). This has generated a warning for the past couple of releases and we encourage you to migrate your build scripts if you haven’t already, as using -Wl, or -Xlinker in cpp.linkerFlags will now lead to a double-escape and a linker error.

Second, all files that are part of a bundle on Apple platforms like macOS and iOS are now tagged with “bundle.content”. If you want to install the files that constitute a bundle, this is the one and only tag that your installation Group’s fileTagsFilter should reference. Previous methods of installing bundles based on the file tags of the individual files that constitute them are not guaranteed to work.

Last, the base directory for source files has changed from the product source directory to the parent directory of the file where the files are listed. The old behavior was unintuitive and usually not what users want when groups are pulled in from other files such as modules.

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 great 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, and Arch Linux.

Qbs 1.8 is also included in Qt Creator 4.3, which was released earlier this week.

The post Qbs 1.8 released appeared first on Qt Blog.

Previous
Qt Lite in Qt 5.9 LTS
Qt Lite in Qt 5.9 LTS

Qt Lite has been our project name for multiple efforts done to approach to a more scalable Qt version. We i...

Next Article
Device detection in Qt for Device Creation 5.9
Device detection in Qt for Device Creation 5.9

Qt for Device Creation provides ready disk images for a variety of devices. When you flash it to a device, ...