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();
|
ProFileCacheManager::instance()->incRefCount();
|
||||||
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||||
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
ProFileEvaluator evaluator(&option, &parser, &msgHandler);
|
||||||
if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) {
|
evaluator.loadNamedSpec(mkspecPath().toString(), false);
|
||||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
|
||||||
pro->deref();
|
|
||||||
}
|
|
||||||
|
|
||||||
parseMkSpec(&evaluator);
|
parseMkSpec(&evaluator);
|
||||||
|
|
||||||
|
@@ -69,10 +69,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
|||||||
ProFileCacheManager::instance()->incRefCount();
|
ProFileCacheManager::instance()->incRefCount();
|
||||||
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler);
|
||||||
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
ProFileEvaluator evaluator(&globals, &parser, &msgHandler);
|
||||||
if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) {
|
evaluator.loadNamedSpec(mkspec.toString(), false);
|
||||||
evaluator.accept(pro, QMakeEvaluator::LoadProOnly);
|
|
||||||
pro->deref();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
||||||
qSort(factories.begin(), factories.end(), &sortByPriority);
|
qSort(factories.begin(), factories.end(), &sortByPriority);
|
||||||
|
@@ -184,6 +184,15 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
|
|||||||
return TT_Unknown;
|
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)
|
bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||||
{
|
{
|
||||||
return d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue;
|
return d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue;
|
||||||
|
@@ -69,6 +69,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
void setOutputDir(const QString &dir); // Default is empty
|
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 accept(ProFile *pro, QMakeEvaluator::LoadFlags flags = QMakeEvaluator::LoadAll);
|
||||||
|
|
||||||
bool contains(const QString &variableName) const;
|
bool contains(const QString &variableName) const;
|
||||||
|
@@ -1032,6 +1032,33 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
|
|||||||
return true;
|
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()
|
bool QMakeEvaluator::loadSpec()
|
||||||
{
|
{
|
||||||
QString qmakespec = m_option->expandEnvVars(
|
QString qmakespec = m_option->expandEnvVars(
|
||||||
@@ -1085,29 +1112,9 @@ bool QMakeEvaluator::loadSpec()
|
|||||||
&& !evaluateFileDirect(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& !evaluateFileDirect(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!evaluateFeatureFile(QLatin1String("spec_pre.prf")))
|
if (!loadSpecInternal())
|
||||||
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;
|
return false;
|
||||||
updateFeaturePaths(); // The spec extends the feature search path, so rebuild the cache.
|
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()
|
if (!m_conffile.isEmpty()
|
||||||
&& !evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
&& !evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -116,6 +116,7 @@ public:
|
|||||||
|
|
||||||
void loadDefaults();
|
void loadDefaults();
|
||||||
bool prepareProject(const QString &inDir);
|
bool prepareProject(const QString &inDir);
|
||||||
|
bool loadSpecInternal();
|
||||||
bool loadSpec();
|
bool loadSpec();
|
||||||
void initFrom(const QMakeEvaluator &other);
|
void initFrom(const QMakeEvaluator &other);
|
||||||
void setupProject();
|
void setupProject();
|
||||||
|
Reference in New Issue
Block a user