summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp14
-rw-r--r--qmake/generators/makefiledeps.cpp164
-rw-r--r--qmake/generators/makefiledeps.h9
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp15
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp22
5 files changed, 26 insertions, 198 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index ec73ccfe54..94e9259c68 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -771,20 +771,6 @@ MakefileGenerator::init()
QMakeSourceFileInfo::setDependencyPaths(deplist);
debug_msg(1, "Dependency Directories: %s",
incDirs.join(QString(" :: ")).toLatin1().constData());
- //cache info
- if(project->isActiveConfig("qmake_cache")) {
- QString cache_file;
- if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) {
- cache_file = QDir::fromNativeSeparators(project->first("QMAKE_INTERNAL_CACHE_FILE").toQString());
- } else {
- cache_file = ".qmake.internal.cache";
- if(project->isActiveConfig("build_pass"))
- cache_file += ".BUILD." + project->first("BUILD_PASS");
- }
- if(cache_file.indexOf('/') == -1)
- cache_file.prepend(Option::output_dir + '/');
- QMakeSourceFileInfo::setCacheFile(cache_file);
- }
//add to dependency engine
for(x = 0; x < compilers.count(); ++x) {
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index 10fcc1493c..d68539814e 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -60,8 +60,6 @@ QT_BEGIN_NAMESPACE
inline bool qmake_endOfLine(const char &c) { return (c == '\r' || c == '\n'); }
#endif
-//#define QMAKE_USE_CACHE
-
QMakeLocalFileName::QMakeLocalFileName(const QString &name) : is_null(name.isNull())
{
if(!name.isEmpty()) {
@@ -265,19 +263,10 @@ QMakeSourceFileInfo::QMakeSourceFileInfo(const QString &cf)
//buffer
spare_buffer = nullptr;
spare_buffer_size = 0;
-
- //cache
- cachefile = cf;
- if(!cachefile.isEmpty())
- loadCache(cachefile);
}
QMakeSourceFileInfo::~QMakeSourceFileInfo()
{
- //cache
- if(!cachefile.isEmpty() /*&& files_changed*/)
- saveCache(cachefile);
-
//buffer
if(spare_buffer) {
free(spare_buffer);
@@ -290,12 +279,6 @@ QMakeSourceFileInfo::~QMakeSourceFileInfo()
delete includes;
}
-void QMakeSourceFileInfo::setCacheFile(const QString &cf)
-{
- cachefile = cf;
- loadCache(cachefile);
-}
-
void QMakeSourceFileInfo::addSourceFiles(const ProStringList &l, uchar seek,
QMakeSourceFileInfo::SourceFileType type)
{
@@ -1054,151 +1037,4 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
return true;
}
-
-void QMakeSourceFileInfo::saveCache(const QString &cf)
-{
-#ifdef QMAKE_USE_CACHE
- if(cf.isEmpty())
- return;
-
- QFile file(QMakeLocalFileName(cf).local());
- if(file.open(QIODevice::WriteOnly)) {
- QTextStream stream(&file);
- stream << QMAKE_VERSION_STR << endl << endl; //version
- { //cache verification
- QMap<QString, QStringList> verify = getCacheVerification();
- stream << verify.count() << endl;
- for(QMap<QString, QStringList>::iterator it = verify.begin();
- it != verify.end(); ++it) {
- stream << it.key() << endl << it.value().join(';') << endl;
- }
- stream << endl;
- }
- if(files->nodes) {
- for(int file = 0; file < files->num_nodes; ++file) {
- for(SourceFiles::SourceFileNode *node = files->nodes[file]; node; node = node->next) {
- stream << node->file->file.local() << endl; //source
- stream << node->file->type << endl; //type
-
- //depends
- stream << ";";
- if(node->file->deps) {
- for(int depend = 0; depend < node->file->deps->used_nodes; ++depend) {
- if(depend)
- stream << ";";
- stream << node->file->deps->children[depend]->file.local();
- }
- }
- stream << endl;
-
- stream << node->file->mocable << endl; //mocable
- stream << endl; //just for human readability
- }
- }
- }
- stream.flush();
- file.close();
- }
-#else
- Q_UNUSED(cf);
-#endif
-}
-
-void QMakeSourceFileInfo::loadCache(const QString &cf)
-{
- if(cf.isEmpty())
- return;
-
-#ifdef QMAKE_USE_CACHE
- QMakeLocalFileName cache_file(cf);
- int fd = open(QMakeLocalFileName(cf).local().toLatin1(), O_RDONLY);
- if(fd == -1)
- return;
- QFileInfo cache_fi = findFileInfo(cache_file);
- if(!cache_fi.exists() || cache_fi.isDir())
- return;
-
- QFile file;
- if (!file.open(fd, QIODevice::ReadOnly))
- return;
- QTextStream stream(&file);
-
- if (stream.readLine() == QMAKE_VERSION_STR) { //version check
- stream.skipWhiteSpace();
-
- bool verified = true;
- { //cache verification
- QMap<QString, QStringList> verify;
- int len = stream.readLine().toInt();
- for(int i = 0; i < len; ++i) {
- QString var = stream.readLine();
- QString val = stream.readLine();
- verify.insert(var, val.split(';', QString::SkipEmptyParts));
- }
- verified = verifyCache(verify);
- }
- if(verified) {
- stream.skipWhiteSpace();
- if(!files)
- files = new SourceFiles;
- while(!stream.atEnd()) {
- QString source = stream.readLine();
- QString type = stream.readLine();
- QString depends = stream.readLine();
- QString mocable = stream.readLine();
- stream.skipWhiteSpace();
-
- QMakeLocalFileName fn(source);
- QFileInfo fi = findFileInfo(fn);
-
- SourceFile *file = files->lookupFile(fn);
- if(!file) {
- file = new SourceFile;
- file->file = fn;
- files->addFile(file);
- file->type = (SourceFileType)type.toInt();
- file->exists = fi.exists();
- }
- if(fi.exists() && fi.lastModified() < cache_fi.lastModified()) {
- if(!file->dep_checked) { //get depends
- if(!file->deps)
- file->deps = new SourceDependChildren;
- file->dep_checked = true;
- QStringList depend_list = depends.split(";", QString::SkipEmptyParts);
- for(int depend = 0; depend < depend_list.size(); ++depend) {
- QMakeLocalFileName dep_fn(depend_list.at(depend));
- QFileInfo dep_fi(findFileInfo(dep_fn));
- SourceFile *dep = files->lookupFile(dep_fn);
- if(!dep) {
- dep = new SourceFile;
- dep->file = dep_fn;
- dep->exists = dep_fi.exists();
- dep->type = QMakeSourceFileInfo::TYPE_UNKNOWN;
- files->addFile(dep);
- }
- dep->included_count++;
- file->deps->addChild(dep);
- }
- }
- if(!file->moc_checked) { //get mocs
- file->moc_checked = true;
- file->mocable = mocable.toInt();
- }
- }
- }
- }
- }
-#endif
-}
-
-QMap<QString, QStringList> QMakeSourceFileInfo::getCacheVerification()
-{
- return QMap<QString, QStringList>();
-}
-
-bool QMakeSourceFileInfo::verifyCache(const QMap<QString, QStringList> &v)
-{
- return v == getCacheVerification();
-}
-
QT_END_NAMESPACE
diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h
index b91a3e0a0f..66b87bf470 100644
--- a/qmake/generators/makefiledeps.h
+++ b/qmake/generators/makefiledeps.h
@@ -79,9 +79,6 @@ private:
bool findDeps(SourceFile *);
void dependTreeWalker(SourceFile *, SourceDependChildren *);
- //cache
- QString cachefile;
-
protected:
virtual QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool forOpen=false);
virtual QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &);
@@ -114,12 +111,6 @@ public:
bool mocable(const QString &file);
- virtual QMap<QString, QStringList> getCacheVerification();
- virtual bool verifyCache(const QMap<QString, QStringList> &);
- void setCacheFile(const QString &cachefile); //auto caching
- void loadCache(const QString &cf);
- void saveCache(const QString &cf);
-
private:
DependencyMode dep_mode;
};
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 3116238aa0..0515c7404f 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -300,14 +300,17 @@ inline XmlOutput::xml_output valueTagT( const triState v)
return valueTag(v == _True ? "true" : "false");
}
-static QString vcxCommandSeparator()
+static QString commandLinesForOutput(QStringList commands)
{
// MSBuild puts the contents of the custom commands into a batch file and calls it.
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
- static QString cmdSep =
- QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;");
- return cmdSep;
+ static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd");
+ for (int i = commands.count() - 2; i >= 0; --i) {
+ if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive))
+ commands.insert(i + 1, errchk);
+ }
+ return commands.join('\n');
}
static QString unquote(const QString &value)
@@ -1658,7 +1661,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool)
{
xml << tag("Command")
<< attrTag("Condition", condition)
- << valueTag(tool.CommandLine.join(vcxCommandSeparator()));
+ << valueTag(commandLinesForOutput(tool.CommandLine));
}
if ( !tool.Description.isEmpty() )
@@ -1712,7 +1715,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
{
xml
<< tag(tool.EventName)
- << tag(_Command) << valueTag(tool.CommandLine.join(vcxCommandSeparator()))
+ << tag(_Command) << valueTag(commandLinesForOutput(tool.CommandLine))
<< tag(_Message) << valueTag(tool.Description)
<< closetag(tool.EventName);
}
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index b6f7f20564..b74448ce94 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -209,7 +209,9 @@ bool VcprojGenerator::writeProjectMakefile()
struct VcsolutionDepend {
QString uuid;
- QString vcprojFile, orig_target, target;
+ QString vcprojFile;
+ QString projectName;
+ QString target;
Target targetType;
QStringList dependencies;
};
@@ -433,7 +435,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
Option::qmake_mode = old_mode;
// 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;
// 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;
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->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();
// We want to store it as the .lib name.
if (newDep->target.endsWith(".dll"))
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()) {
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) {
// ### quoting rules?
t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid
- << "\"" << (*it)->orig_target << "\", \"" << (*it)->vcprojFile
+ << "\"" << (*it)->projectName << "\", \"" << (*it)->vcprojFile
<< "\", \"" << (*it)->uuid << "\"";
debug_msg(1, "Project %s has dependencies: %s", (*it)->target.toLatin1().constData(), (*it)->dependencies.join(" ").toLatin1().constData());
@@ -937,6 +940,15 @@ void VcprojGenerator::initProject()
vcProject.SccProjectName = project->first("SCCPROJECTNAME").toQString();
vcProject.SccLocalPath = project->first("SCCLOCALPATH").toQString();
vcProject.flat_files = project->isActiveConfig("flat");
+
+ // Set up the full target path for target conflict checking.
+ const QChar slash = QLatin1Char('/');
+ QString destdir = QDir::fromNativeSeparators(var("DESTDIR"));
+ if (!destdir.endsWith(slash))
+ destdir.append(slash);
+ project->values("DEST_TARGET") = ProStringList(destdir
+ + project->first("TARGET")
+ + project->first("TARGET_EXT"));
}
void VcprojGenerator::initConfiguration()