Fix .sln generation for sub-projects with same TARGET
Sub-projects in VS solutions must have unique project names. If there are multiple projects with the same TARGET then QMAKE_PROJECT_NAME must be set to different values. The .sln generation code did not use QMAKE_PROJECT_NAME and produced .sln files with equally named sub-projects. Replace the 'orig_target' member of VcsolutionDepend with a 'projectName' member and use it when writing the .sln file and for the misnamed "GUID map" that's supposed to have unique keys. This commit amends 9e750d34 (qt/qt.git). Fixes: QTBUG-77639 Change-Id: I81c64f8bc6baeb6d99e9d5808fb73dfd7aaaeeb8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
3b5f9678d7
commit
1d89748772
@ -209,7 +209,9 @@ bool VcprojGenerator::writeProjectMakefile()
|
|||||||
|
|
||||||
struct VcsolutionDepend {
|
struct VcsolutionDepend {
|
||||||
QString uuid;
|
QString uuid;
|
||||||
QString vcprojFile, orig_target, target;
|
QString vcprojFile;
|
||||||
|
QString projectName;
|
||||||
|
QString target;
|
||||||
Target targetType;
|
Target targetType;
|
||||||
QStringList dependencies;
|
QStringList dependencies;
|
||||||
};
|
};
|
||||||
@ -433,7 +435,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
|
|||||||
Option::qmake_mode = old_mode;
|
Option::qmake_mode = old_mode;
|
||||||
|
|
||||||
// We assume project filename is [QMAKE_PROJECT_NAME].vcproj
|
// We assume project filename is [QMAKE_PROJECT_NAME].vcproj
|
||||||
QString vcproj = tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION");
|
const ProString projectName = tmp_vcproj.project->first("QMAKE_PROJECT_NAME");
|
||||||
|
const QString vcproj = projectName + project->first("VCPROJ_EXTENSION");
|
||||||
QString vcprojDir = Option::output_dir;
|
QString vcprojDir = Option::output_dir;
|
||||||
|
|
||||||
// If file doesn't exsist, then maybe the users configuration
|
// If file doesn't exsist, then maybe the users configuration
|
||||||
@ -445,14 +448,14 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
|
|||||||
|
|
||||||
VcsolutionDepend *newDep = new VcsolutionDepend;
|
VcsolutionDepend *newDep = new VcsolutionDepend;
|
||||||
newDep->vcprojFile = vcprojDir + Option::dir_sep + vcproj;
|
newDep->vcprojFile = vcprojDir + Option::dir_sep + vcproj;
|
||||||
newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET").toQString();
|
newDep->projectName = projectName.toQString();
|
||||||
newDep->target = tmp_proj.first("MSVCPROJ_TARGET").toQString().section(Option::dir_sep, -1);
|
newDep->target = tmp_proj.first("MSVCPROJ_TARGET").toQString().section(Option::dir_sep, -1);
|
||||||
newDep->targetType = tmp_vcproj.projectTarget;
|
newDep->targetType = tmp_vcproj.projectTarget;
|
||||||
newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString();
|
newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString();
|
||||||
// We want to store it as the .lib name.
|
// We want to store it as the .lib name.
|
||||||
if (newDep->target.endsWith(".dll"))
|
if (newDep->target.endsWith(".dll"))
|
||||||
newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
|
newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
|
||||||
projGuids.insert(newDep->orig_target, newDep->target);
|
projGuids.insert(newDep->projectName, newDep->target);
|
||||||
|
|
||||||
if (tmpList.size()) {
|
if (tmpList.size()) {
|
||||||
const ProStringList depends = tmpList;
|
const ProStringList depends = tmpList;
|
||||||
@ -591,7 +594,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
|
|||||||
for (QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) {
|
for (QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) {
|
||||||
// ### quoting rules?
|
// ### quoting rules?
|
||||||
t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid
|
t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid
|
||||||
<< "\"" << (*it)->orig_target << "\", \"" << (*it)->vcprojFile
|
<< "\"" << (*it)->projectName << "\", \"" << (*it)->vcprojFile
|
||||||
<< "\", \"" << (*it)->uuid << "\"";
|
<< "\", \"" << (*it)->uuid << "\"";
|
||||||
|
|
||||||
debug_msg(1, "Project %s has dependencies: %s", (*it)->target.toLatin1().constData(), (*it)->dependencies.join(" ").toLatin1().constData());
|
debug_msg(1, "Project %s has dependencies: %s", (*it)->target.toLatin1().constData(), (*it)->dependencies.join(" ").toLatin1().constData());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user