Skip to content
Snippets Groups Projects
Commit 60c8686e authored by dt's avatar dt
Browse files

Add the precompiled headers to the project info

QMake passes those headers directly to gcc, so the user doesn't need to
include themselves.
parent 8b335028
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,7 @@ public: ...@@ -76,6 +76,7 @@ public:
QStringList sourceFiles; QStringList sourceFiles;
QStringList includePaths; QStringList includePaths;
QStringList frameworkPaths; QStringList frameworkPaths;
QStringList precompiledHeaders;
}; };
class WorkingCopy class WorkingCopy
......
...@@ -938,6 +938,11 @@ void Qt4ProFileNode::update() ...@@ -938,6 +938,11 @@ void Qt4ProFileNode::update()
newVarValues[UiDirVar] = uiDirPaths(reader); newVarValues[UiDirVar] = uiDirPaths(reader);
newVarValues[MocDirVar] = mocDirPaths(reader); newVarValues[MocDirVar] = mocDirPaths(reader);
newVarValues[PkgConfigVar] = reader->values(QLatin1String("PKGCONFIG")); newVarValues[PkgConfigVar] = reader->values(QLatin1String("PKGCONFIG"));
newVarValues[PrecompiledHeaderVar] =
reader->absoluteFileValues(QLatin1String("PRECOMPILED_HEADER"),
m_projectDir,
QStringList() << m_projectDir,
0);
if (m_varValues != newVarValues) { if (m_varValues != newVarValues) {
m_varValues = newVarValues; m_varValues = newVarValues;
......
...@@ -97,7 +97,8 @@ enum Qt4Variable { ...@@ -97,7 +97,8 @@ enum Qt4Variable {
IncludePathVar, IncludePathVar,
UiDirVar, UiDirVar,
MocDirVar, MocDirVar,
PkgConfigVar PkgConfigVar,
PrecompiledHeaderVar
}; };
class Qt4PriFileNode; class Qt4PriFileNode;
......
...@@ -507,6 +507,7 @@ void Qt4Project::updateCodeModel() ...@@ -507,6 +507,7 @@ void Qt4Project::updateCodeModel()
QByteArray definedMacros = predefinedMacros; QByteArray definedMacros = predefinedMacros;
QStringList allIncludePaths = predefinedIncludePaths; QStringList allIncludePaths = predefinedIncludePaths;
QStringList allFrameworkPaths = predefinedFrameworkPaths; QStringList allFrameworkPaths = predefinedFrameworkPaths;
QStringList allPrecompileHeaders;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS")); const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
...@@ -529,6 +530,10 @@ void Qt4Project::updateCodeModel() ...@@ -529,6 +530,10 @@ void Qt4Project::updateCodeModel()
info.includes = predefinedIncludePaths; info.includes = predefinedIncludePaths;
info.frameworkPaths = predefinedFrameworkPaths; info.frameworkPaths = predefinedFrameworkPaths;
info.precompiledHeader = pro->variableValue(PrecompiledHeaderVar);
allPrecompileHeaders.append(info.precompiledHeader);
// Add custom defines // Add custom defines
foreach (const QString def, pro->variableValue(DefinesVar)) { foreach (const QString def, pro->variableValue(DefinesVar)) {
definedMacros += "#define "; definedMacros += "#define ";
...@@ -623,10 +628,13 @@ void Qt4Project::updateCodeModel() ...@@ -623,10 +628,13 @@ void Qt4Project::updateCodeModel()
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this); CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
if (pinfo.defines == predefinedMacros && //qDebug()<<"Using precompiled header"<<allPrecompileHeaders;
pinfo.includePaths == allIncludePaths &&
pinfo.frameworkPaths == allFrameworkPaths && if (pinfo.defines == predefinedMacros
pinfo.sourceFiles == files) { && pinfo.includePaths == allIncludePaths
&& pinfo.frameworkPaths == allFrameworkPaths
&& pinfo.sourceFiles == files
&& pinfo.precompiledHeaders == allPrecompileHeaders) {
// Nothing to update... // Nothing to update...
} else { } else {
if (pinfo.defines != predefinedMacros || if (pinfo.defines != predefinedMacros ||
...@@ -641,6 +649,7 @@ void Qt4Project::updateCodeModel() ...@@ -641,6 +649,7 @@ void Qt4Project::updateCodeModel()
pinfo.includePaths = allIncludePaths; pinfo.includePaths = allIncludePaths;
pinfo.frameworkPaths = allFrameworkPaths; pinfo.frameworkPaths = allFrameworkPaths;
pinfo.sourceFiles = files; pinfo.sourceFiles = files;
pinfo.precompiledHeaders = allPrecompileHeaders;
modelmanager->updateProjectInfo(pinfo); modelmanager->updateProjectInfo(pinfo);
modelmanager->updateSourceFiles(pinfo.sourceFiles); modelmanager->updateSourceFiles(pinfo.sourceFiles);
......
...@@ -82,6 +82,7 @@ namespace Internal { ...@@ -82,6 +82,7 @@ namespace Internal {
QByteArray defines; QByteArray defines;
QStringList includes; QStringList includes;
QStringList frameworkPaths; QStringList frameworkPaths;
QStringList precompiledHeader;
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment