summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-06-07 13:12:57 +0200
committerLiang Qi <liang.qi@qt.io>2019-06-07 13:19:27 +0200
commit9967a011eaae8988b10e56fde0f2ab8b6bab90ac (patch)
tree353b932414a8d9d94a418e84068550b0a2376b37 /qmake/generators
parent91ab70d17f892f3ff6b2019632fda3920d045dcb (diff)
parent99636127d10f96d8313bc26030cabf9841381914 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: qmake/generators/makefile.cpp src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoaintegration.mm Done-With: Jörg Bornemann <joerg.bornemann@qt.io> Change-Id: I5a61e161784cc6f947abe370aab8f2971a9cbe78
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
-rw-r--r--qmake/generators/makefile.cpp102
-rw-r--r--qmake/generators/makefiledeps.cpp2
-rw-r--r--qmake/generators/projectgenerator.h2
-rw-r--r--qmake/generators/unix/unixmake.cpp2
-rw-r--r--qmake/generators/unix/unixmake2.cpp10
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp1
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp28
-rw-r--r--qmake/generators/win32/msvc_vcproj.h2
-rw-r--r--qmake/generators/win32/winmakefile.cpp2
10 files changed, 93 insertions, 60 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 07832041a7..d5994639b3 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -518,7 +518,6 @@ bool
ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
{
ProStringList tmp;
- bool did_preprocess = false;
//HEADER
const int pbVersion = pbuilderVersion();
@@ -736,7 +735,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QFile mkf(mkfile);
if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {
writingUnixMakefileGenerator = true;
- did_preprocess = true;
debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());
QTextStream mkt(&mkf);
writeHeader(mkt);
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 8ca4d68700..956deba25b 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -900,7 +900,7 @@ MakefileGenerator::processPrlFile(QString &file, bool baseOnly)
bool
MakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName,
- const QStringRef &fixedBase, int slashOff)
+ const QStringRef &fixedBase, int /*slashOff*/)
{
return processPrlFileCore(origFile, origName, fixedBase + Option::prl_ext);
}
@@ -1120,7 +1120,8 @@ MakefileGenerator::writePrlFile()
&& project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()
&& project->isActiveConfig("create_prl")
&& (project->first("TEMPLATE") == "lib"
- || project->first("TEMPLATE") == "vclib")
+ || project->first("TEMPLATE") == "vclib"
+ || project->first("TEMPLATE") == "aux")
&& (!project->isActiveConfig("plugin") || project->isActiveConfig("static"))) { //write prl file
QString local_prl = prlFileName();
QString prl = fileFixify(local_prl);
@@ -2400,8 +2401,15 @@ MakefileGenerator::findSubDirsSubTargets() const
st->profile = file;
}
} else {
- if(!file.isEmpty() && !project->isActiveConfig("subdir_first_pro"))
- st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext;
+ if (!file.isEmpty() && !project->isActiveConfig("subdir_first_pro")) {
+ const QString baseName = file.section(Option::dir_sep, -1);
+ if (baseName.isEmpty()) {
+ warn_msg(WarnLogic, "Ignoring invalid SUBDIRS entry %s",
+ subdirs[subdir].toLatin1().constData());
+ continue;
+ }
+ st->profile = baseName + Option::pro_ext;
+ }
st->in_directory = file;
}
while(st->in_directory.endsWith(Option::dir_sep))
@@ -3352,42 +3360,44 @@ MakefileGenerator::writePkgConfigFile()
if (!version.isEmpty())
t << "Version: " << version << endl;
- // libs
- t << "Libs: ";
- QString pkgConfiglibName;
- if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
- if (libDir != QLatin1String("/Library/Frameworks"))
- t << "-F${libdir} ";
- ProString bundle;
- if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
- bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
- else
- bundle = project->first("TARGET");
- int suffix = bundle.lastIndexOf(".framework");
- if (suffix != -1)
- bundle = bundle.left(suffix);
- t << "-framework ";
- pkgConfiglibName = bundle.toQString();
- } else {
- if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
- t << "-L${libdir} ";
- pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
- if (project->isActiveConfig("shared"))
- pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
- }
- t << shellQuote(pkgConfiglibName) << " \n";
-
- if (project->isActiveConfig("staticlib")) {
- ProStringList libs;
- libs << "LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "LIBS_PRIVATE";
- libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "QMAKE_LIBS_PRIVATE";
- libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
- t << "Libs.private:";
- for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
- t << ' ' << fixLibFlags((*it).toKey()).join(' ');
- t << endl;
+ if (project->first("TEMPLATE") == "lib") {
+ // libs
+ t << "Libs: ";
+ QString pkgConfiglibName;
+ if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
+ if (libDir != QLatin1String("/Library/Frameworks"))
+ t << "-F${libdir} ";
+ ProString bundle;
+ if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+ bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
+ else
+ bundle = project->first("TARGET");
+ int suffix = bundle.lastIndexOf(".framework");
+ if (suffix != -1)
+ bundle = bundle.left(suffix);
+ t << "-framework ";
+ pkgConfiglibName = bundle.toQString();
+ } else {
+ if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
+ t << "-L${libdir} ";
+ pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
+ if (project->isActiveConfig("shared"))
+ pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
+ }
+ t << shellQuote(pkgConfiglibName) << " \n";
+
+ if (project->isActiveConfig("staticlib")) {
+ ProStringList libs;
+ libs << "LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "LIBS_PRIVATE";
+ libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "QMAKE_LIBS_PRIVATE";
+ libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+ t << "Libs.private:";
+ for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
+ t << ' ' << fixLibFlags((*it).toKey()).join(' ');
+ t << endl;
+ }
}
// flags
@@ -3430,19 +3440,23 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
|| project->isActiveConfig("no_sed_meta_install")) {
ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else {
- ret += "-$(SED)";
+ QString sedargs;
const ProStringList &replace_rules = project->values(replace_rule);
for (int r = 0; r < replace_rules.size(); ++r) {
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
if (!match.isEmpty() /*&& match != replace*/) {
- ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
+ sedargs += " -e " + shellQuote("s," + match + "," + replace + ",g");
if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path"))
- ret += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ sedargs += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ "," + windowsifyPath(replace.toQString()) + ",gi");
}
}
- ret += ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ if (sedargs.isEmpty()) {
+ ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
+ } else {
+ ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ }
}
return ret;
}
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index 1aab1987d2..1995cf63ba 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -815,7 +815,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
break;
}
cpp_state = InCode;
- // ... and fall through to handle buffer[x] as such.
+ Q_FALLTHROUGH(); // to handle buffer[x] as such.
case InCode:
// matching quotes (string literals and character literals)
if (buffer[x] == '\'' || buffer[x] == '"') {
diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h
index cbc9f371ab..02a331bd4f 100644
--- a/qmake/generators/projectgenerator.h
+++ b/qmake/generators/projectgenerator.h
@@ -43,7 +43,7 @@ protected:
void init() override;
bool writeMakefile(QTextStream &) override;
- QString escapeFilePath(const QString &path) const override { Q_ASSERT(false); return QString(); }
+ QString escapeFilePath(const QString &) const override { Q_ASSERT(false); return QString(); }
public:
ProjectGenerator();
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 7f42fbe09e..b809bb6c19 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -726,7 +726,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
}
}
}
- if(project->first("TEMPLATE") == "lib") {
+ if (isAux || project->first("TEMPLATE") == "lib") {
QStringList types;
types << "prl" << "libtool" << "pkgconfig";
for(int i = 0; i < types.size(); ++i) {
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 7d8c70ec3b..aafdcf1582 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -48,12 +48,15 @@ void
UnixMakefileGenerator::writePrlFile(QTextStream &t)
{
MakefileGenerator::writePrlFile(t);
+ const ProString tmplt = project->first("TEMPLATE");
+ if (tmplt != "lib" && tmplt != "aux")
+ return;
// libtool support
- if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la
+ if (project->isActiveConfig("create_libtool")) {
writeLibtoolFile();
}
// pkg-config support
- if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
+ if (project->isActiveConfig("create_pc"))
writePkgConfigFile();
}
@@ -1199,7 +1202,8 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ"));
if (project->first("TEMPLATE") == "aux") {
- // nothing
+ project->values("PRL_TARGET") =
+ project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
} else if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if(!project->isEmpty("QMAKE_BUNDLE")) {
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 15c8838054..38253e3a8f 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1990,6 +1990,7 @@ bool VCMIDLTool::parseOption(const char* option)
break;
case 0x5eb7af2: // /header filename
offset = 5;
+ Q_FALLTHROUGH();
case 0x0000358: // /h filename
HeaderFileName = option + offset + 3;
break;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index fd53ec2a6e..b6f7f20564 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1521,6 +1521,18 @@ void VcprojGenerator::initDistributionFiles()
vcProject.DistributionFiles.Config = &(vcProject.Configuration);
}
+QString VcprojGenerator::extraCompilerName(const ProString &extraCompiler,
+ const QStringList &inputs,
+ const QStringList &outputs)
+{
+ QString name = project->values(ProKey(extraCompiler + ".name")).join(' ');
+ if (name.isEmpty())
+ name = extraCompiler.toQString();
+ else
+ name = replaceExtraCompilerVariables(name, inputs, outputs, NoShell);
+ return name;
+}
+
void VcprojGenerator::initExtraCompilerOutputs()
{
ProStringList otherFilters;
@@ -1538,13 +1550,16 @@ void VcprojGenerator::initExtraCompilerOutputs()
<< "YACCSOURCES";
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
- ProString extracompilerName = project->first(ProKey(*it + ".name"));
- if (extracompilerName.isEmpty())
- extracompilerName = (*it);
+ const ProStringList &inputVars = project->values(ProKey(*it + ".input"));
+ ProStringList inputFiles;
+ for (auto var : inputVars)
+ inputFiles.append(project->values(var.toKey()));
+ const ProStringList &outputs = project->values(ProKey(*it + ".output"));
// Create an extra compiler filter and add the files
VCFilter extraCompile;
- extraCompile.Name = extracompilerName.toQString();
+ extraCompile.Name = extraCompilerName(it->toQString(), inputFiles.toQStringList(),
+ outputs.toQStringList());
extraCompile.ParseFiles = _False;
extraCompile.Filter = "";
extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it);
@@ -1557,14 +1572,14 @@ void VcprojGenerator::initExtraCompilerOutputs()
if (!outputVar.isEmpty() && otherFilters.contains(outputVar))
continue;
- QString tmp_out = project->first(ProKey(*it + ".output")).toQString();
+ QString tmp_out = project->first(outputs.first().toKey()).toQString();
if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) {
// Combined output, only one file result
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false));
} else {
// One output file per input
- const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey());
+ const ProStringList &tmp_in = project->values(inputVars.first().toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename))
@@ -1577,7 +1592,6 @@ void VcprojGenerator::initExtraCompilerOutputs()
// build steps there. So, we turn it around and add it to the input files instead,
// 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"));
for (const ProString &inputVar : inputVars) {
if (!otherFilters.contains(inputVar)) {
const ProStringList &tmp_in = project->values(inputVar.toKey());
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 55d36c3762..8f38252274 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -74,6 +74,8 @@ protected:
bool doDepends() const override { return false; } // Never necessary
using Win32MakefileGenerator::replaceExtraCompilerVariables;
QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor) override;
+ QString extraCompilerName(const ProString &extraCompiler, const QStringList &inputs,
+ const QStringList &outputs);
bool supportsMetaBuild() override { return true; }
bool supportsMergedBuilds() override { return true; }
bool mergeBuildProject(MakefileGenerator *other) override;
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 16f9361d13..266bae7e64 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -671,7 +671,7 @@ void Win32MakefileGenerator::writeObjectsPart(QTextStream &t)
t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl;
}
-void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t)
+void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &)
{
}