summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/msvc_vcproj.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/win32/msvc_vcproj.cpp')
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp84
1 files changed, 38 insertions, 46 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 5e3e11fd5c..7a713e1b65 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** 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:LGPL21$
+** $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 http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** 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$
**
@@ -129,7 +124,7 @@ DotNET which_dotnet_version(const QByteArray &preferredVersion = QByteArray())
// More than one version installed, search directory path
QString paths = qgetenv("PATH");
const QStringList pathlist = paths.split(QLatin1Char(';'));
- foreach (const QString &path, pathlist) {
+ for (const QString &path : pathlist) {
for (i = 0; dotNetCombo[i].version; ++i) {
const QString productPath = installPaths.value(dotNetCombo[i].version);
if (productPath.isEmpty())
@@ -416,7 +411,7 @@ bool VcprojGenerator::isStandardSuffix(const QString &suffix) const
ProString VcprojGenerator::firstInputFileName(const ProString &extraCompilerName) const
{
- foreach (const ProString &var, project->values(ProKey(extraCompilerName + ".input"))) {
+ for (const ProString &var : project->values(ProKey(extraCompilerName + ".input"))) {
const ProStringList &files = project->values(var.toKey());
if (!files.isEmpty())
return files.first();
@@ -441,10 +436,12 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
QHash<QString, ProStringList> &subdirProjectLookup,
const ProStringList &allDependencies)
{
- QLinkedList<QPair<QString, ProStringList> > collectedSubdirs;
+ QVector<QPair<QString, ProStringList> > collectedSubdirs;
ProStringList tmp_proj_subdirs = proj->values("SUBDIRS");
ProStringList projectsInProject;
- for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
+ const int numSubdirs = tmp_proj_subdirs.size();
+ collectedSubdirs.reserve(numSubdirs);
+ for (int x = 0; x < numSubdirs; ++x) {
ProString tmpdir = tmp_proj_subdirs.at(x);
const ProKey tmpdirConfig(tmpdir + ".CONFIG");
if (!proj->isEmpty(tmpdirConfig)) {
@@ -466,9 +463,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());
}
- QLinkedListIterator<QPair<QString, ProStringList> > collectedIt(collectedSubdirs);
- while (collectedIt.hasNext()) {
- QPair<QString, ProStringList> subdir = collectedIt.next();
+ for (const auto &subdir : qAsConst(collectedSubdirs)) {
QString profile = subdir.first;
QFileInfo fi(fileInfo(Option::normalizePath(profile)));
if (fi.exists()) {
@@ -540,13 +535,13 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
if (tmpList.size()) {
const ProStringList depends = tmpList;
- foreach (const ProString &dep, depends) {
+ for (const ProString &dep : depends) {
QString depend = dep.toQString();
if (!projGuids[depend].isEmpty()) {
newDep->dependencies << projGuids[depend];
} else if (subdirProjectLookup[projLookup[depend]].size() > 0) {
- ProStringList tmpLst = subdirProjectLookup[projLookup[depend]];
- foreach (const ProString &tDep, tmpLst) {
+ const ProStringList tmpLst = subdirProjectLookup[projLookup[depend]];
+ for (const ProString &tDep : tmpLst) {
QString tmpDep = tDep.toQString();
newDep->dependencies << projGuids[projLookup[tmpDep]];
}
@@ -692,10 +687,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
t << _slnGlobalBeg;
- QHashIterator<VcsolutionDepend *, QStringList> extraIt(extraSubdirs);
- while (extraIt.hasNext()) {
- extraIt.next();
- foreach (const QString &depend, extraIt.value()) {
+ for (auto extraIt = extraSubdirs.cbegin(), end = extraSubdirs.cend(); extraIt != end; ++extraIt) {
+ for (const QString &depend : extraIt.value()) {
if (!projGuids[depend].isEmpty()) {
extraIt.key()->dependencies << projGuids[depend];
} else if (!profileLookup[depend].isEmpty()) {
@@ -882,7 +875,7 @@ void VcprojGenerator::init()
// 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
- foreach (const ProString &quc, project->values("QMAKE_EXTRA_COMPILERS")) {
+ 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) {
@@ -908,12 +901,10 @@ void VcprojGenerator::init()
}
#if 0 // Debugging
- Q_FOREACH(QString aKey, extraCompilerSources.keys()) {
- qDebug("Extracompilers for %s are (%s)", aKey.toLatin1().constData(), extraCompilerSources.value(aKey).join(", ").toLatin1().constData());
- }
- Q_FOREACH(QString aKey, extraCompilerOutputs.keys()) {
- qDebug("Object mapping for %s is (%s)", aKey.toLatin1().constData(), extraCompilerOutputs.value(aKey).join(", ").toLatin1().constData());
- }
+ 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("");
#endif
}
@@ -1188,7 +1179,8 @@ void VcprojGenerator::initLinkerTool()
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
for (int i = 0; lflags[i]; i++) {
- foreach (const ProString &lib, fixLibFlags(lflags[i])) {
+ const auto libs = fixLibFlags(lflags[i]);
+ for (const ProString &lib : libs) {
if (lib.startsWith("/LIBPATH:"))
conf.linker.AdditionalLibraryDirectories << lib.mid(9).toQString();
else
@@ -1210,7 +1202,7 @@ void VcprojGenerator::initResourceTool()
else
conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions;
- foreach (const ProString &path, project->values("RC_INCLUDEPATH")) {
+ for (const ProString &path : project->values("RC_INCLUDEPATH")) {
QString fixedPath = fileFixify(path.toQString());
if (fileInfo(fixedPath).isRelative()) {
if (fixedPath == QLatin1String("."))
@@ -1285,7 +1277,7 @@ void VcprojGenerator::initDeploymentTool()
targetPath.chop(1);
conf.deployment.RemoteDirectory = targetPath;
}
- ProStringList dllPaths = project->values("QMAKE_DLL_PATHS");
+ const ProStringList dllPaths = project->values("QMAKE_DLL_PATHS");
// Only deploy Qt libs for shared build
if (!dllPaths.isEmpty() &&
!(conf.WinRT && project->first("MSVC_VER").toQString() == "14.0")) {
@@ -1304,7 +1296,7 @@ void VcprojGenerator::initDeploymentTool()
// 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;
- foreach (const ProString &dllPath, dllPaths) {
+ for (const ProString &dllPath : dllPaths) {
QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/');
@@ -1332,7 +1324,7 @@ void VcprojGenerator::initDeploymentTool()
if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
QFileInfo info2;
- foreach (const ProString &dllPath, dllPaths) {
+ for (const ProString &dllPath : dllPaths) {
QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/');
@@ -1393,7 +1385,7 @@ void VcprojGenerator::initDeploymentTool()
}
}
- foreach (const ProString &item, project->values("INSTALLS")) {
+ for (const ProString &item : project->values("INSTALLS")) {
// get item.path
QString devicePath = project->first(ProKey(item + ".path")).toQString();
if (!conf.WinRT) {
@@ -1408,7 +1400,7 @@ void VcprojGenerator::initDeploymentTool()
}
}
// foreach d in item.files
- foreach (const ProString &src, project->values(ProKey(item + ".files"))) {
+ for (const ProString &src : project->values(ProKey(item + ".files"))) {
QString itemDevicePath = devicePath;
QString source = Option::normalizePath(src.toQString());
QString nameFilter;
@@ -1712,7 +1704,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
// provided that the input file variable is not handled already (those in otherFilters
// are handled, so we avoid them).
const ProStringList &inputVars = project->values(ProKey(*it + ".input"));
- foreach (const ProString &inputVar, inputVars) {
+ 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) {