diff options
Diffstat (limited to 'qmake/library/qmakeevaluator.cpp')
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 81 |
1 files changed, 52 insertions, 29 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index c4dca12900..f46eb75670 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -79,19 +79,19 @@ QT_BEGIN_NAMESPACE #define fL1S(s) QString::fromLatin1(s) -QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild) - : root(_root), hostBuild(_hostBuild) +QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild) + : root(_root), stash(_stash), hostBuild(_hostBuild) { } uint qHash(const QMakeBaseKey &key) { - return qHash(key.root) ^ (uint)key.hostBuild; + return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild; } bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two) { - return one.root == two.root && one.hostBuild == two.hostBuild; + return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild; } QMakeBaseEnv::QMakeBaseEnv() @@ -982,6 +982,8 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString()); if (!m_option->qmake_abslocation.isEmpty()) vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation); + if (!m_option->qmake_args.isEmpty()) + vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args); #if defined(Q_OS_WIN32) vars[ProKey("QMAKE_HOST.os")] << ProString("Windows"); @@ -1137,6 +1139,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) dir = qdfi.path(); } + dir = m_outputDir; + forever { + QString stashfile = dir + QLatin1String("/.qmake.stash"); + if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) { + m_stashfile = QDir::cleanPath(stashfile); + break; + } + QFileInfo qdfi(dir); + if (qdfi.isRoot()) + break; + dir = qdfi.path(); + } + return true; } @@ -1186,23 +1201,18 @@ bool QMakeEvaluator::loadSpec() QMakeEvaluator evaluator(m_option, m_parser, m_vfs, m_handler); evaluator.m_sourceRoot = m_sourceRoot; evaluator.m_buildRoot = m_buildRoot; - if (!m_superfile.isEmpty()) { - valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); - if (evaluator.evaluateFile( - m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + + if (!m_superfile.isEmpty() && evaluator.evaluateFile( + m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } - if (!m_conffile.isEmpty()) { - valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile); - if (evaluator.evaluateFile( - m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + if (!m_conffile.isEmpty() && evaluator.evaluateFile( + m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } - if (!m_cachefile.isEmpty()) { - valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); - if (evaluator.evaluateFile( - m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + if (!m_cachefile.isEmpty() && evaluator.evaluateFile( + m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } if (qmakespec.isEmpty()) { if (!m_hostBuild) @@ -1236,19 +1246,31 @@ bool QMakeEvaluator::loadSpec() cool: m_qmakespec = QDir::cleanPath(qmakespec); - if (!m_superfile.isEmpty() - && evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { - return false; + if (!m_superfile.isEmpty()) { + valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); + if (evaluateFile( + m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) + return false; } if (!loadSpecInternal()) return false; - if (!m_conffile.isEmpty() - && evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) { - return false; + if (!m_conffile.isEmpty()) { + valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile); + if (evaluateFile( + m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; } - if (!m_cachefile.isEmpty() - && evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) { - return false; + if (!m_cachefile.isEmpty()) { + valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); + if (evaluateFile( + m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; + } + if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) { + valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile); + if (evaluateFile( + m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; } return true; } @@ -1327,7 +1349,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( #ifdef PROEVALUATOR_THREAD_SAFE m_option->mutex.lock(); #endif - QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)]; + QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)]; if (!*baseEnvPtr) *baseEnvPtr = new QMakeBaseEnv; QMakeBaseEnv *baseEnv = *baseEnvPtr; @@ -1354,6 +1376,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( baseEval->m_superfile = m_superfile; baseEval->m_conffile = m_conffile; baseEval->m_cachefile = m_cachefile; + baseEval->m_stashfile = m_stashfile; baseEval->m_sourceRoot = m_sourceRoot; baseEval->m_buildRoot = m_buildRoot; baseEval->m_hostBuild = m_hostBuild; |