diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-05-09 15:29:25 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-06-19 16:39:56 +0200 |
commit | bf984d5f24741a52a70024f3f43432307281f0ae (patch) | |
tree | 6197ea782c8dce78fcdd260d34e4ed07b175aa12 /qmake/option.cpp | |
parent | 6a66fef520d0fb2b8d507c3e91e03338fc39a57e (diff) |
add $$shadowed() function
return the build directory corresponding to a given source directory.
this is the identity function if not shadow-building. if input lies
outside the source directory, return empty value.
Change-Id: I2d2a6b1112bd19989fe29cfe19a12d39a0d208c1
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'qmake/option.cpp')
-rw-r--r-- | qmake/option.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp index 836cc3f492..a22d184456 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -115,6 +115,8 @@ 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::source_root; +QString Option::mkfile::build_root; QString Option::mkfile::cachefile; QStringList Option::mkfile::project_files; QString Option::mkfile::qmakespec_commandline; @@ -594,6 +596,29 @@ void Option::applyHostMode() } } +void Option::prepareProject(const QString &pfile) +{ + QString srcpath = (pfile != "-") + ? QDir::cleanPath(QFileInfo(pfile).absolutePath()) : qmake_getpwd(); + if (srcpath != output_dir) { + if (!srcpath.endsWith(QLatin1Char('/'))) + srcpath += QLatin1Char('/'); + QString dstpath = output_dir; + if (!dstpath.endsWith(QLatin1Char('/'))) + dstpath += QLatin1Char('/'); + int srcLen = srcpath.length(); + int dstLen = dstpath.length(); + int lastSl = 0; + while (++lastSl, srcpath.at(--srcLen) == dstpath.at(--dstLen)) + if (srcpath.at(srcLen) == QLatin1Char('/')) + lastSl = 1; + mkfile::source_root = srcpath.left(srcLen + lastSl); + mkfile::build_root = dstpath.left(dstLen + lastSl); + } else { + mkfile::source_root.clear(); + } +} + bool Option::postProcessProject(QMakeProject *project) { Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; |