forked from qt-creator/qt-creator
Clang: Move clang paths helper functions to Core plugin
These functions require core plugin so they can't go to utils library. At the same time to use them in ProjectExplorer plugin there are not too many choices where to put them without introducing new dependencies. Change-Id: I3cccccffaae8ac4bbce924fd809b5423da5dc503 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -459,6 +459,28 @@ QString ICore::libexecPath()
|
||||
return QDir::cleanPath(QApplication::applicationDirPath() + '/' + RELATIVE_LIBEXEC_PATH);
|
||||
}
|
||||
|
||||
static QString clangIncludePath(const QString &clangVersion)
|
||||
{
|
||||
return "/lib/clang/" + clangVersion + "/include";
|
||||
}
|
||||
|
||||
QString ICore::clangIncludeDirectory(const QString &clangVersion, const QString &clangResourceDirectory)
|
||||
{
|
||||
QDir dir(libexecPath() + "/clang" + clangIncludePath(clangVersion));
|
||||
if (!dir.exists() || !QFileInfo(dir, "stdint.h").exists())
|
||||
dir = QDir(clangResourceDirectory);
|
||||
return QDir::toNativeSeparators(dir.canonicalPath());
|
||||
}
|
||||
|
||||
QString ICore::clangExecutable(const QString &clangBinDirectory)
|
||||
{
|
||||
const QString hostExeSuffix(QTC_HOST_EXE_SUFFIX);
|
||||
QFileInfo executable(libexecPath() + "/clang/bin/clang" + hostExeSuffix);
|
||||
if (!executable.exists())
|
||||
executable = QFileInfo(clangBinDirectory + "/clang" + hostExeSuffix);
|
||||
return QDir::toNativeSeparators(executable.canonicalFilePath());
|
||||
}
|
||||
|
||||
static QString compilerString()
|
||||
{
|
||||
#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
|
||||
|
||||
Reference in New Issue
Block a user