Multiplexing is an advanced Qbs feature that allows a product to be transparently built in multiple passes along with an optional, final aggregate pass that allows the output artifacts of the initial passes to be combined or otherwise operated on in some way.
The multiplexing feature is used to implement certain platform-specific behavior: specifically, it allows applications and libraries on Apple platforms to be compiled into fat binaries containing multiple CPU architectures, the creation of Apple frameworks containing multiple variants (for example, combined debug and release builds), and the creation of Android application and library packages containing native code built for multiple Android ABIs.
A product can be multiplexed over the qbs.architectures property (which maps to qbs.architecture), qbs.buildVariants property (which maps to qbs.buildVariant), and qbs.profiles (which maps to Project.profile).
For example, to build a "fat"
iOS binary containing two architectures, use the following command:
qbs build modules.qbs.targetPlatform:ios modules.qbs.architectures:arm64,armv7a
Note: The implementation details around multiplexing are subject to change.
Product multiplexing works by examining the Product.multiplexByQbsProperties property, which can be set to the list of properties your product should multiplex over. For example,
multiplexByQbsProperties might contain two strings,
"buildVariants". Qbs evaluates the values of
qbs.buildVariants, which in turn might contain the values
["x86", "x86_64"] and
["debug", "release"]. Qbs will build all the possible configurations of the product:
(x86_64, debug), and
If the Product.aggregate property is
true, the product will also be built a fifth time, with the values of the multiplexed properties left undefined. The aggregate product will have an automatic dependency on the original four instances of the product, allowing it to collect their output artifacts and to operate on them.
The aggregate product is used in situations where the target artifacts of the individually multiplexed instances must be combined into one final aggregate artifact that makes up the overall product. Bundle products on Apple platforms use the aggregate product to create the bundle artifacts (such as
PkgInfo) that are independent of a particular architecture or build variant. In addition, they use the
lipo tool to join together the built native code for different architectures (such as
x86_64) into the final, multi-architecture fat binary that the app bundle contains.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.