qbs QML Type
Comprises general properties. More...
Import Statement: | import QbsModules . |
Since: | Qbs 1.0 |
Properties
- architecture : string
- architectures : stringList
- buildVariant : string
- buildVariants : stringList
- configurationName : string
- debugInformation : bool
- enableDebugCode : bool
- hostOS : stringList
- hostOSBuildVersion : string
- hostOSVersion : string
- hostOSVersionMajor : int
- hostOSVersionMinor : int
- hostOSVersionParts : list
- hostOSVersionPatch : int
- hostPlatform : string
- install : bool
- installDir : string
- installPrefix : string
- installRoot : string
- installSourceBase : string
- nullDevice : string
- optimization : string
- pathListSeparator : string
- profiles : stringList
- shellPath : path
- sysroot : string
- targetOS : stringList
- targetPlatform : stringList
- toolchain : stringList
- toolchainType : string
- version : string
- versionMajor : int
- versionMinor : int
- versionPatch : int
Detailed Description
The qbs
module is implicitly loaded in every product. It contains properties of the current build environment, independent of the used programming languages and toolchains.
Installation Properties
Typically, you use Group items to specify the target directories for installing files. To install a group of files, set the qbs.install property of the Group to true
. The value of qbs.installDir specifies the path to the directory where the files will be installed. You can specify a base directory for all installation directories as the value of qbs.installPrefix.
For example, the following properties specify where a set of QML files and an application executable are installed on Windows and Linux:
Application { name: "myapp" Group { name: "Runtime resources" files: "*.qml" qbs.install: true qbs.installDir: condition: qbs.targetOS.contains("unix") ? "share/myapp" : "resources" } Group { name: "The App itself" fileTagsFilter: "application" qbs.install: true qbs.installDir: "bin" } qbs.installPrefix: condition: qbs.targetOS.contains("unix") ? "usr/local" : "MyApp" }
On Windows, the QML files will ultimately get installed in MyApp\resources
and the application executable in MyApp\bin
, for instance under C:\Program Files
. On Linux, the QML files will be installed in /usr/local/share/myapp
and the executable in /usr/local/bin
.
By default, qbs.installRoot creates the install-root
directory in the build directory for packaging the binaries before installation. It is a temporary directory that is usually not available when the application is run, and it should therefore not be set in the project files. You can override the default value from the command line, as described in Installing Files.
Multiplexing Properties
The following properties are specific to product multiplexing:
Property Documentation
The target platform's processor architecture.
undefined
indicates that the target platform is architecture-independent (for example the CLR or JVM).
This property is typically set in a profile.
Commonly used values are: "x86"
, "x86_64"
, and "arm"
.
Default: Undefined
The architectures the product will be built for.
Default: ["armv5te"]
on Android, same as Xcode on Apple platforms, otherwise equivalent to [qbs.architecture].
This property was introduced in Qbs 1.9.
The build variants the product will be built for.
Default: Equivalent to [qbs.buildVariant].
This property was introduced in Qbs 1.9.
The name of the current build configuration.
Default: "default"
This property was introduced in Qbs 1.6.
Whether to generate debug information.
Default: true
for debug builds, false
otherwise.
Whether to compile debug code in the product.
Typically, this property is enabled for debug builds and disabled for release builds.
Default: true
for debug builds, false
otherwise.
This property is set by Qbs internally and specifies the OS Qbs is running on.
The possible values for this property are the values of targetOS, even though some of them may not be supported.
Default: Undefined
The host operating system's build version. Currently, only defined for Windows and Apple platforms.
On Windows, this is the 4 or 5 digit Windows build number and is equivalent to versionPatch. On Apple platforms, this is a standard build number in the Apple versioning scheme. For example, "13C64"
.
Default: Undefined
This property was introduced in Qbs 1.2.
The host operating system version. Currently, only defined for Windows and Apple platforms.
Consists of two or three numbers separated by dots. For example, "10.9"
or "6.3.9600"
.
Default: Undefined
This property was introduced in Qbs 1.2.
The host operating system major version.
Default: hostOSVersionParts[0]
This property was introduced in Qbs 1.2.
The host operating system minor version.
Default: hostOSVersionParts[1]
This property was introduced in Qbs 1.2.
The host operating system version as a list.
For example, Windows 8.1 (version 6.3.9600) would correspond to a value of [6, 3, 9600]
.
Default: []
This property was introduced in Qbs 1.2.
The host operating system patch level.
Default: hostOSVersionParts[2]
This property was introduced in Qbs 1.2.
Do not use this property.
Default: Determined automatically.
This property was introduced in Qbs 1.11.
Whether to install a certain set of files.
This property is typically set in a Group item to mark a number of files as installable.
Note: Artifacts for which this property is enabled automatically receive the file tag "installable"
. This is useful for writing packaging-related rules.
Default: false
The installation directory for the files of a product or a Group.
The value of this property is a path that is relative to installPrefix.
Default: Undefined
The global installation prefix. It is implicitly prepended to all values of installDir.
The value of this property itself is relative to the installRoot in the context of installation.
Default: []
This property was introduced in Qbs 1.1.
The global installation root. It is implicitly prepended to all values of installPrefix in the context of installation.
Note: This property is fundamentally different from installDir and installPrefix in that it must not be visible to the code being built. In fact, the install root is often just a temporary location used to package the binaries, which should therefore not assume they will be in that location at run-time. For the same reason, this property is usually not set from within project files.
Default: <build dir>/install-root
This property was introduced in Qbs 1.4.
The base directory of the local files that are going to be installed. The source base directory is omitted from the target directory path specified in installDir.
Default: The directory of the current file to be installed, relative to the product's source directory.
This property was introduced in Qbs 1.4.
The platform-specific file path corresponding to the null device.
Default: "NUL"
on Windows, "/dev/null"
on Unix.
This property was introduced in Qbs 1.4.2.
The general type of optimization that should be performed by all toolchains.
Allowed values are:
"fast"
"none"
"small"
Default: "none"
for debug builds, "fast"
for release builds.
The platform-specific separator for a path list that is used in environment variables or other contexts.
Default: ";"
on Windows, ":"
on Unix.
The profiles for which the product should be built.
For each profile listed here, one instance of the product will be built according to the properties set in the respective profile.
Default: [project.profile]
This property was introduced in Qbs 1.9.
The platform-specific file path corresponding to the command line interpreter.
On Windows, this is the path to cmd.exe
, which is held in the COMSPEC
environment variable (typically, C:/Windows/System32/cmd.exe
), On Unix-like platforms, this is /bin/sh
.
Default: "%COMSPEC%"
on Windows, "/bin/sh"
on Unix
This property was introduced in Qbs 1.5.
The sysroot
of the target platform.
This property is typically set in a profile for cross-compiling.
Default: Undefined
Specifies the OS you want to build the project for.
Use this property to test for a particular OS or OS family in conditionals. Do not use targetPlatform for this purpose.
Possible values include one or more of "bsd"
, "darwin"
, and "unix"
, in addition to the possible values of targetPlatform.
Default: Undefined
The OS you want to build the project for.
This property is typically set in a profile or for a particular product where the target OS is always known (such as an Apple Watch app written in native code).
You should generally treat this property as write-only and avoid using it to test for the current target OS. Instead, use the targetOS property for conditionals. For example, instead of:
qbs.targetPlatform === "macos" || qbs.targetPlatform === "ios" || qbs.targetPlatform === "tvos" || qbs.targetPlatform === "watchos"
use
qbs.targetOS.contains("darwin")
However, in some cases using targetPlatform
would be acceptable, such as when the resulting condition would be simpler while still being correct:
qbs.targetPlatform === "linux"
versus
qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android")
The possible values include one or more of the following:
"aix"
"android"
"freebsd"
"haiku"
"hpux"
"hurd"
"integrity"
"ios"
"ios-simulator"
"linux"
"lynx"
"macos"
"netbsd"
"openbsd"
"qnx"
"solaris"
"tvos"
"tvos-simulator"
"vxworks"
"watchos"
"watchos-simulator"
"windows"
Default: Undefined
This property was introduced in Qt 1.11.
The attributes of the toolchain that is going to be used for this build.
Typical values include "llvm"
, in addition to the possible values of toolchainType.
Default: Undefined
The toolchain that is going to be used for this build.
You should generally treat this property as write-only and avoid using it to test for the current toolchain. Instead, use the toolchain property for conditionals.
For example, instead of:
(qbs.toolchainType === "xcode" || qbs.toolchainType === "clang" || qbs.toolchainType === "gcc")
use:
qbs.toolchain.contains("gcc")
However, there are some cases when using toolchainType
would be acceptable, such as when the resulting condition would be simpler while still being correct:
(qbs.toolchainType === "gcc")
versus:
(qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang"))
Typical values include: "gcc"
, "clang"
, "mingw"
, "msvc"
, and "xcode"
.
Default: Determined automatically.
This property was introduced in Qbs 1.11.
The version number of Qbs as a string. For example, "1.4.1"
.
This property was introduced in Qbs 1.4.1.
The major version number of Qbs.
This property was introduced in Qbs 1.4.1.
The minor version number of Qbs.
This property was introduced in Qbs 1.4.1.
The patch version number of Qbs.
This property was introduced in Qbs 1.4.1.