forked from qt-creator/qt-creator
fix loading of qmakespecs in the qt support classes
it's not sufficient to load the qmake.conf only any more. Change-Id: Ic699ad5e202d6f3e115e44621b4c6ee2def6edd2 Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -758,10 +758,7 @@ void BaseQtVersion::ensureMkSpecParsed() const
|
||||
ProFileCacheManager::instance()->incRefCount();
|
||||
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
||||
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
||||
pro->deref();
|
||||
}
|
||||
evaluator.loadNamedSpec(mkspecPath().toString(), false);
|
||||
|
||||
parseMkSpec(&evaluator);
|
||||
|
||||
|
@@ -69,10 +69,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
||||
ProFileCacheManager::instance()->incRefCount();
|
||||
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
||||
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
|
||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
||||
pro->deref();
|
||||
}
|
||||
evaluator.loadNamedSpec(mkspec.toString(), false);
|
||||
|
||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
||||
qSort(factories.begin(), factories.end(), &sortByPriority);
|
||||
|
@@ -184,6 +184,15 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
|
||||
return TT_Unknown;
|
||||
}
|
||||
|
||||
bool ProFileEvaluator::loadNamedSpec(const QString &specDir, bool hostSpec)
|
||||
{
|
||||
d->m_qmakespec = specDir;
|
||||
d->m_hostBuild = hostSpec;
|
||||
|
||||
d->updateMkspecPaths();
|
||||
return d->loadSpecInternal();
|
||||
}
|
||||
|
||||
bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||
{
|
||||
return d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue;
|
||||
|
@@ -69,6 +69,8 @@ public:
|
||||
#endif
|
||||
void setOutputDir(const QString &dir); // Default is empty
|
||||
|
||||
bool loadNamedSpec(const QString &specDir, bool hostSpec);
|
||||
|
||||
bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags = QMakeEvaluator::LoadAll);
|
||||
|
||||
bool contains(const QString &variableName) const;
|
||||
|
@@ -1032,6 +1032,33 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::loadSpecInternal()
|
||||
{
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_pre.prf")))
|
||||
return false;
|
||||
QString spec = m_qmakespec + QLatin1String("/qmake.conf");
|
||||
if (!evaluateFileDirect(spec, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_OS_UNIX
|
||||
m_qmakespecFull = QFileInfo(m_qmakespec).canonicalFilePath();
|
||||
#else
|
||||
// We can't resolve symlinks as they do on Unix, so configure.exe puts
|
||||
// the source of the qmake.conf at the end of the default/qmake.conf in
|
||||
// the QMAKESPEC_ORIGINAL variable.
|
||||
const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL"));
|
||||
m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString();
|
||||
#endif
|
||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull);
|
||||
m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString();
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
||||
return false;
|
||||
// The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it
|
||||
m_dirSep = first(ProKey("QMAKE_DIR_SEP"));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::loadSpec()
|
||||
{
|
||||
QString qmakespec = m_option->expandEnvVars(
|
||||
@@ -1085,29 +1112,9 @@ bool QMakeEvaluator::loadSpec()
|
||||
&& !evaluateFileDirect(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||
return false;
|
||||
}
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_pre.prf")))
|
||||
return false;
|
||||
QString spec = m_qmakespec + QLatin1String("/qmake.conf");
|
||||
if (!evaluateFileDirect(spec, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||
evalError(fL1S("Could not read qmake configuration file %1.").arg(spec));
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_OS_UNIX
|
||||
m_qmakespecFull = QFileInfo(m_qmakespec).canonicalFilePath();
|
||||
#else
|
||||
// We can't resolve symlinks as they do on Unix, so configure.exe puts
|
||||
// the source of the qmake.conf at the end of the default/qmake.conf in
|
||||
// the QMAKESPEC_ORIGINAL variable.
|
||||
const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL"));
|
||||
m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString();
|
||||
#endif
|
||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull);
|
||||
m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString();
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
||||
if (!loadSpecInternal())
|
||||
return false;
|
||||
updateFeaturePaths(); // The spec extends the feature search path, so rebuild the cache.
|
||||
// The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it
|
||||
m_dirSep = first(ProKey("QMAKE_DIR_SEP"));
|
||||
if (!m_conffile.isEmpty()
|
||||
&& !evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||
return false;
|
||||
|
@@ -116,6 +116,7 @@ public:
|
||||
|
||||
void loadDefaults();
|
||||
bool prepareProject(const QString &inDir);
|
||||
bool loadSpecInternal();
|
||||
bool loadSpec();
|
||||
void initFrom(const QMakeEvaluator &other);
|
||||
void setupProject();
|
||||
|
Reference in New Issue
Block a user