diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-09-26 14:53:18 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-09-26 15:00:16 +0200 |
commit | fd88c40291275032f730693facee6f7758bf5992 (patch) | |
tree | 55269b9ab504ae7b7835232dd67aef1ce1deffea | |
parent | e86375117120f8c7b06afa573d9772d3c783f737 (diff) | |
parent | 94fe404a5a6d7cf91926bcfbd026953994b25815 (diff) |
Merge 1.14 into master
Change-Id: Ie432987ee2d3ccaa6e881b1b01f142185eddabd8
-rw-r--r-- | doc/external-resources.qdoc | 9 | ||||
-rw-r--r-- | doc/howtos.qdoc | 24 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/setup-qt.js | 2 | ||||
-rw-r--r-- | share/qbs/modules/xcode/xcode.js | 3 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/sdccprobe.cpp | 60 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/sdccprobe.h | 14 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/rulenode.cpp | 2 | ||||
-rw-r--r-- | src/lib/corelib/tools/joblimits.cpp | 2 |
8 files changed, 94 insertions, 22 deletions
diff --git a/doc/external-resources.qdoc b/doc/external-resources.qdoc index c66d9633c..00b7bf975 100644 --- a/doc/external-resources.qdoc +++ b/doc/external-resources.qdoc @@ -126,3 +126,12 @@ \internal */ +/*! + \externalpage https://ccache.samba.org/ + \title ccache +*/ + +/*! + \externalpage https://ccache.samba.org/manual.html#_precompiled_headers + \title ccache documentation about precompiled headers +*/ diff --git a/doc/howtos.qdoc b/doc/howtos.qdoc index a2595cffd..f394719e0 100644 --- a/doc/howtos.qdoc +++ b/doc/howtos.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. @@ -40,6 +40,7 @@ \li \l{How do I use precompiled headers?} \li \l{How do I make sure my generated sources are getting compiled?} \li \l{How do I run my autotests?} + \li \l{How do I use ccache?} \li \l{How do I create a module for a third-party library?} \li \l{How do I build against libraries that provide pkg-config files?} \li \l{How do I create application bundles and frameworks on iOS, macOS, tvOS, and watchOS?} @@ -215,6 +216,27 @@ \endcode See the \l{AutotestRunner}{AutotestRunner documentation} for how to fine-tune the behavior. + \section1 How do I use ccache? + + \l ccache is a popular C/C++ compiler cache on Unix to speed up compiling the + same content multiple times. + + \QBS excels at tracking dependencies and avoiding needless recompilations, so + for linear development of one project and configuration using ccache + has little benefit. But if you switch between revisions of a project, + or build the same project with different configurations, a global cache like + ccache can speed up compilations significantly. + + ccache can be used by setting up symbolic links to compiler executables + (such as \c g++, \c gcc) in the file system. In this setup, the use of ccache is + transparent to \QBS. If you prefer to call ccache explicitly, you should + set \l{cpp::compilerWrapper}{cpp.compilerWrapper} to \c ccache. + + \note Using precompiled headers might prevent ccache from actually + using cached results. To work around this, you can set + \c{sloppiness=pch_defines,time_macros} in your local ccache options. + See the \l{ccache documentation about precompiled headers} for further details. + \section1 How do I create a module for a third-party library? If you have pre-built binary files in your source tree, you can create diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index 0ee9db58f..3ddc214d3 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -686,7 +686,7 @@ function doSetupLibraries(modInfo, qtProps, debugBuild, nonExistingPrlFiles) { modInfo.config = splitNonEmpty(line.slice(equalsOffset + 1).trim(), ' '); continue; } - if (!line.startsWith("QMAKE_PRL_LIBS")) + if (!line.startsWith("QMAKE_PRL_LIBS =")) continue; var parts = extractPaths(line.slice(equalsOffset + 1).trim(), prlFilePath); diff --git a/share/qbs/modules/xcode/xcode.js b/share/qbs/modules/xcode/xcode.js index 82f7eecb3..bda41ade9 100644 --- a/share/qbs/modules/xcode/xcode.js +++ b/share/qbs/modules/xcode/xcode.js @@ -102,6 +102,9 @@ function sdkInfoList(sdksPath) { if (!sdks[i].match(/[0-9]+/)) continue; + if (sdks[i].startsWith("DriverKit")) + continue; + var settingsPlist = FileInfo.joinPaths(sdksPath, sdks[i], "SDKSettings.plist"); var propertyList = new PropertyList(); try { diff --git a/src/app/qbs-setup-toolchains/sdccprobe.cpp b/src/app/qbs-setup-toolchains/sdccprobe.cpp index e916a405b..eccd3ccae 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.cpp +++ b/src/app/qbs-setup-toolchains/sdccprobe.cpp @@ -192,26 +192,50 @@ static std::vector<ToolchainInstallInfo> installedSdccsFromRegistry() std::vector<ToolchainInstallInfo> infos; if (HostOsInfo::isWindowsHost()) { - -#ifdef Q_OS_WIN64 - static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\SDCC"; -#else - static const char kRegistryNode[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\SDCC"; -#endif - - QSettings registry(QLatin1String(kRegistryNode), QSettings::NativeFormat); - QString rootPath = registry.value(QStringLiteral("Default")).toString(); - if (!rootPath.isEmpty()) { + // Tries to detect the candidate from the 32-bit + // or 64-bit system registry format. + auto probeSdccToolchainInfo = [](QSettings::Format format) { + SdccInstallInfo info; + QSettings registry(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\SDCC"), + format); + const QString rootPath = registry.value(QStringLiteral("Default")) + .toString(); + if (rootPath.isEmpty()) + return info; // Build full compiler path. const QFileInfo sdccPath(rootPath + QLatin1String("\\bin\\sdcc.exe")); - if (sdccPath.exists()) { - // Build compiler version. - const QString version = QStringLiteral("%1.%2.%3").arg( - registry.value(QStringLiteral("VersionMajor")).toString(), - registry.value(QStringLiteral("VersionMinor")).toString(), - registry.value(QStringLiteral("VersionRevision")).toString()); - infos.push_back({sdccPath, Version::fromString(version)}); - } + if (!sdccPath.exists()) + return info; + info.compilerPath = sdccPath.filePath(); + // Build compiler version. + const QString version = QStringLiteral("%1.%2.%3").arg( + registry.value(QStringLiteral("VersionMajor")).toString(), + registry.value(QStringLiteral("VersionMinor")).toString(), + registry.value(QStringLiteral("VersionRevision")).toString()); + info.version = version; + return info; + }; + + static constexpr QSettings::Format allowedFormats[] = { + QSettings::NativeFormat, +#ifdef Q_OS_WIN + QSettings::Registry32Format, + QSettings::Registry64Format, +#endif + }; + + for (const QSettings::Format format : allowedFormats) { + const SdccInstallInfo candidate = probeSdccToolchainInfo(format); + if (candidate.compilerPath.isEmpty()) + continue; + const auto infosEnd = infos.cend(); + const auto infosIt = std::find_if(infos.cbegin(), infosEnd, + [candidate](const ToolchainInstallInfo &info) { + return candidate == SdccInstallInfo{ + info.compilerPath.filePath(), info.compilerVersion.toString()}; + }); + if (infosIt == infosEnd) + infos.push_back({candidate.compilerPath, Version::fromString(candidate.version)}); } } diff --git a/src/app/qbs-setup-toolchains/sdccprobe.h b/src/app/qbs-setup-toolchains/sdccprobe.h index 5fad90e96..aa2c613f3 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.h +++ b/src/app/qbs-setup-toolchains/sdccprobe.h @@ -42,6 +42,8 @@ #include <QtCore/qlist.h> +#include <tuple> + QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE @@ -51,6 +53,18 @@ class Profile; class Settings; } +struct SdccInstallInfo +{ + QString compilerPath; + QString version; +}; + +inline bool operator==(const SdccInstallInfo &lhs, const SdccInstallInfo &rhs) +{ + return std::tie(lhs.compilerPath, lhs.version) + == std::tie(rhs.compilerPath, rhs.version); +} + bool isSdccCompiler(const QString &compilerName); void createSdccProfile(const QFileInfo &compiler, qbs::Settings *settings, diff --git a/src/lib/corelib/buildgraph/rulenode.cpp b/src/lib/corelib/buildgraph/rulenode.cpp index 516b9b830..bf25b1da8 100644 --- a/src/lib/corelib/buildgraph/rulenode.cpp +++ b/src/lib/corelib/buildgraph/rulenode.cpp @@ -227,7 +227,7 @@ int RuleNode::transformerCount() const Set<const Transformer *> transformers; for (const Artifact * const output : filterByType<Artifact>(parents)) transformers.insert(output->transformer.get()); - return transformers.size(); + return int(transformers.size()); } ArtifactSet RuleNode::currentInputArtifacts() const diff --git a/src/lib/corelib/tools/joblimits.cpp b/src/lib/corelib/tools/joblimits.cpp index 912b15a65..1a3e3a498 100644 --- a/src/lib/corelib/tools/joblimits.cpp +++ b/src/lib/corelib/tools/joblimits.cpp @@ -149,7 +149,7 @@ bool JobLimits::isEmpty() const int JobLimits::count() const { - return d->jobLimits.size(); + return int(d->jobLimits.size()); } JobLimit JobLimits::jobLimitAt(int i) const |