summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp23
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp244
-rw-r--r--qmake/generators/win32/msvc_nmake.h1
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp98
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h5
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp106
-rw-r--r--qmake/generators/win32/msvc_vcproj.h6
-rw-r--r--qmake/generators/win32/registry.cpp158
-rw-r--r--qmake/generators/win32/registry_p.h73
-rw-r--r--qmake/generators/win32/winmakefile.cpp14
10 files changed, 181 insertions, 547 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index ad2976aa01..0e95766f8e 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -34,7 +34,6 @@
#include <qscopedpointer.h>
#include <qstringlist.h>
#include <qfileinfo.h>
-#include <qversionnumber.h>
QT_BEGIN_NAMESPACE
@@ -625,31 +624,17 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tagValue("RootNamespace", tool.Name)
<< tagValue("Keyword", tool.Keyword);
- QString windowsTargetPlatformVersion;
if (isWinRT) {
xml << tagValue("MinimumVisualStudioVersion", tool.Version)
<< tagValue("DefaultLanguage", "en")
<< tagValue("AppContainerApplication", "true")
<< tagValue("ApplicationType", "Windows Store")
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
- if (tool.SdkVersion == "10.0")
- windowsTargetPlatformVersion = qgetenv("UCRTVERSION");
- } else {
- QByteArray winSDKVersionStr = qgetenv("WindowsSDKVersion").trimmed();
-
- // This environment variable might end with a backslash due to a VS bug.
- if (winSDKVersionStr.endsWith('\\'))
- winSDKVersionStr.chop(1);
-
- QVersionNumber winSDKVersion = QVersionNumber::fromString(
- QString::fromLocal8Bit(winSDKVersionStr));
- if (!winSDKVersion.isNull())
- windowsTargetPlatformVersion = winSDKVersionStr;
- }
- if (!windowsTargetPlatformVersion.isEmpty()) {
- xml << tagValue("WindowsTargetPlatformVersion", windowsTargetPlatformVersion)
- << tagValue("WindowsTargetPlatformMinVersion", windowsTargetPlatformVersion);
}
+ if (!tool.WindowsTargetPlatformVersion.isEmpty())
+ xml << tagValue("WindowsTargetPlatformVersion", tool.WindowsTargetPlatformVersion);
+ if (!tool.WindowsTargetPlatformMinVersion.isEmpty())
+ xml << tagValue("WindowsTargetPlatformMinVersion", tool.WindowsTargetPlatformMinVersion);
xml << closetag();
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index f2cd7c633b..63d89a5388 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -34,23 +34,10 @@
#include <qdiriterator.h>
#include <qset.h>
-#include <registry_p.h>
-
#include <time.h>
QT_BEGIN_NAMESPACE
-static QString nmakePathList(const QStringList &list)
-{
- QStringList pathList;
- pathList.reserve(list.size());
- for (const QString &path : list)
- pathList.append(QDir::cleanPath(path));
-
- return QDir::toNativeSeparators(pathList.join(QLatin1Char(';')))
- .replace('#', QLatin1String("^#")).replace('$', QLatin1String("$$"));
-}
-
NmakeMakefileGenerator::NmakeMakefileGenerator() : usePCH(false), usePCHC(false)
{
@@ -70,180 +57,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
if(Option::mkfile::do_stub_makefile)
return MakefileGenerator::writeStubMakefile(t);
#endif
- if (!project->isHostBuild()) {
- if (project->isActiveConfig(QStringLiteral("winrt"))) {
- QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
- QString compiler;
- QString compilerArch;
- const QString msvcVer = project->first("MSVC_VER").toQString();
- if (msvcVer.isEmpty()) {
- fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
- return false;
- }
-
- if (msvcVer == QStringLiteral("15.0")) {
- const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
- if (hostArch.contains("x86_64"))
- compiler = QStringLiteral("HostX64/");
- else
- compiler = QStringLiteral("HostX86/");
- if (arch == QLatin1String("arm")) {
- compiler += QStringLiteral("arm");
- compilerArch = QStringLiteral("arm");
- } else if (arch == QLatin1String("x64")) {
- compiler += QStringLiteral("x64");
- compilerArch = QStringLiteral("amd64");
- } else {
- arch = QStringLiteral("x86");
- compiler += QStringLiteral("x86");
- }
- } else {
- if (arch == QLatin1String("arm")) {
- compiler = QStringLiteral("x86_arm");
- compilerArch = QStringLiteral("arm");
- } else if (arch == QLatin1String("x64")) {
- const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
- if (hostArch.contains("x86_64"))
- compiler = QStringLiteral("amd64");
- else
- compiler = QStringLiteral("x86_amd64");
- compilerArch = QStringLiteral("amd64");
- } else {
- arch = QStringLiteral("x86");
- }
- }
-
- const QString winsdkVer = project->first("WINSDK_VER").toQString();
- if (winsdkVer.isEmpty()) {
- fprintf(stderr, "Mkspec does not specify WINSDK_VER. Cannot continue.\n");
- return false;
- }
- const QString targetVer = project->first("WINTARGET_VER").toQString();
- if (targetVer.isEmpty()) {
- fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n");
- return false;
- }
-
-#ifdef Q_OS_WIN
- QString regKey;
- if (msvcVer == QStringLiteral("15.0"))
- regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\SxS\\VS7\\") + msvcVer;
- else
- regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\") + msvcVer + ("\\Setup\\VC\\ProductDir");
- const QString vcInstallDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey, KEY_WOW64_32KEY);
- if (vcInstallDir.isEmpty()) {
- fprintf(stderr, "Failed to find the Visual Studio installation directory.\n");
- return false;
- }
-
- const QString windowsPath = "Software\\Microsoft\\Microsoft SDKs\\Windows\\v";
-
- regKey = windowsPath + winsdkVer + QStringLiteral("\\InstallationFolder");
- const QString kitDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey, KEY_WOW64_32KEY);
- if (kitDir.isEmpty()) {
- fprintf(stderr, "Failed to find the Windows Kit installation directory.\n");
- return false;
- }
-#else
- const QString vcInstallDir = "/fake/vc_install_dir";
- const QString kitDir = "/fake/sdk_install_dir";
-#endif // Q_OS_WIN
- QStringList incDirs;
- QStringList libDirs;
- QStringList binDirs;
- if (msvcVer == QStringLiteral("15.0")) {
- const QString toolsInstallDir = qgetenv("VCToolsInstallDir");
- if (toolsInstallDir.isEmpty()) {
- fprintf(stderr, "Failed to access tools installation dir.\n");
- return false;
- }
-
- binDirs << toolsInstallDir + QStringLiteral("bin/") + compiler;
- if (arch == QStringLiteral("x64"))
- binDirs << toolsInstallDir + QStringLiteral("bin/HostX86/X86");
- binDirs << kitDir + QStringLiteral("bin/x86");
- binDirs << vcInstallDir + QStringLiteral("Common7/Tools");
- binDirs << vcInstallDir + QStringLiteral("Common7/ide");
- binDirs << vcInstallDir + QStringLiteral("MSBuild/15.0/bin");
-
- incDirs << toolsInstallDir + QStringLiteral("include");
- incDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/include");
-
- const QString crtVersion = qgetenv("UCRTVersion");
- if (crtVersion.isEmpty()) {
- fprintf(stderr, "Failed to access CRT version.\n");
- return false;
- }
- const QString crtInclude = kitDir + QStringLiteral("Include/") + crtVersion;
- const QString crtLib = kitDir + QStringLiteral("Lib/") + crtVersion;
- incDirs << crtInclude + QStringLiteral("/ucrt");
- incDirs << crtInclude + QStringLiteral("/um");
- incDirs << crtInclude + QStringLiteral("/shared");
- incDirs << crtInclude + QStringLiteral("/winrt");
-
- incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/")
- + crtVersion + QStringLiteral("/Include/WinRT");
-
- libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store");
-
- libDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/lib/") + arch;
-
- libDirs << crtLib + QStringLiteral("/ucrt/") + arch;
- libDirs << crtLib + QStringLiteral("/um/") + arch;
- } else if (msvcVer == QStringLiteral("14.0")) {
- binDirs << vcInstallDir + QStringLiteral("bin/") + compiler;
- binDirs << vcInstallDir + QStringLiteral("bin/"); // Maybe remove for x86 again?
- binDirs << kitDir + QStringLiteral("bin/") + (arch == QStringLiteral("arm") ? QStringLiteral("x86") : arch);
- binDirs << vcInstallDir + QStringLiteral("../Common7/Tools/bin");
- binDirs << vcInstallDir + QStringLiteral("../Common7/Tools");
- binDirs << vcInstallDir + QStringLiteral("../Common7/ide");
- binDirs << kitDir + QStringLiteral("Windows Performance Toolkit/");
-
- incDirs << vcInstallDir + QStringLiteral("include");
- incDirs << vcInstallDir + QStringLiteral("atlmfc/include");
-
- const QString crtVersion = qgetenv("UCRTVersion");
- if (crtVersion.isEmpty()) {
- fprintf(stderr, "Failed to access CRT version.\n");
- return false;
- }
- const QString crtInclude = kitDir + QStringLiteral("Include/") + crtVersion;
- const QString crtLib = kitDir + QStringLiteral("Lib/") + crtVersion;
- incDirs << crtInclude + QStringLiteral("/ucrt");
- incDirs << crtInclude + QStringLiteral("/um");
- incDirs << crtInclude + QStringLiteral("/shared");
- incDirs << crtInclude + QStringLiteral("/winrt");
-
- incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/")
- + crtVersion + QStringLiteral("/Include/WinRT");
-
- libDirs << vcInstallDir + QStringLiteral("lib/store/") + compilerArch;
- libDirs << vcInstallDir + QStringLiteral("atlmfc/lib") + compilerArch;
-
- libDirs << crtLib + QStringLiteral("/ucrt/") + arch;
- libDirs << crtLib + QStringLiteral("/um/") + arch;
- } else {
- incDirs << vcInstallDir + QStringLiteral("/include");
- libDirs << vcInstallDir + QStringLiteral("/lib/store/") + compilerArch
- << vcInstallDir + QStringLiteral("/lib/") + compilerArch;
- binDirs << vcInstallDir + QStringLiteral("/bin/") + compiler
- << vcInstallDir + QStringLiteral("/../Common7/IDE");
- libDirs << kitDir + QStringLiteral("/Lib/") + targetVer + ("/um/") + arch;
- incDirs << kitDir + QStringLiteral("/include/um")
- << kitDir + QStringLiteral("/include/shared")
- << kitDir + QStringLiteral("/include/winrt");
- }
-
- binDirs << vcInstallDir + QStringLiteral("/bin");
-
- // Inherit PATH
- binDirs << QString::fromLocal8Bit(qgetenv("PATH")).split(QLatin1Char(';'));
-
- t << "\nINCLUDE = " << nmakePathList(incDirs);
- t << "\nLIB = " << nmakePathList(libDirs);
- t << "\nPATH = " << nmakePathList(binDirs) << '\n';
- }
- }
writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t);
}
@@ -263,6 +76,11 @@ void NmakeMakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &cal
Win32MakefileGenerator::writeSubMakeCall(t, callPrefix, makeArguments);
}
+ProStringList NmakeMakefileGenerator::extraSubTargetDependencies()
+{
+ return { "$(MAKEFILE)" };
+}
+
QString NmakeMakefileGenerator::defaultInstall(const QString &t)
{
QString ret = Win32MakefileGenerator::defaultInstall(t);
@@ -277,7 +95,9 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
if (project->isActiveConfig("debug_info")) {
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
- QString pdb_target = project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb";
+ const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
+ + project->first("TARGET_EXT");
+ const QString pdb_target = targetFileInfo.completeBaseName() + ".pdb";
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
if(!ret.isEmpty())
@@ -345,21 +165,17 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const
|| value == "QMAKE_RUN_CXX_IMP"
|| value == "QMAKE_RUN_CXX");
if ((isRunCpp && usePCH) || (isRunC && usePCHC)) {
- QFileInfo precompHInfo(fileInfo(precompH));
- QString precompH_f = escapeFilePath(precompHInfo.fileName());
+ QString precompH_f = escapeFilePath(fileFixify(precompH, FileFixifyBackwards));
QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3")
.arg(precompH_f, precompH_f, escapeFilePath(isRunC ? precompPchC : precompPch));
+ // ### For clang_cl 8 we force inline methods to be compiled here instead
+ // linking them from a pch.o file. We do this by pretending we are also doing
+ // the pch.o generation step.
+ if (project->isActiveConfig("clang_cl"))
+ precompRule += QString(" -Xclang -building-pch-with-obj");
QString p = MakefileGenerator::var(value);
p.replace(QLatin1String("-c"), precompRule);
- // Cannot use -Gm with -FI & -Yu, as this gives an
- // internal compiler error, on the newer compilers
- // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
- p.remove("-Gm");
return p;
- } else if (value == "QMAKE_CXXFLAGS") {
- // Remove internal compiler error option
- // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
- return MakefileGenerator::var(value).remove("-Gm");
}
}
@@ -418,7 +234,10 @@ void NmakeMakefileGenerator::init()
precompObj = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext;
precompPch = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch.pch";
// Add linking of precompObj (required for whole precompiled classes)
- project->values("OBJECTS") += precompObj;
+ // ### For clang_cl we currently let inline methods be generated in the normal objects,
+ // since the PCH object is buggy (as of clang 8.0.0)
+ if (!project->isActiveConfig("clang_cl"))
+ project->values("OBJECTS") += precompObj;
// Add pch file to cleanup
project->values("QMAKE_CLEAN") += precompPch;
// Return to variable pool
@@ -428,21 +247,23 @@ void NmakeMakefileGenerator::init()
if (usePCHC) {
precompObjC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c" + Option::obj_ext;
precompPchC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c.pch";
- project->values("OBJECTS") += precompObjC;
+ if (!project->isActiveConfig("clang_cl"))
+ project->values("OBJECTS") += precompObjC;
project->values("QMAKE_CLEAN") += precompPchC;
project->values("PRECOMPILED_OBJECT_C") = ProStringList(precompObjC);
project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC);
}
- ProString tgt = project->first("DESTDIR")
- + project->first("TARGET") + project->first("TARGET_VERSION_EXT");
- if(project->isActiveConfig("shared")) {
- project->values("QMAKE_CLEAN").append(tgt + ".exp");
- project->values("QMAKE_DISTCLEAN").append(tgt + ".lib");
+ const QFileInfo targetFileInfo = project->first("DESTDIR") + project->first("TARGET")
+ + project->first("TARGET_EXT");
+ const ProString targetBase = targetFileInfo.path() + '/' + targetFileInfo.completeBaseName();
+ if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("shared")) {
+ project->values("QMAKE_CLEAN").append(targetBase + ".exp");
+ project->values("QMAKE_DISTCLEAN").append(targetBase + ".lib");
}
if (project->isActiveConfig("debug_info")) {
QString pdbfile;
- QString distPdbFile = tgt + ".pdb";
+ QString distPdbFile = targetBase + ".pdb";
if (project->isActiveConfig("staticlib")) {
// For static libraries, the compiler's pdb file and the dist pdb file are the same.
pdbfile = distPdbFile;
@@ -458,8 +279,8 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_DISTCLEAN").append(distPdbFile);
}
if (project->isActiveConfig("debug")) {
- project->values("QMAKE_CLEAN").append(tgt + ".ilk");
- project->values("QMAKE_CLEAN").append(tgt + ".idb");
+ project->values("QMAKE_CLEAN").append(targetBase + ".ilk");
+ project->values("QMAKE_CLEAN").append(targetBase + ".idb");
} else {
ProStringList &defines = project->values("DEFINES");
if (!defines.contains("NDEBUG"))
@@ -531,12 +352,13 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
while (dit.hasNext()) {
dit.next();
- QString &duplicate = fileNames[dit.fileName()];
+ const QFileInfo fi = dit.fileInfo();
+ QString &duplicate = fileNames[fi.completeBaseName()];
if (duplicate.isNull()) {
- duplicate = dit.filePath();
+ duplicate = fi.filePath();
} else {
warn_msg(WarnLogic, "%s conflicts with %s", qPrintable(duplicate),
- qPrintable(dit.filePath()));
+ qPrintable(fi.filePath()));
duplicatesFound = true;
}
}
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index 67a56c7813..5bfdba2bbc 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -48,6 +48,7 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator
protected:
void writeSubMakeCall(QTextStream &t, const QString &callPrefix,
const QString &makeArguments) override;
+ ProStringList extraSubTargetDependencies() override;
QString defaultInstall(const QString &t) override;
QStringList &findDependencies(const QString &file) override;
QString var(const ProKey &value) const override;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 4f0cee65e1..cf0b96ec9f 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -55,7 +55,8 @@ static DotNET vsVersionFromString(const char *versionString)
{ "11.0", NET2012 },
{ "12.0", NET2013 },
{ "14.0", NET2015 },
- { "15.0", NET2017 }
+ { "15.0", NET2017 },
+ { "16.0", NET2019 }
};
DotNET result = NETUnknown;
for (const auto entry : mapping) {
@@ -2213,8 +2214,49 @@ void VCFilter::addFiles(const ProStringList& fileList)
void VCFilter::modifyPCHstage(QString str)
{
- bool autogenSourceFile = Project->autogenPrecompCPP;
- bool pchThroughSourceFile = !Project->precompCPP.isEmpty();
+ const bool isHFile = (str == Project->precompH);
+ const bool pchThroughSourceFile = !Project->precompSource.isEmpty();
+ if (isHFile && pchThroughSourceFile && Project->autogenPrecompSource) {
+ useCustomBuildTool = true;
+ QString toFile(Project->precompSource);
+ CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ...";
+ CustomBuildTool.Outputs += toFile;
+
+ QStringList lines;
+ CustomBuildTool.CommandLine +=
+ "echo /*-------------------------------------------------------------------- >" + toFile;
+ lines << "* Precompiled header source file used by Visual Studio.NET to generate";
+ lines << "* the .pch file.";
+ lines << "*";
+ lines << "* Due to issues with the dependencies checker within the IDE, it";
+ lines << "* sometimes fails to recompile the PCH file, if we force the IDE to";
+ lines << "* create the PCH file directly from the header file.";
+ lines << "*";
+ lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was";
+ lines << "* specified, and is used as the common stdafx.cpp. The file is only";
+ lines << QLatin1String("* generated when creating ")
+ + (Config->CompilerVersion < NET2010 ? ".vcproj" : ".vcxproj")
+ + " project files, and is not used for";
+ lines << "* command line compilations by nmake.";
+ lines << "*";
+ lines << "* WARNING: All changes made in this file will be lost.";
+ lines << "--------------------------------------------------------------------*/";
+ lines << "#include \"" + Project->precompHFilename + "\"";
+ for (const QString &line : qAsConst(lines))
+ CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
+ return;
+ }
+
+ useCompilerTool = true;
+ const bool isPrecompSource = pchThroughSourceFile && (str == Project->precompSource);
+ if (isPrecompSource) {
+ CompilerTool.UsePrecompiledHeader = pchCreateUsingSpecific;
+ if (Project->autogenPrecompSource)
+ CompilerTool.PrecompiledHeaderThrough = Project->precompHFilename;
+ CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
+ return;
+ }
+
bool isCFile = false;
for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
if (str.endsWith(*it)) {
@@ -2222,53 +2264,13 @@ void VCFilter::modifyPCHstage(QString str)
break;
}
}
- const bool isHFile = (str == Project->precompH);
- bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP);
-
- if(!isCFile && !isHFile && !isCPPFile)
- return;
-
- if(isHFile && pchThroughSourceFile) {
- if (autogenSourceFile) {
- useCustomBuildTool = true;
- QString toFile(Project->precompCPP);
- CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ...";
- CustomBuildTool.Outputs += toFile;
-
- QStringList lines;
- CustomBuildTool.CommandLine +=
- "echo /*-------------------------------------------------------------------- >" + toFile;
- lines << "* Precompiled header source file used by Visual Studio.NET to generate";
- lines << "* the .pch file.";
- lines << "*";
- lines << "* Due to issues with the dependencies checker within the IDE, it";
- lines << "* sometimes fails to recompile the PCH file, if we force the IDE to";
- lines << "* create the PCH file directly from the header file.";
- lines << "*";
- lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was";
- lines << "* specified, and is used as the common stdafx.cpp. The file is only";
- lines << QLatin1String("* generated when creating ")
- + (Config->CompilerVersion < NET2010 ? ".vcproj" : ".vcxproj")
- + " project files, and is not used for";
- lines << "* command line compilations by nmake.";
- lines << "*";
- lines << "* WARNING: All changes made in this file will be lost.";
- lines << "--------------------------------------------------------------------*/";
- lines << "#include \"" + Project->precompHFilename + "\"";
- for (const QString &line : qAsConst(lines))
- CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
- }
- return;
- }
- useCompilerTool = true;
- // Setup PCH options
- CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific);
- if (isCFile)
+ bool pchCompatible = (isCFile == Project->pchIsCFile);
+ if (!pchCompatible) {
+ CompilerTool.UsePrecompiledHeader = pchNone;
CompilerTool.PrecompiledHeaderThrough = QLatin1String("$(NOINHERIT)");
- else if (autogenSourceFile)
- CompilerTool.PrecompiledHeaderThrough = Project->precompHFilename;
- CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
+ CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
+ }
}
VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 9d1a170489..33a96bf85e 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -52,7 +52,8 @@ enum DotNET {
NET2012 = 0xb0,
NET2013 = 0xc0,
NET2015 = 0xd0,
- NET2017 = 0xe0
+ NET2017 = 0xe0,
+ NET2019
};
DotNET vsVersionFromString(const ProString &versionString);
@@ -1123,6 +1124,8 @@ public:
QString SccLocalPath;
QString PlatformName;
QString SdkVersion;
+ QString WindowsTargetPlatformVersion;
+ QString WindowsTargetPlatformMinVersion;
// Single projects
QList<VCProjectSingleConfig> SingleProjects;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index f7837fc1b4..fd53ec2a6e 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -73,7 +73,9 @@ const char _slnHeader120[] = "Microsoft Visual Studio Solution File, Format
const char _slnHeader140[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
"\n# Visual Studio 2015";
const char _slnHeader141[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
- "\n# Visual Studio 2017";
+ "\n# Visual Studio 15";
+const char _slnHeader142[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
+ "\n# Visual Studio Version 16";
// 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
@@ -191,6 +193,10 @@ bool VcprojGenerator::writeProjectMakefile()
mergedProject.SccProjectName = mergedProjects.at(0)->vcProject.SccProjectName;
mergedProject.SccLocalPath = mergedProjects.at(0)->vcProject.SccLocalPath;
mergedProject.PlatformName = mergedProjects.at(0)->vcProject.PlatformName;
+ mergedProject.WindowsTargetPlatformVersion =
+ project->first("WINDOWS_TARGET_PLATFORM_VERSION").toQString();
+ mergedProject.WindowsTargetPlatformMinVersion =
+ project->first("WINDOWS_TARGET_PLATFORM_MIN_VERSION").toQString();
XmlOutput xmlOut(t);
projectWriter->write(xmlOut, mergedProject);
@@ -208,6 +214,16 @@ struct VcsolutionDepend {
QStringList dependencies;
};
+/* Disable optimization in getProjectUUID() due to a compiler
+ * bug in MSVC 2015 that causes ASSERT: "&other != this" in the QString
+ * copy constructor for non-empty file names at:
+ * filename.isEmpty()?project->first("QMAKE_MAKEFILE"):filename */
+
+#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
+# pragma optimize( "g", off )
+# pragma warning ( disable : 4748 )
+#endif
+
QUuid VcprojGenerator::getProjectUUID(const QString &filename)
{
bool validUUID = true;
@@ -239,6 +255,10 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename)
return uuid;
}
+#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
+# pragma optimize( "g", on )
+#endif
+
QUuid VcprojGenerator::increaseUUID(const QUuid &id)
{
QUuid result(id);
@@ -287,6 +307,8 @@ QString VcprojGenerator::retrievePlatformToolSet() const
return QStringLiteral("v140");
case NET2017:
return QStringLiteral("v141");
+ case NET2019:
+ return QStringLiteral("v142");
default:
return QString();
}
@@ -459,8 +481,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// Add all unknown libs to the deps
QStringList where = QStringList() << "LIBS" << "LIBS_PRIVATE"
<< "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
- for (QStringList::ConstIterator wit = where.begin();
- wit != where.end(); ++wit) {
+ for (QStringList::ConstIterator wit = where.cbegin();
+ wit != where.cend(); ++wit) {
const ProStringList &l = tmp_proj.values(ProKey(*wit));
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
const QString opt = fixLibFlag(*it).toQString();
@@ -513,6 +535,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
}
switch (vcProject.Configuration.CompilerVersion) {
+ case NET2019:
+ t << _slnHeader142;
+ break;
case NET2017:
t << _slnHeader141;
break;
@@ -757,8 +782,9 @@ void VcprojGenerator::init()
// Setup PCH variables
precompH = project->first("PRECOMPILED_HEADER").toQString();
- precompCPP = project->first("PRECOMPILED_SOURCE").toQString();
- usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
+ precompSource = project->first("PRECOMPILED_SOURCE").toQString();
+ pchIsCFile = project->isActiveConfig("precompile_header_c");
+ usePCH = !precompH.isEmpty() && (pchIsCFile || project->isActiveConfig("precompile_header"));
if (usePCH) {
precompHFilename = fileInfo(precompH).fileName();
// Created files
@@ -772,13 +798,15 @@ void VcprojGenerator::init()
project->values("PRECOMPILED_OBJECT") = ProStringList(precompObj);
project->values("PRECOMPILED_PCH") = ProStringList(precompPch);
- autogenPrecompCPP = precompCPP.isEmpty() && project->isActiveConfig("autogen_precompile_source");
- if (autogenPrecompCPP) {
- precompCPP = precompH
- + (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"));
- project->values("GENERATED_SOURCES") += precompCPP;
- } else if (!precompCPP.isEmpty()) {
- project->values("SOURCES") += precompCPP;
+ autogenPrecompSource = precompSource.isEmpty() && project->isActiveConfig("autogen_precompile_source");
+ 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")));
+ project->values("GENERATED_SOURCES") += precompSource;
+ } else if (!precompSource.isEmpty()) {
+ project->values("SOURCES") += precompSource;
}
}
@@ -860,6 +888,9 @@ void VcprojGenerator::initProject()
// Own elements -----------------------------
vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString();
switch (vcProject.Configuration.CompilerVersion) {
+ case NET2019:
+ vcProject.Version = "16.00";
+ break;
case NET2017:
vcProject.Version = "15.00";
break;
@@ -1032,16 +1063,6 @@ void VcprojGenerator::initCompilerTool()
conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch;
conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER").toQString();
conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER").toQStringList();
-
- if (conf.CompilerVersion <= NET2003) {
- // Minimal build option triggers an Internal Compiler Error
- // when used in conjunction with /FI and /Yu, so remove it
- // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm");
- }
}
conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
@@ -1326,7 +1347,7 @@ void VcprojGenerator::initWinDeployQtTool()
// structure manually by invoking windeployqt a second time, so that
// the MDILXapCompile call succeeds and deployment continues.
conf.windeployqt.CommandLine += commandLine
- + QStringLiteral(" -list relative -dir \"$(MSBuildProjectDirectory)\" \"$(OutDir)\\$(TargetName).exe\" > ")
+ + QStringLiteral(" -list relative -dir \"$(MSBuildProjectDirectory)\" \"$(OutDir)\\$(TargetFileName)\" > ")
+ MakefileGenerator::shellQuote(conf.windeployqt.Record);
conf.windeployqt.config = &vcProject.Configuration;
conf.windeployqt.ExcludedFromBuild = false;
@@ -1423,6 +1444,7 @@ void VcprojGenerator::initTranslationFiles()
vcProject.TranslationFiles.Guid = _GUIDTranslationFiles;
vcProject.TranslationFiles.addFiles(project->values("TRANSLATIONS"));
+ vcProject.TranslationFiles.addFiles(project->values("EXTRA_TRANSLATIONS"));
vcProject.TranslationFiles.Project = this;
vcProject.TranslationFiles.Config = &(vcProject.Configuration);
@@ -1527,14 +1549,14 @@ void VcprojGenerator::initExtraCompilerOutputs()
extraCompile.Filter = "";
extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it);
- // If the extra compiler has a variable_out set the output file
- // is added to an other file list, and does not need its own..
bool addOnInput = hasBuiltinCompiler(firstExpandedOutputFileName(*it));
- const ProString &tmp_other_out = project->first(ProKey(*it + ".variable_out"));
- if (!tmp_other_out.isEmpty() && !addOnInput)
- continue;
-
if (!addOnInput) {
+ // If the extra compiler has a variable_out set that is already handled
+ // some other place, ignore it.
+ const ProString &outputVar = project->first(ProKey(*it + ".variable_out"));
+ if (!outputVar.isEmpty() && otherFilters.contains(outputVar))
+ continue;
+
QString tmp_out = project->first(ProKey(*it + ".output")).toQString();
if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) {
// Combined output, only one file result
@@ -1545,7 +1567,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
- if (extraCompilerSources.contains(filename))
+ if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(filename, tmp_out, QString(), NoShell), false));
}
@@ -1561,7 +1583,7 @@ void VcprojGenerator::initExtraCompilerOutputs()
const ProStringList &tmp_in = project->values(inputVar.toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
- if (extraCompilerSources.contains(filename))
+ if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(filename, QString(), QString(), NoShell), false));
}
@@ -1575,6 +1597,28 @@ void VcprojGenerator::initExtraCompilerOutputs()
}
}
+bool VcprojGenerator::otherFiltersContain(const QString &fileName) const
+{
+ auto filterFileMatches = [&fileName] (const VCFilterFile &ff)
+ {
+ return ff.file == fileName;
+ };
+ for (const VCFilter *filter : { &vcProject.RootFiles,
+ &vcProject.SourceFiles,
+ &vcProject.HeaderFiles,
+ &vcProject.GeneratedFiles,
+ &vcProject.LexYaccFiles,
+ &vcProject.TranslationFiles,
+ &vcProject.FormFiles,
+ &vcProject.ResourceFiles,
+ &vcProject.DeploymentFiles,
+ &vcProject.DistributionFiles}) {
+ if (std::any_of(filter->Files.cbegin(), filter->Files.cend(), filterFileMatches))
+ return true;
+ }
+ return false;
+}
+
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 6af5ec7007..55d36c3762 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -57,15 +57,16 @@ public:
~VcprojGenerator();
QString defaultMakefile() const;
- QString precompH, precompHFilename, precompCPP,
+ QString precompH, precompHFilename, precompSource,
precompObj, precompPch;
- bool autogenPrecompCPP;
+ bool autogenPrecompSource;
static bool hasBuiltinCompiler(const QString &file);
QHash<QString, QStringList> extraCompilerSources;
QHash<QString, QString> extraCompilerOutputs;
const QString customBuildToolFilterFileSuffix;
bool usePCH;
+ bool pchIsCFile = false;
VCProjectWriter *projectWriter;
protected:
@@ -131,6 +132,7 @@ private:
ProString firstInputFileName(const ProString &extraCompilerName) const;
QString firstExpandedOutputFileName(const ProString &extraCompilerName);
void createCustomBuildToolFakeFile(const QString &cbtFilePath, const QString &realOutFilePath);
+ bool otherFiltersContain(const QString &fileName) const;
friend class VCFilter;
};
diff --git a/qmake/generators/win32/registry.cpp b/qmake/generators/win32/registry.cpp
deleted file mode 100644
index 3391ab9512..0000000000
--- a/qmake/generators/win32/registry.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QtCore/qstringlist.h>
-#include "registry_p.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_OS_WIN32
-/*
- Returns the path part of a registry key.
- e.g.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\"
-*/
-static QString keyPath(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return QString();
- return rKey.left(idx + 1);
-}
-
-/*
- Returns the name part of a registry key.
- e.g.
- For a key
- "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"
- it returns
- "ProductDir"
-*/
-static QString keyName(const QString &rKey)
-{
- int idx = rKey.lastIndexOf(QLatin1Char('\\'));
- if (idx == -1)
- return rKey;
-
- QString res(rKey.mid(idx + 1));
- if (res == QLatin1String("Default") || res == QLatin1String("."))
- res = QString();
- return res;
-}
-#endif
-
-QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned long options)
-{
- QString result;
-
-#ifdef Q_OS_WIN32
- QString rSubkeyName = keyName(rSubkey);
- QString rSubkeyPath = keyPath(rSubkey);
-
- HKEY handle = nullptr;
- LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0,
- KEY_READ | options, &handle);
-
- if (res != ERROR_SUCCESS)
- return QString();
-
- // get the size and type of the value
- DWORD dataType;
- DWORD dataSize;
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), nullptr, &dataType, nullptr, &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- // get the value
- QByteArray data(dataSize, 0);
- res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), nullptr, nullptr,
- reinterpret_cast<unsigned char*>(data.data()), &dataSize);
- if (res != ERROR_SUCCESS) {
- RegCloseKey(handle);
- return QString();
- }
-
- switch (dataType) {
- case REG_EXPAND_SZ:
- case REG_SZ: {
- result = QString::fromWCharArray(((const wchar_t *)data.constData()));
- break;
- }
-
- case REG_MULTI_SZ: {
- QStringList l;
- int i = 0;
- for (;;) {
- QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i);
- i += s.length() + 1;
-
- if (s.isEmpty())
- break;
- l.append(s);
- }
- result = l.join(QLatin1String(", "));
- break;
- }
-
- case REG_NONE:
- case REG_BINARY: {
- result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2);
- break;
- }
-
- case REG_DWORD_BIG_ENDIAN:
- case REG_DWORD: {
- Q_ASSERT(data.size() == sizeof(int));
- int i;
- memcpy((char*)&i, data.constData(), sizeof(int));
- result = QString::number(i);
- break;
- }
-
- default:
- qWarning("QSettings: unknown data %u type in windows registry", quint32(dataType));
- break;
- }
-
- RegCloseKey(handle);
-#else
- Q_UNUSED(parentHandle);
- Q_UNUSED(rSubkey)
- Q_UNUSED(options);
-#endif
-
- return result;
-}
-
-QT_END_NAMESPACE
-
diff --git a/qmake/generators/win32/registry_p.h b/qmake/generators/win32/registry_p.h
deleted file mode 100644
index 3526dffd45..0000000000
--- a/qmake/generators/win32/registry_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QT_WINDOWS_REGISTRY_H
-#define QT_WINDOWS_REGISTRY_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_WIN32
- #include <QtCore/qt_windows.h>
-#else
- typedef void* HKEY;
-#endif
-
-#include <QtCore/qstring.h>
-
-/**
- * Read a value from the Windows registry.
- *
- * If the key is not found, or the registry cannot be accessed (for example
- * if this code is compiled for a platform other than Windows), a null
- * string is returned.
- *
- * 32-bit code reads from the registry's 32 bit view (Wow6432Node),
- * 64 bit code reads from the 64 bit view.
- * Pass KEY_WOW64_32KEY to access the 32 bit view regardless of the
- * application's architecture, KEY_WOW64_64KEY respectively.
- */
-QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey,
- unsigned long options = 0);
-
-QT_END_NAMESPACE
-
-#endif // QT_WINDOWS_REGISTRY_H
-
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index e0d03ccc1c..16f9361d13 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -84,6 +84,9 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
if (impexts.isEmpty())
impexts = project->values("QMAKE_EXTENSION_STATICLIB");
QList<QMakeLocalFileName> dirs;
+ int libidx = 0;
+ for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS"))
+ dirs.append(QMakeLocalFileName(dlib.toQString()));
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; lflags[i]; i++) {
@@ -94,11 +97,12 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
LibFlagType type = parseLibFlag(opt, &arg);
if (type == LibFlagPath) {
QMakeLocalFileName lp(arg.toQString());
- if (dirs.contains(lp)) {
+ int idx = dirs.indexOf(lp);
+ if (idx >= 0 && idx < libidx) {
it = l.erase(it);
continue;
}
- dirs.append(lp);
+ dirs.insert(libidx++, lp);
(*it) = "-L" + lp.real();
} else if (type == LibFlagLib) {
QString lib = arg.toQString();
@@ -112,8 +116,8 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
goto found;
}
QString libBase = (*dir_it).local() + '/' + lib + verovr;
- for (ProStringList::ConstIterator extit = impexts.begin();
- extit != impexts.end(); ++extit) {
+ for (ProStringList::ConstIterator extit = impexts.cbegin();
+ extit != impexts.cend(); ++extit) {
if (exists(libBase + '.' + *extit)) {
(*it) = cand + verovr + '.' + *extit;
goto found;
@@ -520,6 +524,8 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t)
void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
{
+ writeExportedVariables(t);
+
t << "####### Compiler, tools and options\n\n";
t << "CC = " << var("QMAKE_CC") << endl;
t << "CXX = " << var("QMAKE_CXX") << endl;