diff options
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 53 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 30 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 82 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.h | 29 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 57 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 30 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 249 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 38 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 198 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.h | 29 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.cpp | 29 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.h | 29 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 45 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 29 |
14 files changed, 345 insertions, 582 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 823b799eb2..7f798a2cc6 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "mingw_make.h" #include "option.h" @@ -216,7 +191,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) return; } } - for (const ProString &incit: qAsConst(incs)) { + for (const ProString &incit: std::as_const(incs)) { QString inc = incit.toQString(); inc.replace(QRegularExpression("\\\\$"), ""); inc.replace('\\', '/'); @@ -242,21 +217,18 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t) void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) { - const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX"); - if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) { + linkerResponseFile = maybeCreateLinkerResponseFile(); + if (!linkerResponseFile.isValid()) { objectsLinkLine = "$(OBJECTS)"; } else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. QString ar_cmd = var("QMAKE_LIB"); if (ar_cmd.isEmpty()) ar_cmd = "ar -rc"; - const QString ar_response_file = - createResponseFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->values("OBJECTS")); - objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file); + objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + + escapeFilePath(linkerResponseFile.filePath); } else { - const QString ld_response_file = - createResponseFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->values("OBJECTS")); - objectsLinkLine = "@" + escapeFilePath(ld_response_file); + objectsLinkLine = "@" + escapeFilePath(linkerResponseFile.filePath); } Win32MakefileGenerator::writeObjectsPart(t); } @@ -278,13 +250,16 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE"); const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX"); - if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) { + if (objmax.isEmpty() || project->values("OBJECTS").size() < objmax.toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else { t << "\n\t" << objectsLinkLine << " " ; } } else { - t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)"; + t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " + << objectsLinkLine; + if (!linkerResponseFile.isValid() || linkerResponseFile.onlyObjects) + t << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <<var("QMAKE_POST_LINK"); @@ -298,7 +273,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); rcIncPaths.prepend(fileInfo(rc_file).path()); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 6c1f0086cc..8b919f97e7 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MINGW_MAKE_H #define MINGW_MAKE_H @@ -59,6 +34,7 @@ private: LibFlagType parseLibFlag(const ProString &flag, ProString *arg) override; QString objectsLinkLine; + LinkerResponseFileInfo linkerResponseFile; }; QT_END_NAMESPACE diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index b5b8a14a9e..9bbeed36ff 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "msbuild_objectmodel.h" @@ -35,6 +10,7 @@ #include <qstringlist.h> #include <qfileinfo.h> #include <qregularexpression.h> +#include <qvarlengtharray.h> QT_BEGIN_NAMESPACE @@ -144,6 +120,7 @@ const char _IntermediateDirectory[] = "IntermediateDirectory"; const char _KeyContainer[] = "KeyContainer"; const char _KeyFile[] = "KeyFile"; const char _LanguageStandard[] = "LanguageStandard"; +const char _LanguageStandard_C[] = "LanguageStandard_C"; const char _LargeAddressAware[] = "LargeAddressAware"; const char _LinkDLL[] = "LinkDLL"; const char _LinkErrorReporting[] = "LinkErrorReporting"; @@ -306,7 +283,7 @@ static QString commandLinesForOutput(QStringList commands) // As we want every sub-command to be error-checked (as is done by makefile-based // backends), we insert the checks ourselves, using the undocumented jump target. static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd"); - for (int i = commands.count() - 2; i >= 0; --i) { + for (int i = commands.size() - 2; i >= 0; --i) { if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) commands.insert(i + 1, errchk); } @@ -324,7 +301,7 @@ static QStringList unquote(const QStringList &values) { QStringList result; result.reserve(values.size()); - for (int i = 0; i < values.count(); ++i) + for (int i = 0; i < values.size(); ++i) result << unquote(values.at(i)); return result; } @@ -535,7 +512,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) QFile filterFile; filterFile.setFileName(Option::output.fileName().append(".filters")); - filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { + warn_msg(WarnLogic, "Generator: cannot open output filter file"); + return; + } QTextStream ts(&filterFile); XmlOutput xmlFilter(ts, XmlOutput::NoConversion); @@ -567,7 +547,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) [] (const VCFilter &filter) { return filter.Name; }); tempProj.ExtraCompilers.removeDuplicates(); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -582,7 +562,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, xmlFilter, "Deployment Files"); outputFilter(tempProj, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); } @@ -597,7 +577,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) { - if (tool.SingleProjects.count() == 0) { + if (tool.SingleProjects.size() == 0) { warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); return; } @@ -612,7 +592,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << tag("ItemGroup") << attrTag("Label", "ProjectConfigurations"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { xml << tag("ProjectConfiguration") << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName) @@ -636,7 +616,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) // config part. xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) + for (int i = 0; i < tool.SingleProjects.size(); ++i) write(xml, tool.SingleProjects.at(i).Configuration); xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); @@ -646,7 +626,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(); // PropertySheets - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { xml << tag("ImportGroup") << attrTag("Condition", generateCondition(tool.SingleProjects.at(i).Configuration)) << attrTag("Label", "PropertySheets"); @@ -664,7 +644,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(); xml << tag("PropertyGroup"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; const QString condition = generateCondition(config); @@ -731,7 +711,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) } xml << closetag(); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; xml << tag("ItemDefinitionGroup") @@ -774,7 +754,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) // The file filters are added in a separate file for MSBUILD. QFile filterFile; filterFile.setFileName(Option::output.fileName().append(".filters")); - filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { + warn_msg(WarnLogic, "Cannot open output filter file"); + return; + } QTextStream ts(&filterFile); XmlOutput xmlFilter(ts, XmlOutput::NoConversion); @@ -797,7 +780,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) addFilters(tool, xmlFilter, "Deployment Files"); addFilters(tool, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -811,7 +794,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, xmlFilter, "Resource Files"); outputFilter(tool, xml, xmlFilter, "Deployment Files"); outputFilter(tool, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, xmlFilter, "Root Files"); @@ -1087,6 +1070,8 @@ static inline QString toString(optLinkTimeCodeGenType option) break; case optLTCGEnabled: return "UseLinkTimeCodeGeneration"; + case optLTCGIncremental: + return "UseFastLinkTimeCodeGeneration"; case optLTCGInstrument: return "PGInstrument"; case optLTCGOptimize: @@ -1120,6 +1105,8 @@ static inline QString toString(triState genDebugInfo, linkerDebugOption option) case _True: if (option == linkerDebugOptionFastLink) return "DebugFastLink"; + else if (option == linkerDebugOptionFull) + return "DebugFull"; return "true"; } return QString(); @@ -1440,6 +1427,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrTagT(_MinimalRebuild, tool.MinimalRebuild) << attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation) << attrTagS(_LanguageStandard, tool.LanguageStandard) + << attrTagS(_LanguageStandard_C, tool.LanguageStandard_C) << attrTagS(_ObjectFileName, tool.ObjectFile) << attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName) << attrTagT(_OmitFramePointers, tool.OmitFramePointers) @@ -1755,7 +1743,7 @@ void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, cons { bool added = false; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); if(!filter.Files.isEmpty() && !added) { xmlFilter << tag("Filter") @@ -1777,10 +1765,10 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu else root.reset(new XTreeNode); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); // Merge all files in this filter to root tree - for (int x = 0; x < filter.Files.count(); ++x) + for (int x = 0; x < filter.Files.size(); ++x) root->addElement(filter.Files.at(x)); } @@ -1807,8 +1795,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml // We need to check if the file has any custom build step. // If there is one then it has to be included with "CustomBuild Include" bool hasCustomBuildStep = false; - QVarLengthArray<OutputFilterData> data(project.SingleProjects.count()); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + QVarLengthArray<OutputFilterData> data(project.SingleProjects.size()); + for (int i = 0; i < project.SingleProjects.size(); ++i) { data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName); if (!data[i].filter.Config) // only if the filter is not empty continue; @@ -1830,7 +1818,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml } bool fileAdded = false; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { OutputFilterData *d = &data[i]; if (!d->filter.Config) // only if the filter is not empty continue; diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index ce5711f2da..3d96a030e9 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MSBUILD_OBJECTMODEL_H #define MSBUILD_OBJECTMODEL_H diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index cf58ead2e9..b5df617927 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -1,37 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "msvc_nmake.h" #include "option.h" #include <qregularexpression.h> #include <qdir.h> -#include <qdiriterator.h> +#include <qdirlisting.h> #include <qset.h> #include <time.h> @@ -174,6 +149,10 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const return MakefileGenerator::var(value); } +void NmakeMakefileGenerator::suppressBuiltinRules(QTextStream &) const +{ +} + void NmakeMakefileGenerator::init() { /* this should probably not be here, but I'm using it to wrap the .t files */ @@ -285,9 +264,9 @@ QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter() { QStringList filter; const QChar wildcard = QLatin1Char('*'); - for (const QString &ext : qAsConst(Option::c_ext)) + for (const QString &ext : std::as_const(Option::c_ext)) filter << wildcard + ext; - for (const QString &ext : qAsConst(Option::cpp_ext)) + for (const QString &ext : std::as_const(Option::cpp_ext)) filter << wildcard + ext; return filter; } @@ -311,7 +290,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) for (int y = 0; directories[y]; y++) { QString dirTemp = project->first(directories[y]).toQString(); if (dirTemp.endsWith("\\")) - dirTemp.truncate(dirTemp.length()-1); + dirTemp.truncate(dirTemp.size()-1); if(!dirTemp.isEmpty()) source_directories.insert(dirTemp); } @@ -335,17 +314,15 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter(); QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute); fixifiedSourceDirs.removeDuplicates(); - for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) { - QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot); - while (dit.hasNext()) { - dit.next(); - const QFileInfo fi = dit.fileInfo(); - QString &duplicate = fileNames[fi.completeBaseName()]; + constexpr auto filters = QDir::Files | QDir::NoDotAndDotDot; + for (const QString &sourceDir : std::as_const(fixifiedSourceDirs)) { + for (const auto &dirEntry : QDirListing(sourceDir, sourceFilesFilter, filters)) { + QString &duplicate = fileNames[dirEntry.completeBaseName()]; if (duplicate.isNull()) { - duplicate = fi.filePath(); + duplicate = dirEntry.filePath(); } else { warn_msg(WarnLogic, "%s conflicts with %s", qPrintable(duplicate), - qPrintable(fi.filePath())); + qPrintable(dirEntry.filePath())); duplicatesFound = true; } } @@ -361,7 +338,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) project->variables().remove("QMAKE_RUN_CXX"); project->variables().remove("QMAKE_RUN_CC"); - for (const QString &sourceDir : qAsConst(source_directories)) { + for (const QString &sourceDir : std::as_const(source_directories)) { if (sourceDir.isEmpty()) continue; QString objDir = var("OBJECTS_DIR"); diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 3064f06521..8839a24c65 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MSVC_NMAKE_H #define MSVC_NMAKE_H @@ -52,6 +27,7 @@ protected: QString defaultInstall(const QString &t) override; QStringList &findDependencies(const QString &file) override; QString var(const ProKey &value) const override; + void suppressBuiltinRules(QTextStream &t) const override; QString precompH, precompObj, precompPch; QString precompObjC, precompPchC; bool usePCH = false; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index cf4e2445b1..6517e5c451 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "msvc_objectmodel.h" #include "msvc_vcproj.h" @@ -40,36 +15,42 @@ using namespace QMakeInternal; QT_BEGIN_NAMESPACE -static DotNET vsVersionFromString(const char *versionString) +DotNET vsVersionFromString(const ProString &versionString) { - struct VSVersionMapping - { - const char *str; - DotNET version; - }; - static VSVersionMapping mapping[] = { - { "7.0", NET2002 }, - { "7.1", NET2003 }, - { "8.0", NET2005 }, - { "9.0", NET2008 }, - { "10.0", NET2010 }, - { "11.0", NET2012 }, - { "12.0", NET2013 }, - { "14.0", NET2015 }, - { "15.0", NET2017 }, - { "16.0", NET2019 } - }; - DotNET result = NETUnknown; - for (const auto entry : mapping) { - if (strcmp(entry.str, versionString) == 0) - return entry.version; + int idx = versionString.indexOf(QLatin1Char('.')); + if (idx == -1) + return NETUnknown; + + QStringView versionView = versionString.toQStringView(); + int versionMajor = versionView.left(idx).toInt(); + int versionMinor = versionView.mid(idx + 1).toInt(); + + if (versionMajor == 17) + return NET2022; + if (versionMajor == 16) + return NET2019; + if (versionMajor == 15) + return NET2017; + if (versionMajor == 14) + return NET2015; + if (versionMajor == 12) + return NET2013; + if (versionMajor == 11) + return NET2012; + if (versionMajor == 10) + return NET2010; + if (versionMajor == 9) + return NET2008; + if (versionMajor == 8) + return NET2005; + if (versionMajor == 7) { + if (versionMinor == 0) + return NET2002; + if (versionMinor == 1) + return NET2003; } - return result; -} -DotNET vsVersionFromString(const ProString &versionString) -{ - return vsVersionFromString(versionString.toLatin1().constData()); + return NETUnknown; } // XML Tags --------------------------------------------------------- @@ -330,14 +311,12 @@ static QString vcCommandSeparator() // of the custom commands into it, and putting an "if errorlevel goto" statement behind it. // As we want every sub-command to be error-checked (as is done by makefile-based // backends), we insert the checks ourselves, using the undocumented jump target. - static QString cmdSep = - QLatin1String("
if errorlevel 1 goto VCReportError
"); - return cmdSep; + return QStringLiteral("
if errorlevel 1 goto VCReportError
"); } static void unknownOptionWarning(const char *tool, const char *option) { - static bool firstCall = true; + Q_CONSTINIT static bool firstCall = true; warn_msg(WarnLogic, "Could not parse %s option '%s'; added to AdditionalOptions.", tool, option); if (firstCall) { firstCall = false; @@ -404,7 +383,7 @@ VCCLCompilerTool::VCCLCompilerTool() CompileForArchitecture(archUnknown), InterworkCalls(unset), EnablePREfast(unset), - DisplayFullPaths(unset), + DisplayFullPaths(_False), MultiProcessorCompilation(unset), GenerateXMLDocumentationFiles(unset), CreateHotpatchableImage(unset) @@ -883,7 +862,7 @@ bool VCCLCompilerTool::parseOption(const char* option) } break; } - // Fallthrough + [[fallthrough]]; default: found = false; break; } @@ -1147,12 +1126,40 @@ bool VCCLCompilerTool::parseOption(const char* option) ShowIncludes = _True; break; } - if (strlen(option) > 8 && second == 't' && third == 'd') { - const QString version = option + 8; - static const QStringList knownVersions = { "14", "17", "latest" }; - if (knownVersions.contains(version)) { - LanguageStandard = "stdcpp" + version; - break; + if (strlen(option) > 7 && second == 't' && third == 'd' && fourth == ':') { + static const QRegularExpression rex("(c(?:\\+\\+)?)(.+)"); + auto m = rex.match(option + 5); + if (m.hasMatch()) { + QString *var = nullptr; + const QStringList *knownVersions = nullptr; + QString valuePrefix; + auto lang = m.capturedView(1); + auto version = m.capturedView(2); + if (lang == QStringLiteral("c++")) { + // Turn /std:c++17 into <LanguageStandard>stdcpp17</LanguageStandard> + static const QStringList knownCxxVersions = { + "14", + "17", + "20", + "latest" + }; + var = &LanguageStandard; + knownVersions = &knownCxxVersions; + valuePrefix = "stdcpp"; + } else if (lang == QStringLiteral("c")) { + // Turn /std:c17 into <LanguageStandard_C>stdc17</LanguageStandard_C> + static const QStringList knownCVersions = { + "11", + "17" + }; + var = &LanguageStandard_C; + knownVersions = &knownCVersions; + valuePrefix = "stdc"; + } + if (var && knownVersions->contains(version)) { + *var = valuePrefix + version; + break; + } } } found = false; break; @@ -1470,10 +1477,23 @@ bool VCLinkerTool::parseOption(const char* option) }else EnableUAC = _True; break; - case 0x3389797: // /DEBUG[:FASTLINK] - GenerateDebugInformation = _True; - if (config->CompilerVersion >= NET2015 && strcmp(option + 7, "FASTLINK") == 0) - DebugInfoOption = linkerDebugOptionFastLink; + case 0x3389797: // /DEBUG[:{FASTLINK|FULL|NONE}] + DebugInfoOption = linkerDebugOptionEnabled; + if (config->CompilerVersion >= NET2015 && *(option + 6) == ':') { + const char *str = option + 7; + if (qstricmp(str, "fastlink") == 0) + DebugInfoOption = linkerDebugOptionFastLink; + else if (qstricmp(str, "full") == 0) + DebugInfoOption = linkerDebugOptionFull; + else if (qstricmp(str, "none") == 0) + DebugInfoOption = linkerDebugOptionNone; + else + AdditionalOptions += option; + } + if (DebugInfoOption == linkerDebugOptionNone) + GenerateDebugInformation = _False; + else + GenerateDebugInformation = _True; break; case 0x0033896: // /DEF:filename ModuleDefinitionFile = option+5; @@ -1520,7 +1540,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+6).split(","); HeapReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) HeapCommitSize = both[1].toLongLong(); } break; @@ -1560,24 +1580,28 @@ bool VCLinkerTool::parseOption(const char* option) case 0x0d745c8: // /LIBPATH:dir AdditionalLibraryDirectories += option+9; break; - case 0x0341877: // /LTCG[:NOSTATUS|:STATUS] - config->WholeProgramOptimization = _True; - if (config->CompilerVersion >= NET2005) { - LinkTimeCodeGeneration = optLTCGEnabled; - if(*(option+5) == ':') { - const char* str = option+6; - if (*str == 'S') - ShowProgress = linkProgressAll; - else if (qstricmp(str, "pginstrument") == 0) - LinkTimeCodeGeneration = optLTCGInstrument; - else if (qstricmp(str, "pgoptimize") == 0) - LinkTimeCodeGeneration = optLTCGOptimize; - else if (qstricmp(str, "pgupdate") == 0) - LinkTimeCodeGeneration = optLTCGUpdate; - } - } else { - AdditionalOptions.append(option); + case 0x0341877: // /LTCG[:{INCREMENTAL|NOSTATUS|STATUS|OFF}] + // /LTCG:{PGINSTRUMENT|PGOPTIMIZE|PGUPDATE} + LinkTimeCodeGeneration = optLTCGEnabled; + if (*(option + 5) == ':') { + const char* str = option + 6; + if (qstricmp(str, "status") == 0) + ShowProgress = linkProgressAll; + else if (qstricmp(str, "off") == 0) + LinkTimeCodeGeneration = optLTCGDefault; + else if (qstricmp(str, "incremental") == 0) + LinkTimeCodeGeneration = optLTCGIncremental; + else if (qstricmp(str, "pginstrument") == 0) + LinkTimeCodeGeneration = optLTCGInstrument; + else if (qstricmp(str, "pgoptimize") == 0) + LinkTimeCodeGeneration = optLTCGOptimize; + else if (qstricmp(str, "pgupdate") == 0) + LinkTimeCodeGeneration = optLTCGUpdate; + else + AdditionalOptions.append(option); } + if (LinkTimeCodeGeneration != optLTCGDefault) + config->WholeProgramOptimization = _True; break; case 0x379ED25: case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE} @@ -1705,7 +1729,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+7).split(","); StackReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) StackCommitSize = both[1].toLongLong(); } break; @@ -2208,13 +2232,13 @@ void VCFilter::addFile(const VCFilterFile& fileInfo) void VCFilter::addFiles(const QStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i)); } void VCFilter::addFiles(const ProStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i).toQString()); } @@ -2248,7 +2272,7 @@ void VCFilter::modifyPCHstage(QString str) lines << "* WARNING: All changes made in this file will be lost."; lines << "--------------------------------------------------------------------*/"; lines << "#include \"" + Project->precompHFilename + "\""; - for (const QString &line : qAsConst(lines)) + for (const QString &line : std::as_const(lines)) CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile; return; } @@ -2281,7 +2305,7 @@ void VCFilter::modifyPCHstage(QString str) VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const { - for (int i = 0; i < Files.count(); ++i) { + for (int i = 0; i < Files.size(); ++i) { const VCFilterFile &f = Files.at(i); if (f.file == filePath) { *found = true; @@ -2307,7 +2331,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); // Remove the fake file suffix we've added initially to generate correct command lines. - inFile.chop(Project->customBuildToolFilterFileSuffix.length()); + inFile.chop(Project->customBuildToolFilterFileSuffix.size()); // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); } @@ -2319,7 +2343,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) CustomBuildTool.ToolPath.clear(); CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); - for (int x = 0; x < extraCompilers.count(); ++x) { + for (int x = 0; x < extraCompilers.size(); ++x) { const QString &extraCompilerName = extraCompilers.at(x); if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) @@ -2364,7 +2388,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) configs.contains("dep_existing_only"), true /* checkCommandAvailability */); } - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS( Project->replaceExtraCompilerVariables( deps.at(i), inFile, out, MakefileGenerator::NoShell), @@ -2373,9 +2397,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (combined) { // Add dependencies for each file const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input")); - for (int a = 0; a < tmp_in.count(); ++a) { + for (int a = 0; a < tmp_in.size(); ++a) { const ProStringList &files = Project->project->values(tmp_in.at(a).toKey()); - for (int b = 0; b < files.count(); ++b) { + for (int b = 0; b < files.size(); ++b) { QString file = files.at(b).toQString(); deps += Project->findDependencies(file); inputs += Option::fixPathToTargetOS(file, false); @@ -2405,10 +2429,11 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) cmd_name = cmd.left(space); else cmd_name = cmd; + cmd_name = cmd_name.trimmed(); } // Fixify paths - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS(deps[i], false); @@ -2426,7 +2451,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) deps += CustomBuildTool.AdditionalDependencies; // Make sure that all deps are only once QStringList uniqDeps; - for (int c = 0; c < deps.count(); ++c) { + for (int c = 0; c < deps.size(); ++c) { QString aDep = deps.at(c); if (!aDep.isEmpty()) uniqDeps << aDep; @@ -2437,7 +2462,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // Ensure that none of the output files are also dependencies. Or else, the custom buildstep // will be rebuild every time, even if nothing has changed. - for (const QString &output : qAsConst(CustomBuildTool.Outputs)) + for (const QString &output : std::as_const(CustomBuildTool.Outputs)) CustomBuildTool.AdditionalDependencies.removeAll(output); useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty(); @@ -2472,7 +2497,7 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const { - for (int i = 0; i < ExtraCompilersFiles.count(); ++i) + for (int i = 0; i < ExtraCompilersFiles.size(); ++i) if (ExtraCompilersFiles.at(i).Name == compilerName) return ExtraCompilersFiles.at(i); @@ -2552,7 +2577,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, "Distribution Files"); QSet<QString> extraCompilersInProject; - for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) { + for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) { const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name; if (!extraCompilersInProject.contains(compilerName)) { extraCompilersInProject += compilerName; @@ -2560,7 +2585,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) } } - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x)); } outputFilter(tempProj, xml, "Root Files"); @@ -2571,7 +2596,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) { - if (tool.SingleProjects.count() == 0) { + if (tool.SingleProjects.size() == 0) { warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); return; } @@ -2591,7 +2616,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(_Platforms) << tag(_Configurations); // Output each configuration - for (int i = 0; i < tool.SingleProjects.count(); ++i) + for (int i = 0; i < tool.SingleProjects.size(); ++i) write(xml, tool.SingleProjects.at(i).Configuration); xml << closetag(_Configurations) << tag(q_Files); @@ -2604,7 +2629,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, "Resource Files"); outputFilter(tool, xml, "Deployment Files"); outputFilter(tool, xml, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, "Root Files"); @@ -2906,7 +2931,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) { - if(!tool.Files.count()) + if(!tool.Files.size()) return; if (!tool.Name.isEmpty()) { @@ -2916,7 +2941,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) << attrS(_UniqueIdentifier, tool.Guid) << attrT(_ParseFiles, tool.ParseFiles); } - for (int i = 0; i < tool.Files.count(); ++i) { + for (int i = 0; i < tool.Files.size(); ++i) { const VCFilterFile &info = tool.Files.at(i); xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)) @@ -2940,11 +2965,11 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt QString name, extfilter, guid; triState parse = unset; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); // Merge all files in this filter to root tree - for (int x = 0; x < filter.Files.count(); ++x) + for (int x = 0; x < filter.Files.size(); ++x) root->addElement(filter.Files.at(x)); // Save filter setting from first filter. Next filters @@ -2979,7 +3004,7 @@ void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, cons { xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); if (filter.Config) // only if the filter is not empty outputFileConfig(filter, xml, info.file); diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 84f76ce224..190d6c727f 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MSVC_OBJECTMODEL_H #define MSVC_OBJECTMODEL_H @@ -53,7 +28,8 @@ enum DotNET { NET2013 = 0xc0, NET2015 = 0xd0, NET2017 = 0xe0, - NET2019 + NET2019, + NET2022 }; DotNET vsVersionFromString(const ProString &versionString); @@ -282,7 +258,9 @@ enum inlineExpansionOption { }; enum linkerDebugOption { linkerDebugOptionNone, - linkerDebugOptionFastLink + linkerDebugOptionEnabled, // represents /DEBUG without further options + linkerDebugOptionFastLink, + linkerDebugOptionFull }; enum linkIncrementalType { linkIncrementalDefault, @@ -355,6 +333,7 @@ enum optWin98Type { enum optLinkTimeCodeGenType { optLTCGDefault, optLTCGEnabled, + optLTCGIncremental, optLTCGInstrument, optLTCGOptimize, optLTCGUpdate @@ -527,6 +506,7 @@ public: inlineExpansionOption InlineFunctionExpansion; triState KeepComments; QString LanguageStandard; + QString LanguageStandard_C; triState MinimalRebuild; QString ObjectFile; triState OmitDefaultLibName; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index ce4ce5769a..2192535867 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "msvc_vcproj.h" #include "option.h" @@ -33,16 +8,20 @@ #include <ioutils.h> #include <qdir.h> -#include <qdiriterator.h> +#include <qdirlisting.h> #include <qcryptographichash.h> #include <qhash.h> #include <quuid.h> +#include <qregularexpression.h> #include <stdlib.h> +#include <tuple> +#include <utility> //#define DEBUG_SOLUTION_GEN using namespace QMakeInternal; +using namespace Qt::StringLiterals; QT_BEGIN_NAMESPACE // Filter GUIDs (Do NOT change these!) ------------------------------ @@ -75,6 +54,8 @@ const char _slnHeader141[] = "Microsoft Visual Studio Solution File, Format "\n# Visual Studio 15"; const char _slnHeader142[] = "Microsoft Visual Studio Solution File, Format Version 12.00" "\n# Visual Studio Version 16"; +const char _slnHeader143[] = "Microsoft Visual Studio Solution File, Format Version 12.00" + "\n# Visual Studio Version 17"; // The following UUID _may_ change for later servicepacks... // If so we need to search through the registry at // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects @@ -161,24 +142,24 @@ bool VcprojGenerator::writeProjectMakefile() // Generate project file if(project->first("TEMPLATE") == "vcapp" || project->first("TEMPLATE") == "vclib") { - if (!mergedProjects.count()) { + if (!mergedProjects.size()) { warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!"); return false; } debug_msg(1, "Generator: MSVC.NET: Writing project file"); VCProject mergedProject; - for (int i = 0; i < mergedProjects.count(); ++i) { + for (int i = 0; i < mergedProjects.size(); ++i) { VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcProject); mergedProject.SingleProjects += *singleProject; - for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) { + for (int j = 0; j < singleProject->ExtraCompilersFiles.size(); ++j) { const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name; if (!mergedProject.ExtraCompilers.contains(compilerName)) mergedProject.ExtraCompilers += compilerName; } } - if(mergedProjects.count() > 1 && + if(mergedProjects.size() > 1 && mergedProjects.at(0)->vcProject.Name == mergedProjects.at(1)->vcProject.Name) mergedProjects.at(0)->writePrlFile(); @@ -296,21 +277,7 @@ QString VcprojGenerator::retrievePlatformToolSet() const if (!envVar.isEmpty()) return envVar; - switch (vcProject.Configuration.CompilerVersion) - { - case NET2012: - return QStringLiteral("v110"); - case NET2013: - return QStringLiteral("v120"); - case NET2015: - return QStringLiteral("v140"); - case NET2017: - return QStringLiteral("v141"); - case NET2019: - return QStringLiteral("v142"); - default: - return QString(); - } + return u"v"_s + project->first("MSVC_TOOLSET_VER"); } bool VcprojGenerator::isStandardSuffix(const QString &suffix) const @@ -382,7 +349,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends")))); projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString()); } - for (const auto &subdir : qAsConst(collectedSubdirs)) { + for (const auto &subdir : std::as_const(collectedSubdirs)) { QString profile = subdir.first; QFileInfo fi(fileInfo(Option::normalizePath(profile))); if (fi.exists()) { @@ -451,7 +418,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString(); // We want to store it as the .lib name. if (newDep->target.endsWith(".dll")) - newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; + newDep->target = newDep->target.left(newDep->target.size()-3) + "lib"; projGuids.insert(newDep->projectName, newDep->target); if (tmpList.size()) { @@ -535,6 +502,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) } switch (vcProject.Configuration.CompilerVersion) { + case NET2022: + t << _slnHeader143; + break; case NET2019: t << _slnHeader142; break; @@ -664,10 +634,10 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) bool VcprojGenerator::hasBuiltinCompiler(const QString &file) { // Source files - for (int i = 0; i < Option::cpp_ext.count(); ++i) + for (int i = 0; i < Option::cpp_ext.size(); ++i) if (file.endsWith(Option::cpp_ext.at(i))) return true; - for (int i = 0; i < Option::c_ext.count(); ++i) + for (int i = 0; i < Option::c_ext.size(); ++i) if (file.endsWith(Option::c_ext.at(i))) return true; if (file.endsWith(".rc") @@ -797,41 +767,70 @@ void VcprojGenerator::init() if (autogenPrecompSource) { precompSource = precompH + (pchIsCFile - ? (Option::c_ext.count() ? Option::c_ext.at(0) : QLatin1String(".c")) - : (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); + ? (Option::c_ext.size() ? Option::c_ext.at(0) : QLatin1String(".c")) + : (Option::cpp_ext.size() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); project->values("GENERATED_SOURCES") += precompSource; } else if (!precompSource.isEmpty()) { project->values("SOURCES") += precompSource; } } - // Add all input files for a custom compiler into a map for uniqueness, - // unless the compiler is configure as a combined stage, then use the first one + // Helper function to create a fake file foo.cbt for the project view. + // + // This prevents VS from complaining about a circular dependency from "foo -> foo". + // + // The .cbt file is added as "source" of the Custom Build Tool. This means, in the project + // view, this is the file the Custom Build Tool property page is attached to. + // + // This function returns a pair with + // - the fully resolved output file path + // - the file path of the .cbt file + auto addExtraCompilerSourceWithCustomBuildToolFakeFile + = [this](const QString &compilerOutput, const ProString &extraCompiler, + const QStringList &inputs) -> std::pair<QString, QString> + { + QString realOut = replaceExtraCompilerVariables(compilerOutput, inputs, {}, NoShell); + QString out = realOut + customBuildToolFilterFileSuffix; + createCustomBuildToolFakeFile(out, realOut); + out = Option::fixPathToTargetOS(out, false); + extraCompilerSources[out] += extraCompiler.toQString(); + return { realOut, out }; + }; + + // Add all input files for a custom compiler into a map for uniqueness. + // + // Use .cbt files for the following cases: + // - CONFIG += combine + // - the input has a built-in compiler (e.g. C++ source file) for (const ProString &quc : project->values("QMAKE_EXTRA_COMPILERS")) { const ProStringList &invar = project->values(ProKey(quc + ".input")); const QString compiler_out = project->first(ProKey(quc + ".output")).toQString(); - for (ProStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) { - ProStringList fileList = project->values((*iit).toKey()); - if (!fileList.isEmpty()) { - if (project->values(ProKey(quc + ".CONFIG")).indexOf("combine") != -1) - fileList.erase(fileList.begin() + 1, fileList.end()); - for (ProStringList::ConstIterator fit = fileList.constBegin(); fit != fileList.constEnd(); ++fit) { - QString file = (*fit).toQString(); - if (verifyExtraCompiler(quc, file)) { - if (!hasBuiltinCompiler(file)) { - extraCompilerSources[file] += quc.toQString(); - } else { - // Create a fake file foo.moc.cbt for the project view. - // This prevents VS from complaining about a circular - // dependency from foo.moc -> foo.moc. - QString realOut = replaceExtraCompilerVariables( - compiler_out, file, QString(), NoShell); - QString out = realOut + customBuildToolFilterFileSuffix; - createCustomBuildToolFakeFile(out, realOut); - out = Option::fixPathToTargetOS(out, false); - extraCompilerSources[out] += quc.toQString(); - extraCompilerOutputs[out] = file; - } + + QStringList inputFiles; + for (auto it = invar.begin(); it != invar.end(); ++it) + inputFiles += project->values(it->toKey()).toQStringList(); + + if (project->values(ProKey(quc + ".CONFIG")).contains("combine")) { + // Handle "CONFIG += combine" extra compilers. + QString realOut; + QString out; + std::tie(realOut, out) + = addExtraCompilerSourceWithCustomBuildToolFakeFile(compiler_out, quc, inputFiles); + if (hasBuiltinCompiler(realOut)) + extraCompilerOutputs[out] = realOut; + } else { + // Handle regular 1-to-1 extra compilers. + for (const QString &file : inputFiles) { + if (verifyExtraCompiler(quc, file)) { + if (!hasBuiltinCompiler(file)) { + extraCompilerSources[file] += quc.toQString(); + } else { + QString out; + std::tie(std::ignore, out) + = addExtraCompilerSourceWithCustomBuildToolFakeFile(compiler_out, + quc, + QStringList(file)); + extraCompilerOutputs[out] = file; } } } @@ -842,7 +841,7 @@ void VcprojGenerator::init() for (auto it = extraCompilerSources.cbegin(), end = extraCompilerSources.cend(); it != end; ++it) qDebug("Extracompilers for %s are (%s)", it.key().toLatin1().constData(), it.value().join(", ").toLatin1().constData()); for (auto it = extraCompilerOutputs.cbegin(), end = extraCompilerOutputs.cend(); it != end; ++it) - qDebug("Object mapping for %s is (%s)", it.key().toLatin1().constData(), it.value().join(", ").toLatin1().constData()); + qDebug("Object mapping for %s is (%s)", qPrintable(it.key()), qPrintable(it.value())); qDebug(""); #endif } @@ -883,6 +882,9 @@ void VcprojGenerator::initProject() // Own elements ----------------------------- vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString(); switch (vcProject.Configuration.CompilerVersion) { + case NET2022: + vcProject.Version = "17.00"; + break; case NET2019: vcProject.Version = "16.00"; break; @@ -1034,6 +1036,20 @@ void VcprojGenerator::initConfiguration() initPreLinkEventTools(); } +// Filter from the given QMAKE_CFLAGS the options that are relevant +// for the vcxproj-global VCCLCompilerTool. +static ProStringList relevantCFlags(const ProStringList &flags) +{ + ProStringList result; + static const QRegularExpression rex("^[/-]std:"); + for (const ProString &flag : flags) { + if (rex.match(flag.toQString()).hasMatch()) { + result.append(flag); + } + } + return result; +} + void VcprojGenerator::initCompilerTool() { QString placement = project->first("OBJECTS_DIR").toQString(); @@ -1056,6 +1072,7 @@ void VcprojGenerator::initCompilerTool() conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER").toQStringList(); } + conf.compiler.parseOptions(relevantCFlags(project->values("QMAKE_CFLAGS"))); conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); if (project->isActiveConfig("windows")) @@ -1196,7 +1213,7 @@ void VcprojGenerator::initDeploymentTool() continue; // We want to deploy .dlls not .libs if (dllName.endsWith(QLatin1String(".lib"))) - dllName.replace(dllName.length() - 3, 3, QLatin1String("dll")); + dllName.replace(dllName.size() - 3, 3, QLatin1String("dll")); // Use only the file name and check in Qt's install path and LIBPATHs to check for existence dllName.remove(0, dllName.lastIndexOf(QLatin1Char('/')) + 1); QFileInfo info; @@ -1276,18 +1293,16 @@ void VcprojGenerator::initDeploymentTool() } int pathSize = searchPath.size(); - QDirIterator iterator(searchPath, QStringList() << nameFilter - , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks - , QDirIterator::Subdirectories); + constexpr auto filters = QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks; + using F = QDirListing::IteratorFlag; + QDirListing dirList(searchPath, QStringList{nameFilter}, filters, F::Recursive); // foreach dirIterator-entry in d - while(iterator.hasNext()) { - iterator.next(); - - QString absoluteItemPath = Option::fixPathToTargetOS(QFileInfo(iterator.filePath()).absolutePath()); + for (const auto &dirEntry : dirList) { + const QString absoluteItemPath = Option::fixPathToTargetOS(dirEntry.absolutePath()); // Identify if it is just another subdir int diffSize = absoluteItemPath.size() - pathSize; // write out rules - conf.deployment.AdditionalFiles += iterator.fileName() + conf.deployment.AdditionalFiles += dirEntry.fileName() + "|" + absoluteItemPath + "|" + itemDevicePath + (diffSize ? (absoluteItemPath.right(diffSize)) : QLatin1String("")) + "|0;"; @@ -1529,13 +1544,14 @@ void VcprojGenerator::initExtraCompilerOutputs() if (!outputs.isEmpty()) tmp_out = outputs.first().toQString(); if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) { - // Combined output, only one file result + // Combined output, only one file result. Use .cbt file. extraCompile.addFile(Option::fixPathToTargetOS( - replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false)); + replaceExtraCompilerVariables(tmp_out + customBuildToolFilterFileSuffix, + QString(), QString(), NoShell), false)); } else if (!inputVars.isEmpty()) { // One output file per input const ProStringList &tmp_in = project->values(inputVars.first().toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( @@ -1550,7 +1566,7 @@ void VcprojGenerator::initExtraCompilerOutputs() for (const ProString &inputVar : inputVars) { if (!otherFilters.contains(inputVar)) { const ProStringList &tmp_in = project->values(inputVar.toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index c565b709d2..aa4cc53c70 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MSVC_VCPROJ_H #define MSVC_VCPROJ_H diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index ccbbf8cbac..1b5541bb16 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "msvc_vcxproj.h" #include "msbuild_objectmodel.h" diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h index 7e02b6c32f..05e5a4c9da 100644 --- a/qmake/generators/win32/msvc_vcxproj.h +++ b/qmake/generators/win32/msvc_vcxproj.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef MSVC_VCXPROJ_H #define MSVC_VCXPROJ_H diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 422919b872..c8317389f5 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "winmakefile.h" #include "option.h" @@ -199,9 +174,9 @@ bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, QStringView o { if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff)) return true; - for (int off = fixedBase.length(); off > slashOff; off--) { + for (int off = fixedBase.size(); off > slashOff; off--) { if (!fixedBase.at(off - 1).isDigit()) { - if (off != fixedBase.length()) { + if (off != fixedBase.size()) { return MakefileGenerator::processPrlFileBase( origFile, origName, fixedBase.left(off), slashOff); } @@ -504,8 +479,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); - if(del_statement.length() + files.length() + - qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { + if(del_statement.size() + files.size() + + qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) { t << "\n\t" << del_statement << files; files.clear(); } @@ -533,8 +508,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { file = " " + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); - if(del_statement.length() + files.length() + - qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { + if(del_statement.size() + files.size() + + qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) { t << "\n\t" << del_statement << files; files.clear(); } @@ -711,7 +686,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; @@ -774,7 +749,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()); int slsh = dst_prl.lastIndexOf(Option::dir_sep); if(slsh != -1) - dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); + dst_prl = dst_prl.right(dst_prl.size() - slsh - 1); dst_prl = filePrefixRoot(root, targetdir + dst_prl); if (!ret.isEmpty()) ret += "\n\t"; diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 180bd0fde8..bdab01b488 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef WINMAKEFILE_H #define WINMAKEFILE_H |