From 8c290c624d343406442b87121ccb2e4eab0e6e51 Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Sat, 7 Sep 2019 15:47:04 +0200 Subject: Fix Qt module-provider for Qt5.13.1 and beyond MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6eef8b28a741c417dc54a33577a2ad4b43def767 Fixes: QBS-1492 Reviewed-by: Jörg Bornemann --- share/qbs/module-providers/Qt/setup-qt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3 From 5b6f320047332bbe07b04730eb537d473002acd3 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 11 Sep 2019 08:49:38 +0300 Subject: Fix MSVC warnings 'return': conversion from 'size_t' to 'int' Change-Id: I18e8fa03a9303855693da3027b722b104cee5d6d Reviewed-by: Richard Weickelt Reviewed-by: hjk --- src/lib/corelib/buildgraph/rulenode.cpp | 2 +- src/lib/corelib/tools/joblimits.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 transformers; for (const Artifact * const output : filterByType(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 -- cgit v1.2.3 From 713c9d8b5dfec9548fb89e1d45b063b7250bdf4f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 13 Mar 2018 11:52:21 +0100 Subject: Add how-to about ccache Task-number: QBS-1325 Change-Id: Ice2e5f16b453b9bde8d2a90918eb593db81bff97 Reviewed-by: Orgad Shaneh Reviewed-by: Richard Weickelt --- doc/external-resources.qdoc | 9 +++++++++ doc/howtos.qdoc | 24 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From a1ab897a8be63af3de3f97724ee6fede6ba2bc3a Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Mon, 23 Sep 2019 16:21:47 +0300 Subject: baremetal: Fix auto detection of SDCC toolchain on Windows The SDCC toolchain package can be provided as 32-bit or as 64-bit installer. If the SDCC 64-bit package will be installed on the 32-bit Windows, then it will not be found in the system registry, because we use the QSettings::NativeFormat. So, we need to check the data for the 32-bit and 64-bit registry sequentially. Change-Id: I15981f39274308e3690cf072396cf1ae82b6743d Reviewed-by: Christian Kandeler --- src/app/qbs-setup-toolchains/sdccprobe.cpp | 59 +++++++++++++++++++++--------- src/app/qbs-setup-toolchains/sdccprobe.h | 8 ++++ 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/src/app/qbs-setup-toolchains/sdccprobe.cpp b/src/app/qbs-setup-toolchains/sdccprobe.cpp index 751e872ee..87c616ff0 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.cpp +++ b/src/app/qbs-setup-toolchains/sdccprobe.cpp @@ -108,26 +108,49 @@ static std::vector installedSdccsFromRegistry() std::vector 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.absoluteFilePath(), 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 SdccInstallInfo &info) { + return candidate == info; + }); + if (infosIt == infosEnd) + infos.push_back(candidate); } } diff --git a/src/app/qbs-setup-toolchains/sdccprobe.h b/src/app/qbs-setup-toolchains/sdccprobe.h index 7f4219b5a..55062ff19 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.h +++ b/src/app/qbs-setup-toolchains/sdccprobe.h @@ -42,6 +42,8 @@ #include +#include + QT_BEGIN_NAMESPACE class QFileInfo; QT_END_NAMESPACE @@ -57,6 +59,12 @@ struct SdccInstallInfo 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, -- cgit v1.2.3 From 94fe404a5a6d7cf91926bcfbd026953994b25815 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 25 Sep 2019 18:11:10 +0200 Subject: Darwin: More filtering in SDK directory Do not try to detect an SDK from a driver kit directory. Fixes: QBS-1495 Change-Id: I05ef565d599e83dcc02d0d18e656fabfd0aad943 Reviewed-by: Joerg Bornemann --- share/qbs/modules/xcode/xcode.js | 3 +++ 1 file changed, 3 insertions(+) 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 { -- cgit v1.2.3