diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:18:59 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-29 09:23:14 +1000 |
commit | 98dd1781d9256f68025d2a2db408f4f5947f3214 (patch) | |
tree | dbe1424abd90014edb5546c920ca585ed62b46e3 /qmake/option.cpp | |
parent | 6c1bdc1854a7700c2b3a345b95f6a2fdca84037d (diff) | |
parent | fa1b9070af66edb81b2a3735c1951f78b22bd666 (diff) |
Merge master -> api_changes
Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac.
Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
Diffstat (limited to 'qmake/option.cpp')
-rw-r--r-- | qmake/option.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp index 431299b46b..0c649fdd77 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -116,6 +116,7 @@ bool Option::mkfile::do_dep_heuristics = true; bool Option::mkfile::do_preprocess = false; bool Option::mkfile::do_stub_makefile = false; bool Option::mkfile::do_cache = true; +QString Option::mkfile::project_build_root; QString Option::mkfile::cachefile; QStringList Option::mkfile::project_files; QString Option::mkfile::qmakespec_commandline; @@ -146,6 +147,14 @@ static QString detectProjectFile(const QString &path) return ret; } +static QString cleanSpec(const QString &spec) +{ + QString ret = QDir::cleanPath(spec); + if (ret.contains('/')) + ret = QDir::cleanPath(QFileInfo(ret).absoluteFilePath()); + return ret; +} + QString project_builtin_regx(); bool usage(const char *a0) { @@ -314,7 +323,7 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "cache") { Option::mkfile::cachefile = argv[++x]; } else if(opt == "platform" || opt == "spec") { - Option::mkfile::qmakespec = argv[++x]; + Option::mkfile::qmakespec = cleanSpec(argv[++x]); Option::mkfile::qmakespec_commandline = argv[x]; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); @@ -567,6 +576,34 @@ void Option::applyHostMode() } } +bool Option::prepareProject() +{ + mkfile::project_build_root.clear(); + if (mkfile::do_cache) { + if (mkfile::cachefile.isEmpty()) { //find it as it has not been specified + QDir dir(output_dir); + while (!dir.exists(QLatin1String(".qmake.cache"))) + if (dir.isRoot() || !dir.cdUp()) + goto no_cache; + mkfile::cachefile = dir.filePath(QLatin1String(".qmake.cache")); + mkfile::project_build_root = dir.path(); + } else { + QFileInfo fi(mkfile::cachefile); + mkfile::cachefile = QDir::cleanPath(fi.absoluteFilePath()); + mkfile::project_build_root = QDir::cleanPath(fi.absolutePath()); + } + + if (mkfile::qmakespec.isEmpty()) { + QMakeProject cproj; + if (!cproj.read(mkfile::cachefile, QMakeProject::ReadProFile)) + return false; + mkfile::qmakespec = cproj.first(QLatin1String("QMAKESPEC")); + } + } + no_cache: + return true; +} + bool Option::postProcessProject(QMakeProject *project) { Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; |