diff options
Diffstat (limited to 'src/app/qbs-setup-toolchains')
-rw-r--r-- | src/app/qbs-setup-toolchains/clangclprobe.cpp | 22 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/dmcprobe.cpp | 3 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/gccprobe.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/msvcprobe.cpp | 12 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/qbs-setup-toolchains.pro | 36 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/sdccprobe.cpp | 3 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/watcomprobe.cpp | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/xcodeprobe.cpp | 8 |
8 files changed, 32 insertions, 60 deletions
diff --git a/src/app/qbs-setup-toolchains/clangclprobe.cpp b/src/app/qbs-setup-toolchains/clangclprobe.cpp index c9c5a428c..272f953fc 100644 --- a/src/app/qbs-setup-toolchains/clangclprobe.cpp +++ b/src/app/qbs-setup-toolchains/clangclprobe.cpp @@ -85,7 +85,7 @@ Profile createProfileHelper( QString findClangCl() { const auto compilerName = HostOsInfo::appendExecutableSuffix(QStringLiteral("clang-cl")); - const auto compilerFromPath = findExecutable(compilerName); + auto compilerFromPath = findExecutable(compilerName); if (!compilerFromPath.isEmpty()) return compilerFromPath; @@ -121,13 +121,23 @@ void clangClProbe(Settings *settings, std::vector<Profile> &profiles) return; } - const auto clangCl = clangCls.front(); const QString architectures[] = { QStringLiteral("x86_64"), QStringLiteral("x86") }; - qbs::Internal::transform(architectures, profiles, [settings, clangCl](const auto &arch) { - const auto profileName = QStringLiteral("clang-cl-%1").arg(arch); - return createProfileHelper(settings, profileName, clangCl.toolchainInstallPath, - clangCl.vcvarsallPath, arch); }); + for (size_t index = 0; index < clangCls.size(); ++index) { + const auto &clangCl = clangCls[index]; + const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index); + qbs::Internal::transform( + architectures, profiles, [settings, clangCl, suffix](const auto &arch) { + const auto profileName = QStringLiteral("clang-cl") + suffix + + QStringLiteral("-%1").arg(arch); + return createProfileHelper( + settings, + profileName, + clangCl.toolchainInstallPath, + clangCl.vcvarsallPath, + arch); + }); + } } diff --git a/src/app/qbs-setup-toolchains/dmcprobe.cpp b/src/app/qbs-setup-toolchains/dmcprobe.cpp index cbe113dfd..097b1caed 100644 --- a/src/app/qbs-setup-toolchains/dmcprobe.cpp +++ b/src/app/qbs-setup-toolchains/dmcprobe.cpp @@ -105,8 +105,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QStringList &flag p.waitForFinished(3000); fakeIn.remove(); static QRegularExpression re(QLatin1String("\\r?\\n")); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re); - return lines; + return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static std::optional<Target> dumpDmcTarget(const QFileInfo &compiler, const QStringList &flags) diff --git a/src/app/qbs-setup-toolchains/gccprobe.cpp b/src/app/qbs-setup-toolchains/gccprobe.cpp index dda8f2274..c8c04b0cc 100644 --- a/src/app/qbs-setup-toolchains/gccprobe.cpp +++ b/src/app/qbs-setup-toolchains/gccprobe.cpp @@ -526,7 +526,7 @@ void gccProbe(Settings *settings, std::vector<Profile> &profiles, const QString std::vector<QFileInfo> candidates; const auto filters = buildCompilerNameFilters(compilerName); - for (const auto &searchPath : qAsConst(searchPaths)) { + for (const auto &searchPath : std::as_const(searchPaths)) { const QDir dir(searchPath); const QStringList fileNames = dir.entryList( filters, QDir::Files | QDir::Executable); @@ -574,7 +574,7 @@ void gccProbe(Settings *settings, std::vector<Profile> &profiles, const QString }); } - for (const auto &candidate : qAsConst(candidates)) { + for (const auto &candidate : std::as_const(candidates)) { const QString toolchainType = toolchainTypeFromCompilerName( candidate.baseName()); const QString profileName = buildProfileName(candidate); diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp index a0fa7cee6..84d36753e 100644 --- a/src/app/qbs-setup-toolchains/msvcprobe.cpp +++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp @@ -140,7 +140,7 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles) } } - for (const WinSDK &sdk : qAsConst(winSDKs)) { + for (const WinSDK &sdk : std::as_const(winSDKs)) { qbsInfo() << Tr::tr(" Windows SDK %1 detected:\n" " installed in %2").arg(sdk.version, sdk.vcInstallPath); if (sdk.isDefault) @@ -150,7 +150,7 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles) // 2) Installed MSVCs std::vector<MSVC> msvcs = MSVC::installedCompilers(ConsoleLogger::instance()); - for (const MSVC &msvc : qAsConst(msvcs)) { + for (const MSVC &msvc : std::as_const(msvcs)) { qbsInfo() << Tr::tr(" MSVC %1 (%2) detected in\n" " %3").arg(msvc.version, msvc.architecture, QDir::toNativeSeparators(msvc.binPath)); @@ -164,10 +164,10 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles) qbsInfo() << Tr::tr("Detecting build environment..."); std::vector<MSVC *> msvcPtrs; - msvcPtrs.resize(winSDKs.size() + msvcs.size()); - std::transform(winSDKs.begin(), winSDKs.end(), msvcPtrs.begin(), + msvcPtrs.reserve(winSDKs.size() + msvcs.size()); + std::transform(winSDKs.begin(), winSDKs.end(), std::back_inserter(msvcPtrs), [] (WinSDK &sdk) -> MSVC * { return &sdk; }); - std::transform(msvcs.begin(), msvcs.end(), msvcPtrs.begin() + winSDKs.size(), + std::transform(msvcs.begin(), msvcs.end(), std::back_inserter(msvcPtrs), [] (MSVC &msvc) -> MSVC * { return &msvc; }); VsEnvironmentDetector envDetector; @@ -195,7 +195,7 @@ void msvcProbe(Settings *settings, std::vector<Profile> &profiles) // a new group of compilers of the same version incrementing the set size msvcVersions.insert(msvc.vcInstallPath); // index is the number of specific vcInstallPaths (e.g. compiler versions) seen so far - const qsizetype index = msvcVersions.size() - 1; + const size_t index = msvcVersions.size() - 1; const QString suffix = index == 0 ? QString() : QStringLiteral("-%1").arg(index); const QString name = QLatin1String("MSVC") + msvc.version + suffix + QLatin1Char('-') + msvc.architecture; diff --git a/src/app/qbs-setup-toolchains/qbs-setup-toolchains.pro b/src/app/qbs-setup-toolchains/qbs-setup-toolchains.pro deleted file mode 100644 index 69d6552ee..000000000 --- a/src/app/qbs-setup-toolchains/qbs-setup-toolchains.pro +++ /dev/null @@ -1,36 +0,0 @@ -include(../app.pri) - -TARGET = qbs-setup-toolchains - -HEADERS += \ - clangclprobe.h \ - commandlineparser.h \ - cosmicprobe.h \ - dmcprobe.h \ - gccprobe.h \ - iarewprobe.h \ - keilprobe.h \ - msvcprobe.h \ - probe.h \ - sdccprobe.h \ - watcomprobe.h \ - xcodeprobe.h \ - -SOURCES += \ - clangclprobe.cpp \ - commandlineparser.cpp \ - cosmicprobe.cpp \ - dmcprobe.cpp \ - gccprobe.cpp \ - iarewprobe.cpp \ - keilprobe.cpp \ - main.cpp \ - msvcprobe.cpp \ - probe.cpp \ - sdccprobe.cpp \ - watcomprobe.cpp \ - xcodeprobe.cpp \ - -mingw { - RC_FILE = qbs-setup-toolchains.rc -} diff --git a/src/app/qbs-setup-toolchains/sdccprobe.cpp b/src/app/qbs-setup-toolchains/sdccprobe.cpp index b53615218..25a3d9751 100644 --- a/src/app/qbs-setup-toolchains/sdccprobe.cpp +++ b/src/app/qbs-setup-toolchains/sdccprobe.cpp @@ -84,8 +84,7 @@ static QStringList dumpOutput(const QFileInfo &compiler, const QString &targetFl } static QRegularExpression re(QStringLiteral("\\r?\\n")); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()).split(re); - return lines; + return QString::fromUtf8(p.readAllStandardOutput()).split(re); } static bool supportsSdccArchitecture(const QFileInfo &compiler, QStringView flag) diff --git a/src/app/qbs-setup-toolchains/watcomprobe.cpp b/src/app/qbs-setup-toolchains/watcomprobe.cpp index 13cb8d50c..cc9fee2b4 100644 --- a/src/app/qbs-setup-toolchains/watcomprobe.cpp +++ b/src/app/qbs-setup-toolchains/watcomprobe.cpp @@ -118,8 +118,8 @@ static QStringList dumpOutput(const QFileInfo &compiler, QStringView flag, p.start(compiler.absoluteFilePath(), args); p.waitForFinished(3000); fakeIn.remove(); - const QStringList lines = QString::fromUtf8(p.readAllStandardOutput()) - .split(QRegularExpression(QLatin1String("\\r?\\n"))); + QStringList lines = QString::fromUtf8(p.readAllStandardOutput()) + .split(QRegularExpression(QLatin1String("\\r?\\n"))); return lines; } diff --git a/src/app/qbs-setup-toolchains/xcodeprobe.cpp b/src/app/qbs-setup-toolchains/xcodeprobe.cpp index bb246742f..ea27e4143 100644 --- a/src/app/qbs-setup-toolchains/xcodeprobe.cpp +++ b/src/app/qbs-setup-toolchains/xcodeprobe.cpp @@ -150,7 +150,7 @@ void XcodeProbe::detectDeveloperPaths() if (!selectedXcode.waitForFinished(-1) || selectedXcode.exitCode()) { qbsInfo() << Tr::tr("Could not detect selected Xcode with /usr/bin/xcode-select"); } else { - QString path = QString::fromLocal8Bit(selectedXcode.readAllStandardOutput()); + QString path = QString::fromLocal8Bit(selectedXcode.readAllStandardOutput().trimmed()); addDeveloperPath(path); } addDeveloperPath(defaultDeveloperPath); @@ -163,7 +163,7 @@ void XcodeProbe::detectDeveloperPaths() qbsInfo() << Tr::tr("Could not detect additional Xcode installations with /usr/bin/mdfind"); } else { const auto paths = QString::fromLocal8Bit(launchServices.readAllStandardOutput()) - .split(QLatin1Char('\n'), QBS_SKIP_EMPTY_PARTS); + .split(QLatin1Char('\n'), Qt::SkipEmptyParts); for (const QString &path : paths) addDeveloperPath(path + QStringLiteral("/Contents/Developer")); } @@ -188,7 +188,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x << QStringLiteral("appletvsimulator") << QStringLiteral("watchos") << QStringLiteral("watchsimulator"); - for (const QString &platform : qAsConst(platforms)) { + for (const QString &platform : std::as_const(platforms)) { Profile platformProfile(xcodeName + QLatin1Char('-') + platform, settings); platformProfile.removeProfile(); platformProfile.setBaseProfile(installationProfile.name()); @@ -212,7 +212,7 @@ void XcodeProbe::detectAll() { int i = 1; detectDeveloperPaths(); - for (const QString &developerPath : qAsConst(developerPaths)) { + for (const QString &developerPath : std::as_const(developerPaths)) { QString profileName = QStringLiteral("xcode"); if (developerPath != defaultDeveloperPath) { const auto devPath = developerPath.toStdString(); |