fix setup of output directory for subprojects in IDE generator backends

unlike before, the output dir is now important already during the project
evaluation phase, as finding .qmake.conf depends on it if .qmake.cache is
also present.

ChangeLog: fixed qmake -tp vc (and configure without -no-vcproj)
Change-Id: Ifdb95f3b38a70c0d08e71238059292e761dcfa53
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-02-27 19:12:02 +01:00 committed by The Qt Project
parent 79a144d746
commit ec145129c3
2 changed files with 9 additions and 5 deletions

View File

@ -136,6 +136,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
QList<ProjectBuilderSubDirs*> pb_subdirs;
pb_subdirs.append(new ProjectBuilderSubDirs(project, QString(), false));
QString oldpwd = qmake_getpwd();
QString oldoutpwd = Option::output_dir;
QMap<QString, ProStringList> groups;
for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) {
ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir];
@ -172,6 +173,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
if(!qmake_setpwd(dir))
fprintf(stderr, "Cannot find directory: %s\n", dir.toLatin1().constData());
}
Option::output_dir = Option::globals->shadowedPath(QDir::cleanPath(fi.absoluteFilePath()));
if(tmp_proj.read(fn)) {
if(tmp_proj.first("TEMPLATE") == "subdirs") {
QMakeProject *pp = new QMakeProject(&tmp_proj);
@ -189,13 +191,13 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
bool in_root = true;
QString name = qmake_getpwd();
if(project->isActiveConfig("flat")) {
QString flat_file = fileFixify(name, oldpwd, Option::output_dir, FileFixifyRelative);
QString flat_file = fileFixify(name, oldpwd, oldoutpwd, FileFixifyRelative);
if(flat_file.indexOf(Option::dir_sep) != -1) {
QStringList dirs = flat_file.split(Option::dir_sep);
name = dirs.back();
}
} else {
QString flat_file = fileFixify(name, oldpwd, Option::output_dir, FileFixifyRelative);
QString flat_file = fileFixify(name, oldpwd, oldoutpwd, FileFixifyRelative);
if(QDir::isRelativePath(flat_file) && flat_file.indexOf(Option::dir_sep) != -1) {
QString last_grp("QMAKE_SUBDIR_PBX_HEIR_GROUP");
QStringList dirs = flat_file.split(Option::dir_sep);
@ -280,6 +282,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
}
nextfile:
qmake_setpwd(oldpwd);
Option::output_dir = oldoutpwd;
}
}
}

View File

@ -434,18 +434,21 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
projLookup.insert(profileKey, fi.absoluteFilePath());
}
QString oldpwd = qmake_getpwd();
QString oldoutpwd = Option::output_dir;
QMakeProject tmp_proj;
QString dir = fi.absolutePath(), fn = fi.fileName();
if (!dir.isEmpty()) {
if (!qmake_setpwd(dir))
fprintf(stderr, "Cannot find directory: %s", dir.toLatin1().constData());
}
Option::output_dir = Option::globals->shadowedPath(QDir::cleanPath(fi.absoluteFilePath()));
if (tmp_proj.read(fn)) {
// Check if all requirements are fulfilled
if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n",
fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
qmake_setpwd(oldpwd);
Option::output_dir = oldoutpwd;
continue;
}
if (tmp_proj.first("TEMPLATE") == "vcsubdirs") {
@ -460,13 +463,10 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// and to be able to extract all the dependencies
Option::QMAKE_MODE old_mode = Option::qmake_mode;
Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING;
QString old_output_dir = Option::output_dir;
Option::output_dir = QFileInfo(fileFixify(dir, qmake_getpwd(), Option::output_dir)).canonicalFilePath();
VcprojGenerator tmp_vcproj;
tmp_vcproj.setNoIO(true);
tmp_vcproj.setProjectFile(&tmp_proj);
Option::qmake_mode = old_mode;
Option::output_dir = old_output_dir;
// We assume project filename is [QMAKE_PROJECT_NAME].vcproj
QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"));
@ -578,6 +578,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
}
nextfile:
qmake_setpwd(oldpwd);
Option::output_dir = oldoutpwd;
}
}
}