diff options
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/makefile.cpp | 47 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 3 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 5 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 48 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.h | 1 |
5 files changed, 58 insertions, 46 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 9e2be31..83d3adf 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -364,7 +364,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); real_dir = dir; if(!(flags & VPATH_NoFixify)) - real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); + real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir) + '/'; regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { @@ -383,16 +383,15 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v for(int i = (int)files.count()-1; i >= 0; i--) { if(files[i] == "." || files[i] == "..") continue; - a = dir + files[i]; + a = real_dir + files[i]; if(!(flags & VPATH_NoFixify)) a = fileFixify(a); l.insert(val_it, a); } } } else { - debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", + debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.", __FILE__, __LINE__, real_dir.toLatin1().constData(), - QDir::separator().toLatin1(), regex.toLatin1().constData(), real_dir.toLatin1().constData()); if(flags & VPATH_RemoveMissingFiles) remove_file = true; @@ -484,19 +483,22 @@ MakefileGenerator::init() subs.at(i).toLatin1().constData()); continue; } - inn = tinn.first(); - outn = toutn.first(); + inn = fileFixify(tinn.first(), qmake_getpwd()); + outn = fileFixify(toutn.first(), qmake_getpwd(), Option::output_dir); } else { - inn = subs.at(i); + inn = fileFixify(subs.at(i), qmake_getpwd()); + if (!QFile::exists(inn)) { + // random insanity for backwards compat: .in file specified with absolute out dir + inn = fileFixify(subs.at(i)); + } if(!inn.endsWith(".in")) { warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", inn.toLatin1().constData()); continue; } - outn = inn.left(inn.length()-3); + outn = fileFixify(inn.left(inn.length()-3), qmake_getpwd(), Option::output_dir); } - QFile in(fileFixify(inn)); - QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir)); + QFile in(inn); if(in.open(QFile::ReadOnly)) { QString contents; QStack<int> state; @@ -545,9 +547,10 @@ MakefileGenerator::init() else state.pop(); } else if(state.isEmpty() || state.top() == IN_CONDITION) { - contents += project->expand(line).join(QString(Option::field_sep)); + contents += project->expand(line, in.fileName(), count); } } + QFile out(outn); if(out.exists() && out.open(QFile::ReadOnly)) { QString old = QString::fromUtf8(out.readAll()); if(contents == old) { @@ -782,10 +785,8 @@ MakefileGenerator::init() } { //get the output_dir into the pwd - if(fileFixify(Option::output_dir) != fileFixify(qmake_getpwd())) - project->values("INCLUDEPATH").append(fileFixify(Option::output_dir, - Option::output_dir, - Option::output_dir)); + if(Option::output_dir != qmake_getpwd()) + project->values("INCLUDEPATH").append("."); } //fix up the target deps @@ -1748,7 +1749,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) deps += " " + escapeDependencyPath(dep); } if(project->values((*it) + ".CONFIG").indexOf("fix_target") != -1) - targ = fileFixify(targ); + targ = fileFixify(targ, Option::output_dir, Option::output_dir); if(project->isEmpty("QMAKE_NOFORCE") && project->values((*it) + ".CONFIG").indexOf("phony") != -1) deps += QString(" ") + "FORCE"; @@ -2464,7 +2465,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT //qmake it if(!subtarget->profile.isEmpty()) { QString out = subtarget->makefile; - QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute); + QString in = fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute); if(out.startsWith(in_directory)) out = out.mid(in_directory.length()); t << mkfile << ": " << "\n\t"; @@ -2816,9 +2817,6 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q QString ret = unescapeFilePath(file); //do the fixin' - QString pwd = qmake_getpwd(); - if (!pwd.endsWith('/')) - pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) @@ -2827,12 +2825,16 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) { - if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute + if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) { //already absolute + QString pwd = qmake_getpwd(); + if (!pwd.endsWith(QLatin1Char('/'))) + pwd += QLatin1Char('/'); ret.prepend(pwd); + } ret = Option::fixPathToTargetOS(ret, false, canon); } else { //fix it.. QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d); - QString in_dir = QDir(pwd).absoluteFilePath(in_d); + QString in_dir = QDir(qmake_getpwd()).absoluteFilePath(in_d); { QFileInfo in_fi(fileInfo(in_dir)); if(in_fi.exists()) @@ -2886,6 +2888,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q //prepend for(int o = 0; o < i; o++) dot_prefix += ".." + Option::dir_sep; + break; } } ret.prepend(dot_prefix); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 212f8bd..9f14492 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -795,7 +795,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ddir = project->first("QMAKE_DISTDIR"); QString ddir_c = escapeFilePath(fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : - project->first("OBJECTS_DIR")) + ddir)); + project->first("OBJECTS_DIR")) + ddir, + Option::output_dir, Option::output_dir)); t << "dist: " << "\n\t" << mkdir_p_asstring(ddir_c) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 815a476..88a5043 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2219,6 +2219,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) Option::fixPathToLocalOS(inFile, true, false), out); if(Project->canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -2233,7 +2236,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) for (int i = 0; i < extradeps.count(); ++i) { QString dd = extradeps.at(i).simplified(); if (!dd.isEmpty()) - deps += Project->fileFixify(dd); + deps += Project->fileFixify(dd, QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 80f5bde..56f3bfd 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -360,6 +360,25 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) return result; } +QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj) +{ + QStringList subdirs; + QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"]; + for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { + QString tmpdir = tmp_proj_subdirs.at(x); + if(!proj->isEmpty(tmpdir + ".file")) { + if(!proj->isEmpty(tmpdir + ".subdir")) + warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", + tmpdir.toLatin1().constData()); + tmpdir = proj->first(tmpdir + ".file"); + } else if(!proj->isEmpty(tmpdir + ".subdir")) { + tmpdir = proj->first(tmpdir + ".subdir"); + } + subdirs += tmpdir; + } + return subdirs; +} + void VcprojGenerator::writeSubDirs(QTextStream &t) { // Check if all requirements are fulfilled @@ -394,7 +413,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QHash<QString, VcsolutionDepend*> solution_depends; QList<VcsolutionDepend*> solution_cleanup; - QStringList subdirs = project->values("SUBDIRS"); QString oldpwd = qmake_getpwd(); // Make sure that all temp projects are configured @@ -403,16 +421,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QStringList old_after_vars = Option::after_user_vars; Option::after_user_vars.append("CONFIG+=release"); + QStringList subdirs = collectSubDirs(project); for(int i = 0; i < subdirs.size(); ++i) { QString tmp = subdirs.at(i); - if(!project->isEmpty(tmp + ".file")) { - if(!project->isEmpty(tmp + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmp.toLatin1().constData()); - tmp = project->first(tmp + ".file"); - } else if(!project->isEmpty(tmp + ".subdir")) { - tmp = project->first(tmp + ".subdir"); - } QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true))); if(fi.exists()) { if(fi.isDir()) { @@ -436,19 +447,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) continue; } if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { - QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"]; - for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { - QString tmpdir = tmp_proj_subdirs.at(x); - if(!tmp_proj.isEmpty(tmpdir + ".file")) { - if(!tmp_proj.isEmpty(tmpdir + ".subdir")) - warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s", - tmpdir.toLatin1().constData()); - tmpdir = tmp_proj.first(tmpdir + ".file"); - } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) { - tmpdir = tmp_proj.first(tmpdir + ".subdir"); - } + foreach(const QString &tmpdir, collectSubDirs(&tmp_proj)) subdirs += fileFixify(tmpdir); - } } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { // Initialize a 'fake' project to get the correct variables // and to be able to extract all the dependencies @@ -1319,6 +1319,9 @@ void VcprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { + dep_cmd.prepend(QLatin1String("cd ") + + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ")); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1329,7 +1332,8 @@ void VcprojGenerator::initResourceFiles() } QT_PCLOSE(proc); if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), + QString(), Option::output_dir); } } } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index fdcd73f..afe8f9f 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -131,6 +131,7 @@ protected: QList<VcprojGenerator*> mergedProjects; private: + QStringList collectSubDirs(QMakeProject *proj); QUuid increaseUUID(const QUuid &id); friend class VCFilter; }; |