summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-05-10 11:22:07 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-19 16:46:02 +0200
commit16d5b6911f18977d92734eeea419b27408a08d40 (patch)
treefeb41a240a06a15c9cd4d8fa18cc5e774b8a8d42
parentf86f3613a52568e216c98d8f19ecc5204e76c3fb (diff)
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>
-rw-r--r--qmake/generators/makefile.cpp8
-rw-r--r--qmake/project.cpp42
-rw-r--r--qmake/project.h2
3 files changed, 33 insertions, 19 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 92d6dd44f2..9bdb6640df 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -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") << " ";
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 88535bd0e8..a60c168ef4 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -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);
diff --git a/qmake/project.h b/qmake/project.h
index aa31ec9897..e31adc8388 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -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; }