diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2020-02-14 23:42:15 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-02-21 10:30:12 +0000 |
commit | 8c300ef4c78e8bd759e0b6f0cabe07cb12c708e3 (patch) | |
tree | 6acf6c9a557777d0ce95a05a8c7e6ac5f9e18d3e /doc | |
parent | ff53ff1fda2689e71b9d0d8ec73e55f414a78f79 (diff) |
doc: More info about qbs.toolchainType and qbs.toolchain properties
Change-Id: I76b711aa16827e44eabea44113853ac3ee4e67e2
Reviewed-by: Richard Weickelt <richard@weickelt.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/reference/modules/qbs-module.qdoc | 134 |
1 files changed, 106 insertions, 28 deletions
diff --git a/doc/reference/modules/qbs-module.qdoc b/doc/reference/modules/qbs-module.qdoc index 1fdfe6f7c..dfc53c63d 100644 --- a/doc/reference/modules/qbs-module.qdoc +++ b/doc/reference/modules/qbs-module.qdoc @@ -295,16 +295,30 @@ */ /*! - \qmlproperty string qbs::toolchainType - \since Qbs 1.11 + \qmlproperty stringList qbs::toolchain - The toolchain that is going to be used for this build. + Contains the list of string values describing the toolchain and toolchain + family that is used to build a project. - You should generally treat this property as \e{write-only} and avoid using - it to test for the current toolchain. Instead, use the \l{qbs::}{toolchain} - property for conditionals. + This property is deduced from the \l{qbs::}{toolchainType} property and is typically + used to test for a particular toolchain or toolchain family in conditionals: - For example, instead of: + \code + Properties { + // flags for GCC + condition: qbs.toolchain.contains("gcc") + cpp.commonCompilerFlags: ... + } + Properties { + // flags for MSVC + condition: qbs.toolchain.contains("msvc") + cpp.commonCompilerFlags: ... + } + \endcode + + Unlike \l{qbs::}{toolchainType}, which contains a single value, \c qbs.toolchain + is a string list which also contains the toolchain family. This allows to make + conditions and checks simpler. For example, instead of: \code (qbs.toolchainType === "xcode" || qbs.toolchainType === "clang" || qbs.toolchainType === "gcc") @@ -316,22 +330,97 @@ qbs.toolchain.contains("gcc") \endcode - However, there are some cases when using \c toolchainType would be - acceptable, such as when the resulting condition would be simpler while - still being correct: + since XCode, GCC and Clang belong to the \c "gcc" family. - \code - (qbs.toolchainType === "gcc") - \endcode + \section2 Relation between toolchainType and toolchain + + This table describes the possible values and matching between the \l{qbs::}{toolchainType} + and the \c toolchain properties: + \table + \header + \li Toolchain Type + \li Toolchain + \row + \li \c{"clang"} + \li \c{["clang", "llvm", "gcc"]} + \row + \li \c{"clang-cl"} + \li \c{["clang-cl", "msvc"]} + \row + \li \c{"gcc"} + \li \c{["gcc"]} + \row + \li \c{"iar"} + \li \c{["iar"]} + \row + \li \c{"keil"} + \li \c{["keil"]} + \row + \li \c{"llvm"} + \li \c{["llvm", "gcc"]} + \row + \li \c{"mingw"} + \li \c{["mingw", "gcc"]} + \row + \li \c{"msvc"} + \li \c{["msvc"]} + \row + \li \c{"sdcc"} + \li \c{["sdcc"]} + \row + \li \c{"xcode"} + \li \c{["xcode", "clang", "llvm", "gcc"]} + \endtable + + \nodefaultvalue +*/ + +/*! + \qmlproperty string qbs::toolchainType + \since Qbs 1.11 - versus: + The toolchain that is going to be used for this build. + For example, to build a project using the \c "clang" toolchain, simply do \code - (qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("clang")) + qbs build qbs.toolchainType:clang \endcode - Typical values include: \c{"gcc"}, \c{"clang"}, \c{"mingw"}, \c{"msvc"}, and - \c{"xcode"}. + You should generally treat this property as \e{write-only} and avoid using + it to test for the current toolchain. Instead, use the \l{qbs::}{toolchain} + property for conditionals. + + Typical values include: \c{"gcc"}, \c{"clang"}, \c{"clang-cl"}, \c{"mingw"}, + \c{"msvc"}, and \c{"xcode"}. Also see \l{Relation between toolchainType and toolchain}. + + By default, \c qbs.toolchainType is automatically detected based on the + \l{qbs::}{targetOS} property: + \table + \header + \li Target OS + \li Toolchain + \row + \li \c{"darwin"} + \li \c{"xcode"} + \row + \li \c{"freebsd"} + \li \c{"clang"} + \row + \li \c{"haiku"} + \li \c{"gcc"} + \row + \li \c{"qnx"} + \li \c{"qcc"} + \row + \li \c{"unix"} + \li \c{"gcc"} + \row + \li \c{"vxworks"} + \li \c{"gcc"} + \row + \li \c{"windows"} + \li \c{"msvc"} + \endtable \defaultvalue Determined automatically. */ @@ -529,17 +618,6 @@ */ /*! - \qmlproperty stringList qbs::toolchain - - The attributes of the toolchain that is going to be used for this build. - - Typical values include \c{"llvm"}, in addition to the possible values of - \l{qbs::}{toolchainType}. - - \nodefaultvalue -*/ - -/*! \qmlproperty string qbs::version \readonly \since Qbs 1.4.1 |