summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/msbuild_objectmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/win32/msbuild_objectmodel.cpp')
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp82
1 files changed, 35 insertions, 47 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index b5b8a14a9e..3147f24961 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;