look for .qmake.conf files
this is the source dir equivalent of .qmake.cache and can be checked into the repository. it can be used to make project-wide settings, or just to signal the presence of an mkspecs/ directory. Change-Id: I5f1cebad2aa2a89e78089341b2051613b6b7a613 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
parent
f86f3613a5
commit
16d5b6911f
@ -2691,8 +2691,12 @@ MakefileGenerator::writeMakeQmake(QTextStream &t)
|
||||
QString qmake = build_args();
|
||||
if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) {
|
||||
t << escapeFilePath(ofile) << ": " << escapeDependencyPath(fileFixify(pfile)) << " ";
|
||||
if(Option::mkfile::do_cache)
|
||||
t << escapeDependencyPath(fileFixify(project->cacheFile())) << " ";
|
||||
if (Option::mkfile::do_cache) {
|
||||
if (!project->confFile().isEmpty())
|
||||
t << escapeDependencyPath(fileFixify(project->confFile())) << " ";
|
||||
if (!project->cacheFile().isEmpty())
|
||||
t << escapeDependencyPath(fileFixify(project->cacheFile())) << " ";
|
||||
}
|
||||
if(!specdir().isEmpty()) {
|
||||
if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf")))
|
||||
t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " ";
|
||||
|
@ -1338,31 +1338,45 @@ QMakeProject::read(uchar cmd)
|
||||
QStringList qmakepath;
|
||||
QStringList qmakefeatures;
|
||||
if (Option::mkfile::do_cache) { // parse the cache
|
||||
QHash<QString, QStringList> cache;
|
||||
if (Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified
|
||||
QString sdir = qmake_getpwd();
|
||||
QString dir = Option::output_dir;
|
||||
forever {
|
||||
QFileInfo qsfi(sdir, QLatin1String(".qmake.conf"));
|
||||
if (qsfi.exists()) {
|
||||
conffile = qsfi.filePath();
|
||||
if (!read(conffile, cache))
|
||||
return false;
|
||||
}
|
||||
QFileInfo qfi(dir, QLatin1String(".qmake.cache"));
|
||||
if (qfi.exists()) {
|
||||
cachefile = qfi.filePath();
|
||||
if (!read(cachefile, cache))
|
||||
return false;
|
||||
}
|
||||
if (!conffile.isEmpty() || !cachefile.isEmpty()) {
|
||||
project_root = sdir;
|
||||
project_build_root = dir;
|
||||
break;
|
||||
}
|
||||
QFileInfo qsdfi(sdir);
|
||||
QFileInfo qdfi(dir);
|
||||
if (qdfi.isRoot())
|
||||
if (qsdfi.isRoot() || qdfi.isRoot())
|
||||
goto no_cache;
|
||||
sdir = qsdfi.path();
|
||||
dir = qdfi.path();
|
||||
}
|
||||
} else {
|
||||
QFileInfo fi(Option::mkfile::cachefile);
|
||||
cachefile = QDir::cleanPath(fi.absoluteFilePath());
|
||||
if (!read(cachefile, cache))
|
||||
return false;
|
||||
project_build_root = QDir::cleanPath(fi.absolutePath());
|
||||
// This intentionally bypasses finding a source root,
|
||||
// as the result would be more or less arbitrary.
|
||||
}
|
||||
|
||||
QHash<QString, QStringList> cache;
|
||||
if (!read(cachefile, cache)) {
|
||||
cachefile.clear();
|
||||
goto no_cache;
|
||||
}
|
||||
if (Option::mkfile::xqmakespec.isEmpty() && !cache["XQMAKESPEC"].isEmpty())
|
||||
Option::mkfile::xqmakespec = cache["XQMAKESPEC"].first();
|
||||
if (Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) {
|
||||
@ -1379,17 +1393,10 @@ QMakeProject::read(uchar cmd)
|
||||
}
|
||||
no_cache:
|
||||
|
||||
if (qmake_getpwd() != Option::output_dir || project_build_root.isEmpty()) {
|
||||
if (project_build_root.isEmpty()) {
|
||||
QDir srcdir(qmake_getpwd());
|
||||
QDir dstdir(Option::output_dir);
|
||||
do {
|
||||
if (!project_build_root.isEmpty()) {
|
||||
// If we already know the build root, just match up the source root with it.
|
||||
if (dstdir.path() == project_build_root) {
|
||||
project_root = srcdir.path();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Look for mkspecs/ in source and build. First to win determines the root.
|
||||
if (dstdir.exists("mkspecs") || srcdir.exists("mkspecs")) {
|
||||
project_build_root = dstdir.path();
|
||||
@ -1398,10 +1405,7 @@ QMakeProject::read(uchar cmd)
|
||||
project_root.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (!srcdir.isRoot() && srcdir.cdUp() && !dstdir.isRoot() && dstdir.cdUp());
|
||||
} else {
|
||||
project_root.clear();
|
||||
}
|
||||
|
||||
if (qmakepath != cached_qmakepath || qmakefeatures != cached_qmakefeatures
|
||||
@ -1449,6 +1453,10 @@ QMakeProject::read(uchar cmd)
|
||||
}
|
||||
validateModes();
|
||||
|
||||
if (!conffile.isEmpty()) {
|
||||
debug_msg(1, "Project config file: reading %s", conffile.toLatin1().constData());
|
||||
read(conffile, base_vars);
|
||||
}
|
||||
if (!cachefile.isEmpty()) {
|
||||
debug_msg(1, "QMAKECACHE file: reading %s", cachefile.toLatin1().constData());
|
||||
read(cachefile, base_vars);
|
||||
|
@ -83,6 +83,7 @@ class QMakeProject
|
||||
bool need_restart;
|
||||
bool own_prop;
|
||||
bool backslashWarned;
|
||||
QString conffile;
|
||||
QString cachefile;
|
||||
QString pfile;
|
||||
QMakeProperty *prop;
|
||||
@ -132,6 +133,7 @@ public:
|
||||
QStringList userTestFunctions() { return testFunctions.keys(); }
|
||||
|
||||
QString projectFile();
|
||||
QString confFile() const { return conffile; }
|
||||
QString cacheFile() const { return cachefile; }
|
||||
inline QMakeProperty *properties() { return prop; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user