From 136d2bff4b1ec39134b63c7be565a9ba8de58b10 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Fri, 28 Jun 2019 11:45:29 +0200 Subject: Set cpp.minimumIosVersion to "6.0" by default This is required because earlier iOS versions are broken in recent XCode installations (at least, for XCode >= 7.0.0) Change-Id: Ib55e2eafcf26357695ab057da8109921518b7fea Reviewed-by: Qbs CI Bot Reviewed-by: Christian Kandeler --- doc/reference/modules/cpp-module.qdoc | 7 +++++-- share/qbs/modules/cpp/CppModule.qbs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index f69f07239..9f6848e0a 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -1090,9 +1090,12 @@ Passes \c{-miphoneos-version-min=} to the compiler. - If left undefined, compiler defaults will be used. + If set to undefined, compiler defaults will be used. - \nodefaultvalue + \note \QBS sets minimum version to \c "6.0" for \c armv7a because earlier iOS versions are + broken in recent XCode installations. + + \defaultvalue \c "6.0" for \c armv7a, \c undefined otherwise */ /*! diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index 35a5de4f0..bcc82d57a 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -104,7 +104,7 @@ Module { to the compiler. if undefined, compiler defaults will be used." } - property string minimumIosVersion + property string minimumIosVersion: qbs.architecture == "armv7a" ? "6.0" : undefined PropertyOptions { name: "minimumIosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ -- cgit v1.2.3 From 73e2c2a5601e34bfcb6c471784a849b136d03f5f Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 6 Jul 2019 20:06:25 +0200 Subject: doc: Fix JobLimit::jobCount type Should be int, not string Change-Id: Ib0caaa1730125d6f6debbbfc4346fe4f29dba935 Reviewed-by: Qbs CI Bot Reviewed-by: Orgad Shaneh --- doc/reference/items/language/joblimit.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference/items/language/joblimit.qdoc b/doc/reference/items/language/joblimit.qdoc index 66697ba3e..cd68bae31 100644 --- a/doc/reference/items/language/joblimit.qdoc +++ b/doc/reference/items/language/joblimit.qdoc @@ -79,7 +79,7 @@ */ /*! - \qmlproperty string JobLimit::jobCount + \qmlproperty int JobLimit::jobCount The maximum number of commands in the given \l{jobPool}{job pool} that can run concurrently. -- cgit v1.2.3 From bcf2849298fa170e0286332414e08637faa60f6a Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Sun, 7 Jul 2019 16:59:55 +0200 Subject: Add hasLibrary property to Qt.core This allows us to treat Qt.core similar to other Qt modules based upon QtModule.qbs when bundling Qt libraries together with an application. Change-Id: I9ae54ec40c3fb7506181afbd437f4e2f03b02e41 Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/templates/core.qbs | 1 + 1 file changed, 1 insertion(+) diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 63d9a4cb5..2c9ee9a14 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -90,6 +90,7 @@ Module { ? libFilePathDebug : libFilePathRelease property stringList coreLibPaths: @libraryPaths@ + property bool hasLibrary: true // These are deliberately not path types // We don't want to resolve them against the source directory -- cgit v1.2.3 From 6785335b3be5be4c388fa8d967d880e19b70244c Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sat, 6 Jul 2019 17:13:39 +0200 Subject: Add a complete example for a Rule in a Product Change-Id: I4739440cb90f7ef5795f79da053246f8071aa57e Reviewed-by: Christian Kandeler --- doc/reference/items/language/rule.qdoc | 54 +++++++++++++++------------------- examples/examples.qbs | 3 +- examples/rule/lorem_ipsum.txt | 4 +++ examples/rule/rule.qbs | 36 +++++++++++++++++++++++ 4 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 examples/rule/lorem_ipsum.txt create mode 100644 examples/rule/rule.qbs diff --git a/doc/reference/items/language/rule.qdoc b/doc/reference/items/language/rule.qdoc index 3a14c2fa6..62a32caf5 100644 --- a/doc/reference/items/language/rule.qdoc +++ b/doc/reference/items/language/rule.qdoc @@ -45,30 +45,28 @@ The following rule takes text files and replaces Windows-style line endings with their Unix-style counterparts. We will look at it one piece at a time. - \code - Rule { - multiplex: false - \endcode + \quotefromfile ../examples/rule/rule.qbs + + \skipto Rule + \printuntil multiplex: false + A \e {multiplex rule} creates one transformer that takes all input artifacts with the matching input file tag and creates one or more output artifacts. We are setting the respective property to \c false here, indicating that we want to create one transformer per input file. \note This is actually the default, so the above assignment is not required. - \code - inputs: ["txt_input"] - \endcode + + \printuntil inputs: ["txt_input"] + Here we are specifying that our rule is interested in input files that have the tag \c "txt_input". Such files could be source files, in which case you would tag them using a \l{Group}. Or they could in turn get generated by a different rule, in which case that rule would assign the file tag. The files matching the tag will be available in the \l{prepare} script under the name \c inputs (see \l{inputs and outputs}{The inputs and outputs Variables}). - \code - Artifact { - filePath: input.fileName + ".out" - fileTags: ["txt_output"] - } - \endcode + + \printuntil } + Here we are specifying that for every input file, we want to create one output file whose name is the same as the input file, but with an additional extension. Because we are giving a relative path, \QBS will prepend that path by the product's build directory. @@ -82,24 +80,8 @@ \l Artifact items. The set of output artifacts will be available in the prepare script under the name \c outputs (see \l{inputs and outputs}{The inputs and outputs Variables}). - \code - prepare: { - var cmd = new JavaScriptCommand(); - cmd.description = input.fileName + "->" + output.fileName; - cmd.highlight = "codegen"; - cmd.sourceCode = function() { - var file = new TextFile(input.filePath); - var content = file.readAll(); - file.close() - content = content.replace(/\r\n/g, "\n"); - file = new TextFile(output.filePath, TextFile.WriteOnly); - file.write(content); - file.close(); - } - return [cmd]; - } - } - \endcode + \printuntil /^\s{4}\}/ + The prepare script shown above puts everything together by creating the command that does the actual transformation of the file contents, employing the help of the \l{TextFile Service}{TextFile} class. @@ -184,6 +166,16 @@ our executable. \endlist + \section1 A Complete Example + + The following code snippet shows a single \l{Rule} within a \l{Product} and summarizes the + previous sections. + + \note The product's type is set up to the \c "txt_output" file tag to tell \QBS that the + product depends on output artifacts produced by the custom rule. Otherwise the rule would not + be executed. + + \quotefile ../examples/rule/rule.qbs */ /*! diff --git a/examples/examples.qbs b/examples/examples.qbs index abb6d5d9a..ff6e7a191 100644 --- a/examples/examples.qbs +++ b/examples/examples.qbs @@ -65,6 +65,7 @@ Project { "install-bundle/install-bundle.qbs", "protobuf/cpp/addressbook.qbs", "protobuf/objc/addressbook.qbs", - "baremetal/baremetal.qbs" + "baremetal/baremetal.qbs", + "rule/rule.qbs", ] } diff --git a/examples/rule/lorem_ipsum.txt b/examples/rule/lorem_ipsum.txt new file mode 100644 index 000000000..2901fbcee --- /dev/null +++ b/examples/rule/lorem_ipsum.txt @@ -0,0 +1,4 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer accumsan laoreet magna vitae +elementum. Duis semper ex pellentesque nibh ullamcorper lacinia. Suspendisse sed diam magna. +Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In id +maximus turpis, mattis commodo mauris. Sed bibendum accumsan leo. Nulla placerat. diff --git a/examples/rule/rule.qbs b/examples/rule/rule.qbs new file mode 100644 index 000000000..8ec14ee40 --- /dev/null +++ b/examples/rule/rule.qbs @@ -0,0 +1,36 @@ +import qbs.TextFile + +Product { + type: "txt_output" + + Group { + name: "lorem_ipsum" + files: "lorem_ipsum.txt" + fileTags: "txt_input" + } + + //![1] + Rule { + multiplex: false + inputs: ["txt_input"] + Artifact { + filePath: input.fileName + ".out" + fileTags: ["txt_output"] + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = input.fileName + "->" + output.fileName; + cmd.highlight = "codegen"; + cmd.sourceCode = function() { + var file = new TextFile(input.filePath); + var content = file.readAll(); + file.close() + content = content.toUpperCase(); + file = new TextFile(output.filePath, TextFile.WriteOnly); + file.write(content); + file.close(); + } + return [cmd]; + } + } +} -- cgit v1.2.3 From 4ee71d9c1e8fc6d0d12cd562a920e43c53196ece Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 7 Jul 2019 01:08:10 +0200 Subject: ios: Move cpp.entryPoint from Qt.Core to Qt.gui It seems, that console ios apps should not try to do a _qt_main_wrapper trick since there's no platform plugin linked to the app and linker fails to find wrapper. Change-Id: I607db658d5e25d6029626b4a7efb46b2e228ab52 Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/templates/core.qbs | 4 ---- share/qbs/module-providers/Qt/templates/gui.qbs | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 2c9ee9a14..98bc0c4d3 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -106,10 +106,6 @@ Module { cpp.linkerVariant: "gold" } - cpp.entryPoint: qbs.targetOS.containsAny(["ios", "tvos"]) - && Utilities.versionCompare(version, "5.6.0") >= 0 - ? "_qt_main_wrapper" - : undefined cpp.cxxLanguageVersion: Utilities.versionCompare(version, "5.7.0") >= 0 ? "c++11" : original cpp.enableCompilerDefinesByLanguage: ["cpp"].concat( qbs.targetOS.contains("darwin") ? ["objcpp"] : []) diff --git a/share/qbs/module-providers/Qt/templates/gui.qbs b/share/qbs/module-providers/Qt/templates/gui.qbs index eb69e0cad..a3c427175 100644 --- a/share/qbs/module-providers/Qt/templates/gui.qbs +++ b/share/qbs/module-providers/Qt/templates/gui.qbs @@ -1,5 +1,6 @@ import qbs.FileInfo import qbs.ModUtils +import qbs.Utilities import '../QtModule.qbs' as QtModule QtModule { @@ -50,6 +51,11 @@ QtModule { libFilePathRelease: @libFilePathRelease@ pluginTypes: @pluginTypes@ + cpp.entryPoint: qbs.targetOS.containsAny(["ios", "tvos"]) + && Utilities.versionCompare(version, "5.6.0") >= 0 + ? "_qt_main_wrapper" + : undefined + cpp.defines: @defines@ cpp.includePaths: @includes@ cpp.libraryPaths: @libraryPaths@ -- cgit v1.2.3 From b11257cf80eecaa7579b171ef0c53928b3c36b82 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 11 Jul 2019 16:42:36 +0200 Subject: Add change log for 1.14.0 Change-Id: I1c57713abf60c2b5b6ee7bf6a0b403736b60307b Reviewed-by: Ivan Komissarov Reviewed-by: Denis Shienkov Reviewed-by: Christian Kandeler --- changelogs/changes-1.14.0.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 changelogs/changes-1.14.0.md diff --git a/changelogs/changes-1.14.0.md b/changelogs/changes-1.14.0.md new file mode 100644 index 000000000..860578a15 --- /dev/null +++ b/changelogs/changes-1.14.0.md @@ -0,0 +1,35 @@ +# Language +* The `PathProbe` item was extended to support looking for multiple files and filtering candidate + files. + +# C/C++ Support +* Added support for Visual Studio 2019. +* Added support for clang-cl. +* Various improvements for bare-metal toolchains, including new example projects and support for + the SDCC toolchain. + +# Qt Support +* Added the `Qt.android_support.extraLibs` property. + +# Other modules +* The `pkgconfig` module now has a `sysroot` property. +* Added gRPC support to the `protobuf.cpp` module. + +# Android Support +* Removed support for NDK < r19. +* Added new `Android.sdk` properties `versionCode` and `versionName`. + +# Infrastructure +* Added configuration files for Travis CI. +* Various fixes and improvements in the Debian Docker image; updated to to Qt 5.11.3. + +# Contributors +* BogDan Vatra +* Christian Kandeler +* Christian Stenger +* Davide Pesavento +* Denis Shienkov +* hjk +* Ivan Komissarov +* Joerg Bornemann +* Richard Weickelt -- cgit v1.2.3 From f13ba2d0e3c8015649e874c8f643f6a19debf448 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Wed, 10 Jul 2019 09:52:38 +0200 Subject: Set minimumTvosVersion to "6.0" by default This fixes (at least) two compile errors: - clang: error: invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later) - ld: library not found for -ldylib1.o The dylib1 is only present on macOS and not present in recent tvOS/iOS SDKs, clang tries to link to it if deployment target is less or equal to "5.0". Change-Id: Ie77a514bb2661312823df054f0dfca07d69e3059 Reviewed-by: Christian Kandeler --- doc/reference/modules/cpp-module.qdoc | 5 ++++- share/qbs/modules/cpp/CppModule.qbs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index 9f6848e0a..9f554dc1c 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -1149,7 +1149,10 @@ If left undefined, compiler defaults will be used. - \nodefaultvalue + \note \QBS sets the minimum version to \c "6.0", because earlier tvOS + versions are not supported by recent XCode installations by default. + + \defaultvalue \c "6.0 */ /*! diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index bcc82d57a..200d91d09 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -120,7 +120,7 @@ Module { defaults will be used." } - property string minimumTvosVersion + property string minimumTvosVersion: "6.0" PropertyOptions { name: "minimumTvosVersion" description: "a version number in the format [major].[minor] indicating the earliest \ -- cgit v1.2.3 From 8ddbe6531b1273f634505a56a7de34830faada06 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 16 Jul 2019 14:23:13 +0200 Subject: Android: Fix binutils path Amends 65cb0d3e2d. Fixes: QBS-1459 Change-Id: I771cc179bcc996559d76c85d785780a1b044812b Reviewed-by: BogDan Vatra --- share/qbs/modules/cpp/android-gcc.qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs index ad55d8191..3e44f4ff3 100644 --- a/share/qbs/modules/cpp/android-gcc.qbs +++ b/share/qbs/modules/cpp/android-gcc.qbs @@ -147,7 +147,7 @@ LinuxGCC { binutilsPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt", Android.ndk.hostArch, "bin"); - binutilsPathPrefix: "llvm-" + binutilsPathPrefix: FileInfo.joinPaths(binutilsPath, "llvm-") syslibroot: FileInfo.joinPaths(Android.ndk.ndkDir, "platforms", Android.ndk.platform, "arch-" + NdkUtils.abiNameToDirName(Android.ndk.abi)) -- cgit v1.2.3 From 16a84ff85a5b440757962ad481335b60c5cdf44e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 11 Jul 2019 12:24:44 +0200 Subject: Fix outdated documentation for some multiplexing properties Amends 38c897a0d4. Fixes: QBS-1458 Change-Id: I2b3d72f5d738cc45fa061ce47711160d54bdfdc5 Reviewed-by: Christian Kandeler --- doc/reference/modules/qbs-module.qdoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/reference/modules/qbs-module.qdoc b/doc/reference/modules/qbs-module.qdoc index 9e7cc8c3c..c1a0b2532 100644 --- a/doc/reference/modules/qbs-module.qdoc +++ b/doc/reference/modules/qbs-module.qdoc @@ -640,8 +640,7 @@ The architectures the product will be built for. - \defaultvalue \c{["armv5te"]} on Android, same as Xcode on Apple platforms, - otherwise equivalent to \l{qbs::architecture}{[qbs.architecture]}. + \nodefaultvalue */ /*! @@ -650,7 +649,7 @@ The build variants the product will be built for. - \defaultvalue Equivalent to \l{qbs::buildVariant}{[qbs.buildVariant]}. + \nodefaultvalue */ /*! -- cgit v1.2.3 From 93669a133944551c852dd5ef4e4dbca0a3946e8a Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 22 Jul 2019 14:57:53 +0200 Subject: Avoid some deprecation warnings for QLatin1Literal uses Change-Id: I8fe64c2ab78b1cf2e1af2a6aa2dad201299a0a94 Reviewed-by: Christian Kandeler --- src/plugins/scanner/cpp/cppscanner.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/scanner/cpp/cppscanner.cpp b/src/plugins/scanner/cpp/cppscanner.cpp index 067127d00..cbab8a012 100644 --- a/src/plugins/scanner/cpp/cppscanner.cpp +++ b/src/plugins/scanner/cpp/cppscanner.cpp @@ -126,7 +126,7 @@ public: { } - bool equals(const Token &tk, const QLatin1Literal &literal) const + bool equals(const Token &tk, const QLatin1String &literal) const { return static_cast(tk.length()) == literal.size() && memcmp(m_fileContent + tk.begin(), literal.data(), literal.size()) == 0; @@ -136,13 +136,13 @@ public: static void scanCppFile(void *opaq, CPlusPlus::Lexer &yylex, bool scanForFileTags, bool scanForDependencies) { - const QLatin1Literal includeLiteral("include"); - const QLatin1Literal importLiteral("import"); - const QLatin1Literal defineLiteral("define"); - const QLatin1Literal qobjectLiteral("Q_OBJECT"); - const QLatin1Literal qgadgetLiteral("Q_GADGET"); - const QLatin1Literal qnamespaceLiteral("Q_NAMESPACE"); - const QLatin1Literal pluginMetaDataLiteral("Q_PLUGIN_METADATA"); + const QLatin1String includeLiteral("include"); + const QLatin1String importLiteral("import"); + const QLatin1String defineLiteral("define"); + const QLatin1String qobjectLiteral("Q_OBJECT"); + const QLatin1String qgadgetLiteral("Q_GADGET"); + const QLatin1String qnamespaceLiteral("Q_NAMESPACE"); + const QLatin1String pluginMetaDataLiteral("Q_PLUGIN_METADATA"); const auto opaque = static_cast(opaq); const TokenComparator tc(opaque->fileContent); Token tk; -- cgit v1.2.3 From 05ca2e5daa0aedfcfd311658cb62d417acc9b247 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 24 Jul 2019 12:43:07 +0200 Subject: Work around deprecation warnings in Qt Change-Id: Iff45f56fc91f3d513440a3e2aaf519a7aa0f7744 Reviewed-by: Christian Kandeler --- src/lib/corelib/language/jsimports.h | 3 ++- src/lib/corelib/language/language.cpp | 2 +- src/lib/corelib/language/resolvedfilecontext.cpp | 2 +- src/lib/corelib/tools/qttools.h | 15 +++++++++++++++ tests/auto/api/tst_api.cpp | 6 +++--- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/lib/corelib/language/jsimports.h b/src/lib/corelib/language/jsimports.h index ebde70b7b..a892e0ec0 100644 --- a/src/lib/corelib/language/jsimports.h +++ b/src/lib/corelib/language/jsimports.h @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -79,7 +80,7 @@ inline bool operator<(const JsImport &lhs, const JsImport &rhs) inline bool operator==(const JsImport &jsi1, const JsImport &jsi2) { - return jsi1.scopeName == jsi2.scopeName && jsi1.filePaths.toSet() == jsi2.filePaths.toSet(); + return jsi1.scopeName == jsi2.scopeName && toSet(jsi1.filePaths) == toSet(jsi2.filePaths); } using JsImports = std::vector; diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index d888700c5..40549b836 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -241,7 +241,7 @@ bool operator==(const ResolvedModule &m1, const ResolvedModule &m2) { return m1.name == m2.name && m1.isProduct == m2.isProduct - && m1.moduleDependencies.toSet() == m2.moduleDependencies.toSet() + && toSet(m1.moduleDependencies) == toSet(m2.moduleDependencies) && m1.setupBuildEnvironmentScript == m2.setupBuildEnvironmentScript && m1.setupRunEnvironmentScript == m2.setupRunEnvironmentScript; } diff --git a/src/lib/corelib/language/resolvedfilecontext.cpp b/src/lib/corelib/language/resolvedfilecontext.cpp index f1151f98f..db63a8ef4 100644 --- a/src/lib/corelib/language/resolvedfilecontext.cpp +++ b/src/lib/corelib/language/resolvedfilecontext.cpp @@ -53,7 +53,7 @@ ResolvedFileContext::ResolvedFileContext(const FileContextBase &ctx) bool operator==(const ResolvedFileContext &a, const ResolvedFileContext &b) { return a.filePath() == b.filePath() - && a.jsExtensions().toSet() == b.jsExtensions().toSet() + && toSet(a.jsExtensions()) == toSet(b.jsExtensions()) && sorted(a.jsImports()) == sorted(b.jsImports()); } diff --git a/src/lib/corelib/tools/qttools.h b/src/lib/corelib/tools/qttools.h index b465e3d9e..c3b4d3a9f 100644 --- a/src/lib/corelib/tools/qttools.h +++ b/src/lib/corelib/tools/qttools.h @@ -70,4 +70,19 @@ uint qHash(const QStringList &list); uint qHash(const QProcessEnvironment &env); QT_END_NAMESPACE +namespace qbs { + +template +QSet toSet(const QList &list) +{ +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + return list.toSet(); +#else + return QSet(list.begin(), list.end()); +#endif +} + +} // namespace qbs + + #endif // QBSQTTOOLS_H diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 6313827fa..aac0f3e7e 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -2652,7 +2652,7 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(m_logSink->warnings.toSet().size(), 2); + QCOMPARE(toSet(m_logSink->warnings).size(), 2); const auto beforeErrors = m_logSink->warnings; for (const qbs::ErrorInfo &e : beforeErrors) { const QString msg = e.toString(); @@ -2667,7 +2667,7 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(m_logSink->warnings.toSet().size(), 2); + QCOMPARE(toSet(m_logSink->warnings).size(), 2); m_logSink->warnings.clear(); // Re-resolving with changes: Errors come from the re-resolving, stored ones must be suppressed. @@ -2678,7 +2678,7 @@ void TestApi::restoredWarnings() waitForFinished(job.get()); QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); job.reset(nullptr); - QCOMPARE(m_logSink->warnings.toSet().size(), 3); // One more for the additional group + QCOMPARE(toSet(m_logSink->warnings).size(), 3); // One more for the additional group const auto afterErrors = m_logSink->warnings; for (const qbs::ErrorInfo &e : afterErrors) { const QString msg = e.toString(); -- cgit v1.2.3 From 1839ae9bd16928329680b772038a8cad230cfe07 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 23 Jul 2019 21:58:42 +0300 Subject: baremetal: Fix detection of C++ language option for IAR ... which is used at dumping of predefined macros and a header paths. Reason is that for the different architectures the IAR use different C++ language options: * for ARM: --c++ * for AVR or 8051: --ec++ Change-Id: Ic2b4d50e9e2a978a5cbc69ed5353d5953e83c85d Reviewed-by: Christian Kandeler --- share/qbs/modules/cpp/iar.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 3098c88f6..33093c0a3 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -56,6 +56,17 @@ function guessEndianness(macros) return "big" } +function cppLanguageOption(compilerFilePath) +{ + var baseName = FileInfo.baseName(compilerFilePath); + if (baseName === "iccarm") + return "--c++"; + if (baseName === "icc8051" || baseName === "iccavr") + return "--ec++"; + throw "Unable to deduce C++ language option for unsupported compiler: '" + + FileInfo.toNativeSeparators(compilerFilePath) + "'"; +} + function dumpMacros(compilerFilePath, tag) { var tempDir = new TemporaryDir(); var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c"); @@ -64,7 +75,7 @@ function dumpMacros(compilerFilePath, tag) { var args = [ inFilePath, "--predef_macros", outFilePath ]; if (tag && tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); p.exec(compilerFilePath, args, true); @@ -84,7 +95,7 @@ function dumpDefaultPaths(compilerFilePath, tag) { var args = [ inFilePath, "--preinclude", "." ]; if (tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); // This process should return an error, don't throw -- cgit v1.2.3 From 2269ddc60e47bfea459ef034ab1be112716b4764 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Tue, 23 Jul 2019 19:42:41 +0200 Subject: Improve clang-cl auto-detection Now also check for the clang-cl in the default install locations Task-number: QBS-1316 Change-Id: I5d0dfd2b98164b0cac08358001cd1946b4f8aadc Reviewed-by: Denis Shienkov Reviewed-by: Christian Kandeler --- src/app/qbs-setup-toolchains/clangclprobe.cpp | 42 ++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/app/qbs-setup-toolchains/clangclprobe.cpp b/src/app/qbs-setup-toolchains/clangclprobe.cpp index 89075c5e8..5c2a87731 100644 --- a/src/app/qbs-setup-toolchains/clangclprobe.cpp +++ b/src/app/qbs-setup-toolchains/clangclprobe.cpp @@ -117,6 +117,46 @@ QString findCompatibleVcsarsallBat() return {}; } +QString wow6432Key() +{ +#ifdef Q_OS_WIN64 + return QStringLiteral("\\Wow6432Node"); +#else + return {}; +#endif +} + +QString findClangCl() +{ + const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl")); + const auto compilerFromPath = findExecutable(compilerName); + if (!compilerFromPath.isEmpty()) + return compilerFromPath; + + const QSettings registry( + QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\LLVM\\LLVM").arg(wow6432Key()), + QSettings::NativeFormat); + const auto key = QStringLiteral("."); + if (registry.contains(key)) { + const auto compilerPath = QDir::fromNativeSeparators(registry.value(key).toString()) + + QStringLiteral("/bin/") + compilerName; + if (QFileInfo(compilerPath).exists()) + return compilerPath; + } + + // this branch can be useful in case user had two LLVM installations (e.g. 32bit & 64bit) + // but uninstalled one - in that case, registry will be empty + static const char * const envVarCandidates[] = {"ProgramFiles", "ProgramFiles(x86)"}; + for (const auto &envVar : envVarCandidates) { + const auto value + = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv(envVar))); + const auto compilerPath = value + QStringLiteral("/LLVM/bin/") + compilerName; + if (QFileInfo(compilerPath).exists()) + return compilerPath; + } + return {}; +} + } // namespace void createClangClProfile( @@ -144,7 +184,7 @@ void clangClProbe(Settings *settings, QList &profiles) { const auto compilerName = QStringLiteral("clang-cl"); qbsInfo() << Tr::tr("Trying to detect %1...").arg(compilerName); - const auto compilerFilePath = findExecutable(HostOsInfo::appendExecutableSuffix(compilerName)); + const auto compilerFilePath = findClangCl(); if (compilerFilePath.isEmpty()) { qbsInfo() << Tr::tr("%1 was not found.").arg(compilerName); return; -- cgit v1.2.3