Fix QMAKE_EXTRA_COMPILER names in VS projects
Use the whole value of 'name', not just the first element, and also replace variables like ${QMAKE_FILE_IN}. This fixes the file_copies feature (COPIES) for Visual Studio projects, because for every entry in COPIES an extra compiler is created with a name 'COPY ${QMAKE_FILE_IN}'. Before this patch the name and the generated file filter would be just 'COPY'. However, duplicate filters are being skipped by the VS project generator. All but the first COPIES entry was ignored. Fixes: QTBUG-76010 Change-Id: Icaa5d2cb8d88ae3ef8ce86220198bca1b9e673f5 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
67c569add0
commit
68866b1a7b
@ -1524,6 +1524,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;
|
||||
@ -1541,13 +1553,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);
|
||||
@ -1560,14 +1575,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))
|
||||
@ -1580,7 +1595,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());
|
||||
|
@ -73,6 +73,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user