forked from qt-creator/qt-creator
GenericProjectManager: Support framework paths
Rather than adding yet another meta file, we use the .includes file with a special line prefix. Fixes: QTCREATORBUG-20099 Change-Id: I494e0143b8e0f1f8828a56d7487b2201f1680337 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
\li \l{Specifying Files}{.files}
|
\li \l{Specifying Files}{.files}
|
||||||
|
|
||||||
\li \l{Specifying Include Paths}{.includes}
|
\li \l{Specifying Include Paths and Framework Paths}{.includes}
|
||||||
|
|
||||||
\li \l{Specifying Defines}{.config}
|
\li \l{Specifying Defines}{.config}
|
||||||
|
|
||||||
@@ -114,12 +114,14 @@
|
|||||||
git ls-files "*.cpp" "*.h" > MyProject.files
|
git ls-files "*.cpp" "*.h" > MyProject.files
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\section1 Specifying Include Paths
|
\section1 Specifying Include Paths and Framework Paths
|
||||||
|
|
||||||
The include paths are specified in the \tt{.includes} file, one include
|
The include paths are specified in the \tt{.includes} file, one include
|
||||||
path per line. The paths can be either absolute or relative to the
|
path per line. The paths can be either absolute or relative to the
|
||||||
\tt{.includes} file.
|
\tt{.includes} file.
|
||||||
|
|
||||||
|
Lines starting with "-F" are interpreted as framework paths.
|
||||||
|
|
||||||
\section1 Specifying Defines
|
\section1 Specifying Defines
|
||||||
|
|
||||||
The defines are specified in the \tt{.config} file. The \tt{.config} file is
|
The defines are specified in the \tt{.config} file. The \tt{.config} file is
|
||||||
|
@@ -291,7 +291,8 @@ bool GenericProject::addFiles(const QStringList &filePaths)
|
|||||||
for (const QString &filePath : filePaths)
|
for (const QString &filePath : filePaths)
|
||||||
insertSorted(&newList, baseDir.relativeFilePath(filePath));
|
insertSorted(&newList, baseDir.relativeFilePath(filePath));
|
||||||
|
|
||||||
const QSet<QString> includes = Utils::toSet(m_projectIncludePaths);
|
const auto includes = transform<QSet<QString>>(m_projectIncludePaths,
|
||||||
|
[](const HeaderPath &hp) { return hp.path; });
|
||||||
QSet<QString> toAdd;
|
QSet<QString> toAdd;
|
||||||
|
|
||||||
for (const QString &filePath : filePaths) {
|
for (const QString &filePath : filePaths) {
|
||||||
@@ -375,7 +376,21 @@ void GenericProject::parseProject(RefreshOptions options)
|
|||||||
|
|
||||||
if (options & Configuration) {
|
if (options & Configuration) {
|
||||||
m_rawProjectIncludePaths = readLines(m_includesFileName);
|
m_rawProjectIncludePaths = readLines(m_includesFileName);
|
||||||
m_projectIncludePaths = processEntries(m_rawProjectIncludePaths);
|
QStringList normalPaths;
|
||||||
|
QStringList frameworkPaths;
|
||||||
|
for (const QString &rawPath : m_rawProjectIncludePaths) {
|
||||||
|
if (rawPath.startsWith("-F"))
|
||||||
|
frameworkPaths << rawPath.mid(2);
|
||||||
|
else
|
||||||
|
normalPaths << rawPath;
|
||||||
|
}
|
||||||
|
const auto stringsToHeaderPaths = [this](const QStringList &paths, HeaderPathType type) {
|
||||||
|
return transform<HeaderPaths>(processEntries(paths),
|
||||||
|
[type](const QString &p) { return HeaderPath(p, type);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
m_projectIncludePaths = stringsToHeaderPaths(normalPaths, HeaderPathType::User);
|
||||||
|
m_projectIncludePaths << stringsToHeaderPaths(frameworkPaths, HeaderPathType::Framework);
|
||||||
m_cxxflags = readFlags(m_cxxflagsFileName);
|
m_cxxflags = readFlags(m_cxxflagsFileName);
|
||||||
m_cflags = readFlags(m_cflagsFileName);
|
m_cflags = readFlags(m_cflagsFileName);
|
||||||
|
|
||||||
@@ -499,7 +514,7 @@ void GenericProject::refreshCppCodeModel()
|
|||||||
rpp.setDisplayName(displayName());
|
rpp.setDisplayName(displayName());
|
||||||
rpp.setProjectFileLocation(projectFilePath().toString());
|
rpp.setProjectFileLocation(projectFilePath().toString());
|
||||||
rpp.setQtVersion(kitInfo.projectPartQtVersion);
|
rpp.setQtVersion(kitInfo.projectPartQtVersion);
|
||||||
rpp.setIncludePaths(m_projectIncludePaths);
|
rpp.setHeaderPaths(m_projectIncludePaths);
|
||||||
rpp.setConfigFileName(m_configFileName);
|
rpp.setConfigFileName(m_configFileName);
|
||||||
rpp.setFlagsForCxx({nullptr, m_cxxflags});
|
rpp.setFlagsForCxx({nullptr, m_cxxflags});
|
||||||
rpp.setFlagsForC({nullptr, m_cflags});
|
rpp.setFlagsForC({nullptr, m_cflags});
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <projectexplorer/headerpath.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ private:
|
|||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
QHash<QString, QString> m_rawListEntries;
|
QHash<QString, QString> m_rawListEntries;
|
||||||
QStringList m_rawProjectIncludePaths;
|
QStringList m_rawProjectIncludePaths;
|
||||||
QStringList m_projectIncludePaths;
|
ProjectExplorer::HeaderPaths m_projectIncludePaths;
|
||||||
QStringList m_cxxflags;
|
QStringList m_cxxflags;
|
||||||
QStringList m_cflags;
|
QStringList m_cflags;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user