forked from qt-creator/qt-creator
ProjectExplorer: Apply clang-format to msvctoolchain files
Change-Id: I92d7f216a514ad855c9bee2119f29617ecb9f52d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -60,10 +60,10 @@
|
|||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
|
|
||||||
#define KEY_ROOT "ProjectExplorer.MsvcToolChain."
|
#define KEY_ROOT "ProjectExplorer.MsvcToolChain."
|
||||||
static const char varsBatKeyC[] = KEY_ROOT"VarsBat";
|
static const char varsBatKeyC[] = KEY_ROOT "VarsBat";
|
||||||
static const char varsBatArgKeyC[] = KEY_ROOT"VarsBatArg";
|
static const char varsBatArgKeyC[] = KEY_ROOT "VarsBatArg";
|
||||||
static const char supportedAbiKeyC[] = KEY_ROOT"SupportedAbi";
|
static const char supportedAbiKeyC[] = KEY_ROOT "SupportedAbi";
|
||||||
static const char environModsKeyC[] = KEY_ROOT"environmentModifications";
|
static const char environModsKeyC[] = KEY_ROOT "environmentModifications";
|
||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
@@ -84,16 +84,16 @@ static QThreadPool *envModThreadPool()
|
|||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MsvcPlatform {
|
struct MsvcPlatform
|
||||||
|
{
|
||||||
MsvcToolChain::Platform platform;
|
MsvcToolChain::Platform platform;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *prefix; // VS up until 14.0 (MSVC2015)
|
const char *prefix; // VS up until 14.0 (MSVC2015)
|
||||||
const char *bat;
|
const char *bat;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MsvcPlatform platforms[] =
|
const MsvcPlatform platforms[]
|
||||||
{
|
= {{MsvcToolChain::x86, "x86", "/bin", "vcvars32.bat"},
|
||||||
{MsvcToolChain::x86, "x86", "/bin", "vcvars32.bat"},
|
|
||||||
{MsvcToolChain::amd64, "amd64", "/bin/amd64", "vcvars64.bat"},
|
{MsvcToolChain::amd64, "amd64", "/bin/amd64", "vcvars64.bat"},
|
||||||
{MsvcToolChain::x86_amd64, "x86_amd64", "/bin/x86_amd64", "vcvarsx86_amd64.bat"},
|
{MsvcToolChain::x86_amd64, "x86_amd64", "/bin/x86_amd64", "vcvarsx86_amd64.bat"},
|
||||||
{MsvcToolChain::ia64, "ia64", "/bin/ia64", "vcvars64.bat"},
|
{MsvcToolChain::ia64, "ia64", "/bin/ia64", "vcvars64.bat"},
|
||||||
@@ -101,8 +101,7 @@ const MsvcPlatform platforms[] =
|
|||||||
{MsvcToolChain::arm, "arm", "/bin/arm", "vcvarsarm.bat"},
|
{MsvcToolChain::arm, "arm", "/bin/arm", "vcvarsarm.bat"},
|
||||||
{MsvcToolChain::x86_arm, "x86_arm", "/bin/x86_arm", "vcvarsx86_arm.bat"},
|
{MsvcToolChain::x86_arm, "x86_arm", "/bin/x86_arm", "vcvarsx86_arm.bat"},
|
||||||
{MsvcToolChain::amd64_arm, "amd64_arm", "/bin/amd64_arm", "vcvarsamd64_arm.bat"},
|
{MsvcToolChain::amd64_arm, "amd64_arm", "/bin/amd64_arm", "vcvarsamd64_arm.bat"},
|
||||||
{MsvcToolChain::amd64_x86, "amd64_x86", "/bin/amd64_x86", "vcvarsamd64_x86.bat"}
|
{MsvcToolChain::amd64_x86, "amd64_x86", "/bin/amd64_x86", "vcvarsamd64_x86.bat"}};
|
||||||
};
|
|
||||||
|
|
||||||
static QList<const MsvcToolChain *> g_availableMsvcToolchains;
|
static QList<const MsvcToolChain *> g_availableMsvcToolchains;
|
||||||
|
|
||||||
@@ -164,10 +163,10 @@ QDebug operator<<(QDebug d, const VisualStudioInstallation &i)
|
|||||||
QDebugStateSaver saver(d);
|
QDebugStateSaver saver(d);
|
||||||
d.noquote();
|
d.noquote();
|
||||||
d.nospace();
|
d.nospace();
|
||||||
d << "VisualStudioInstallation(\"" << i.vsName << "\", v=" << i.version
|
d << "VisualStudioInstallation(\"" << i.vsName << "\", v=" << i.version << ", path=\""
|
||||||
<< ", path=\"" << QDir::toNativeSeparators(i.path)
|
<< QDir::toNativeSeparators(i.path) << "\", vcVarsPath=\""
|
||||||
<< "\", vcVarsPath=\"" << QDir::toNativeSeparators(i.vcVarsPath)
|
<< QDir::toNativeSeparators(i.vcVarsPath) << "\", vcVarsAll=\""
|
||||||
<< "\", vcVarsAll=\"" << QDir::toNativeSeparators(i.vcVarsAll) << "\")";
|
<< QDir::toNativeSeparators(i.vcVarsAll) << "\")";
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,8 +181,7 @@ static QString windowsProgramFilesDir()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Utils::optional<VisualStudioInstallation> installationFromPathAndVersion(
|
static Utils::optional<VisualStudioInstallation> installationFromPathAndVersion(
|
||||||
const QString &installationPath,
|
const QString &installationPath, const QVersionNumber &version)
|
||||||
const QVersionNumber &version)
|
|
||||||
{
|
{
|
||||||
QString vcVarsPath = QDir::fromNativeSeparators(installationPath);
|
QString vcVarsPath = QDir::fromNativeSeparators(installationPath);
|
||||||
if (!vcVarsPath.endsWith('/'))
|
if (!vcVarsPath.endsWith('/'))
|
||||||
@@ -196,8 +194,7 @@ static Utils::optional<VisualStudioInstallation> installationFromPathAndVersion(
|
|||||||
const QString vcVarsAllPath = vcVarsPath + QStringLiteral("/vcvarsall.bat");
|
const QString vcVarsAllPath = vcVarsPath + QStringLiteral("/vcvarsall.bat");
|
||||||
if (!QFileInfo(vcVarsAllPath).isFile()) {
|
if (!QFileInfo(vcVarsAllPath).isFile()) {
|
||||||
qWarning().noquote() << "Unable to find MSVC setup script "
|
qWarning().noquote() << "Unable to find MSVC setup script "
|
||||||
<< QDir::toNativeSeparators(vcVarsPath) << " in version "
|
<< QDir::toNativeSeparators(vcVarsPath) << " in version " << version;
|
||||||
<< version;
|
|
||||||
return Utils::nullopt;
|
return Utils::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,8 +235,8 @@ static QVector<VisualStudioInstallation> detectVisualStudioFromVsWhere(const QSt
|
|||||||
Utils::SynchronousProcess vsWhereProcess;
|
Utils::SynchronousProcess vsWhereProcess;
|
||||||
const int timeoutS = 5;
|
const int timeoutS = 5;
|
||||||
vsWhereProcess.setTimeoutS(timeoutS);
|
vsWhereProcess.setTimeoutS(timeoutS);
|
||||||
const QStringList arguments { "-products", "*", "-prerelease", "-legacy", "-format", "json",
|
const QStringList
|
||||||
"-utf8"};
|
arguments{"-products", "*", "-prerelease", "-legacy", "-format", "json", "-utf8"};
|
||||||
Utils::SynchronousProcessResponse response = vsWhereProcess.runBlocking(vswhere, arguments);
|
Utils::SynchronousProcessResponse response = vsWhereProcess.runBlocking(vswhere, arguments);
|
||||||
switch (response.result) {
|
switch (response.result) {
|
||||||
case Utils::SynchronousProcessResponse::Finished:
|
case Utils::SynchronousProcessResponse::Finished:
|
||||||
@@ -248,12 +245,13 @@ static QVector<VisualStudioInstallation> detectVisualStudioFromVsWhere(const QSt
|
|||||||
qWarning().noquote() << QDir::toNativeSeparators(vswhere) << "could not be started.";
|
qWarning().noquote() << QDir::toNativeSeparators(vswhere) << "could not be started.";
|
||||||
return installations;
|
return installations;
|
||||||
case Utils::SynchronousProcessResponse::FinishedError:
|
case Utils::SynchronousProcessResponse::FinishedError:
|
||||||
qWarning().noquote().nospace() << QDir::toNativeSeparators(vswhere) << " finished with exit "
|
qWarning().noquote().nospace() << QDir::toNativeSeparators(vswhere)
|
||||||
"code " << response.exitCode << ".";
|
<< " finished with exit code "
|
||||||
|
<< response.exitCode << ".";
|
||||||
return installations;
|
return installations;
|
||||||
case Utils::SynchronousProcessResponse::TerminatedAbnormally:
|
case Utils::SynchronousProcessResponse::TerminatedAbnormally:
|
||||||
qWarning().noquote().nospace() << QDir::toNativeSeparators(vswhere) << " crashed. Exit code: "
|
qWarning().noquote().nospace()
|
||||||
<< response.exitCode;
|
<< QDir::toNativeSeparators(vswhere) << " crashed. Exit code: " << response.exitCode;
|
||||||
return installations;
|
return installations;
|
||||||
case Utils::SynchronousProcessResponse::Hang:
|
case Utils::SynchronousProcessResponse::Hang:
|
||||||
qWarning().noquote() << QDir::toNativeSeparators(vswhere) << "did not finish in" << timeoutS
|
qWarning().noquote() << QDir::toNativeSeparators(vswhere) << "did not finish in" << timeoutS
|
||||||
@@ -308,9 +306,11 @@ static QVector<VisualStudioInstallation> detectVisualStudioFromRegistry()
|
|||||||
{
|
{
|
||||||
QVector<VisualStudioInstallation> result;
|
QVector<VisualStudioInstallation> result;
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
const QString keyRoot = QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\");
|
const QString keyRoot = QStringLiteral(
|
||||||
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\");
|
||||||
#else
|
#else
|
||||||
const QString keyRoot = QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\");
|
const QString keyRoot = QStringLiteral(
|
||||||
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\");
|
||||||
#endif
|
#endif
|
||||||
QSettings vsRegistry(keyRoot + QStringLiteral("VS7"), QSettings::NativeFormat);
|
QSettings vsRegistry(keyRoot + QStringLiteral("VS7"), QSettings::NativeFormat);
|
||||||
QScopedPointer<QSettings> vcRegistry;
|
QScopedPointer<QSettings> vcRegistry;
|
||||||
@@ -339,8 +339,8 @@ static QVector<VisualStudioInstallation> detectVisualStudio()
|
|||||||
const QString vswhere = windowsProgramFilesDir()
|
const QString vswhere = windowsProgramFilesDir()
|
||||||
+ "/Microsoft Visual Studio/Installer/vswhere.exe";
|
+ "/Microsoft Visual Studio/Installer/vswhere.exe";
|
||||||
if (QFileInfo::exists(vswhere)) {
|
if (QFileInfo::exists(vswhere)) {
|
||||||
const QVector<VisualStudioInstallation> installations
|
const QVector<VisualStudioInstallation> installations = detectVisualStudioFromVsWhere(
|
||||||
= detectVisualStudioFromVsWhere(vswhere);
|
vswhere);
|
||||||
if (!installations.isEmpty())
|
if (!installations.isEmpty())
|
||||||
return installations;
|
return installations;
|
||||||
}
|
}
|
||||||
@@ -348,14 +348,15 @@ static QVector<VisualStudioInstallation> detectVisualStudio()
|
|||||||
return detectVisualStudioFromRegistry();
|
return detectVisualStudioFromRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Abi findAbiOfMsvc(MsvcToolChain::Type type, MsvcToolChain::Platform platform, const QString &version)
|
static Abi findAbiOfMsvc(MsvcToolChain::Type type,
|
||||||
|
MsvcToolChain::Platform platform,
|
||||||
|
const QString &version)
|
||||||
{
|
{
|
||||||
Abi::Architecture arch = Abi::X86Architecture;
|
Abi::Architecture arch = Abi::X86Architecture;
|
||||||
Abi::OSFlavor flavor = Abi::UnknownFlavor;
|
Abi::OSFlavor flavor = Abi::UnknownFlavor;
|
||||||
int wordWidth = 64;
|
int wordWidth = 64;
|
||||||
|
|
||||||
switch (platform)
|
switch (platform) {
|
||||||
{
|
|
||||||
case MsvcToolChain::x86:
|
case MsvcToolChain::x86:
|
||||||
case MsvcToolChain::amd64_x86:
|
case MsvcToolChain::amd64_x86:
|
||||||
wordWidth = 32;
|
wordWidth = 32;
|
||||||
@@ -399,7 +400,8 @@ static Abi findAbiOfMsvc(MsvcToolChain::Type type, MsvcToolChain::Platform platf
|
|||||||
const Abi result = Abi(arch, Abi::WindowsOS, flavor, Abi::PEFormat, wordWidth);
|
const Abi result = Abi(arch, Abi::WindowsOS, flavor, Abi::PEFormat, wordWidth);
|
||||||
if (!result.isValid())
|
if (!result.isValid())
|
||||||
qWarning("Unable to completely determine the ABI of MSVC version %s (%s).",
|
qWarning("Unable to completely determine the ABI of MSVC version %s (%s).",
|
||||||
qPrintable(version), qPrintable(result.toString()));
|
qPrintable(version),
|
||||||
|
qPrintable(result.toString()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,8 +429,7 @@ static QByteArray msvcCompilationDefine(const char *def)
|
|||||||
|
|
||||||
static QByteArray msvcCompilationFile()
|
static QByteArray msvcCompilationFile()
|
||||||
{
|
{
|
||||||
static const char* macros[] = {
|
static const char *macros[] = {"_ATL_VER",
|
||||||
"_ATL_VER",
|
|
||||||
"__ATOM__",
|
"__ATOM__",
|
||||||
"__AVX__",
|
"__AVX__",
|
||||||
"__AVX2__",
|
"__AVX2__",
|
||||||
@@ -494,8 +495,7 @@ static QByteArray msvcCompilationFile()
|
|||||||
"_WIN64",
|
"_WIN64",
|
||||||
"_WINRT_DLL",
|
"_WINRT_DLL",
|
||||||
"_Wp64",
|
"_Wp64",
|
||||||
nullptr
|
nullptr};
|
||||||
};
|
|
||||||
QByteArray file = "#define __PPOUT__(x) V##x=x\n\n";
|
QByteArray file = "#define __PPOUT__(x) V##x=x\n\n";
|
||||||
for (int i = 0; macros[i] != nullptr; ++i)
|
for (int i = 0; macros[i] != nullptr; ++i)
|
||||||
file += msvcCompilationDefine(macros[i]);
|
file += msvcCompilationDefine(macros[i]);
|
||||||
@@ -571,13 +571,15 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
|
|||||||
const QString define = arg.mid(2);
|
const QString define = arg.mid(2);
|
||||||
predefinedMacros.append(Macro::fromKeyValue(define));
|
predefinedMacros.append(Macro::fromKeyValue(define));
|
||||||
} else if (arg.startsWith(QLatin1String("/U"))) {
|
} else if (arg.startsWith(QLatin1String("/U"))) {
|
||||||
predefinedMacros.append({arg.mid(2).toLocal8Bit(), ProjectExplorer::MacroType::Undefine});
|
predefinedMacros.append(
|
||||||
|
{arg.mid(2).toLocal8Bit(), ProjectExplorer::MacroType::Undefine});
|
||||||
} else {
|
} else {
|
||||||
toProcess.append(arg);
|
toProcess.append(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::TempFileSaver saver(Utils::TemporaryDirectory::masterDirectoryPath() + "/envtestXXXXXX.cpp");
|
Utils::TempFileSaver saver(Utils::TemporaryDirectory::masterDirectoryPath()
|
||||||
|
+ "/envtestXXXXXX.cpp");
|
||||||
saver.write(msvcCompilationFile());
|
saver.write(msvcCompilationFile());
|
||||||
if (!saver.finalize()) {
|
if (!saver.finalize()) {
|
||||||
qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString()));
|
qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString()));
|
||||||
@@ -597,8 +599,7 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
|
|||||||
arguments << QLatin1String("/TC");
|
arguments << QLatin1String("/TC");
|
||||||
arguments << toProcess << QLatin1String("/EP") << QDir::toNativeSeparators(saver.fileName());
|
arguments << toProcess << QLatin1String("/EP") << QDir::toNativeSeparators(saver.fileName());
|
||||||
Utils::SynchronousProcessResponse response = cpp.runBlocking(binary.toString(), arguments);
|
Utils::SynchronousProcessResponse response = cpp.runBlocking(binary.toString(), arguments);
|
||||||
if (response.result != Utils::SynchronousProcessResponse::Finished ||
|
if (response.result != Utils::SynchronousProcessResponse::Finished || response.exitCode != 0)
|
||||||
response.exitCode != 0)
|
|
||||||
return predefinedMacros;
|
return predefinedMacros;
|
||||||
|
|
||||||
const QStringList output = Utils::filtered(response.stdOut().split('\n'),
|
const QStringList output = Utils::filtered(response.stdOut().split('\n'),
|
||||||
@@ -664,7 +665,7 @@ LanguageVersion MsvcToolChain::msvcLanguageVersion(const QStringList & /*cxxflag
|
|||||||
static QString winExpandDelayedEnvReferences(QString in, const Utils::Environment &env)
|
static QString winExpandDelayedEnvReferences(QString in, const Utils::Environment &env)
|
||||||
{
|
{
|
||||||
const QChar exclamationMark = QLatin1Char('!');
|
const QChar exclamationMark = QLatin1Char('!');
|
||||||
for (int pos = 0; pos < in.size(); ) {
|
for (int pos = 0; pos < in.size();) {
|
||||||
// Replace "!REF!" by its value in process environment
|
// Replace "!REF!" by its value in process environment
|
||||||
pos = in.indexOf(exclamationMark, pos);
|
pos = in.indexOf(exclamationMark, pos);
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
@@ -682,16 +683,18 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
|
|||||||
|
|
||||||
void MsvcToolChain::environmentModifications(
|
void MsvcToolChain::environmentModifications(
|
||||||
QFutureInterface<MsvcToolChain::GenerateEnvResult> &future,
|
QFutureInterface<MsvcToolChain::GenerateEnvResult> &future,
|
||||||
QString vcvarsBat, QString varsBatArg)
|
QString vcvarsBat,
|
||||||
|
QString varsBatArg)
|
||||||
{
|
{
|
||||||
const Utils::Environment inEnv = Utils::Environment::systemEnvironment();
|
const Utils::Environment inEnv = Utils::Environment::systemEnvironment();
|
||||||
Utils::Environment outEnv;
|
Utils::Environment outEnv;
|
||||||
QMap<QString, QString> envPairs;
|
QMap<QString, QString> envPairs;
|
||||||
QList<Utils::EnvironmentItem> diff;
|
QList<Utils::EnvironmentItem> diff;
|
||||||
Utils::optional<QString> error = generateEnvironmentSettings(inEnv, vcvarsBat,
|
Utils::optional<QString> error = generateEnvironmentSettings(inEnv,
|
||||||
varsBatArg, envPairs);
|
vcvarsBat,
|
||||||
|
varsBatArg,
|
||||||
|
envPairs);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
|
||||||
// Now loop through and process them
|
// Now loop through and process them
|
||||||
for (auto envIter = envPairs.cbegin(), end = envPairs.cend(); envIter != end; ++envIter) {
|
for (auto envIter = envPairs.cbegin(), end = envPairs.cend(); envIter != end; ++envIter) {
|
||||||
const QString expandedValue = winExpandDelayedEnvReferences(envIter.value(), inEnv);
|
const QString expandedValue = winExpandDelayedEnvReferences(envIter.value(), inEnv);
|
||||||
@@ -744,7 +747,7 @@ void MsvcToolChain::updateEnvironmentModifications(QList<Utils::EnvironmentItem>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environment& env) const
|
Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environment &env) const
|
||||||
{
|
{
|
||||||
Utils::Environment resultEnv = env;
|
Utils::Environment resultEnv = env;
|
||||||
if (m_environmentModifications.isEmpty()) {
|
if (m_environmentModifications.isEmpty()) {
|
||||||
@@ -769,11 +772,14 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environmen
|
|||||||
// MsvcToolChain
|
// MsvcToolChain
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
MsvcToolChain::MsvcToolChain(const QString &name, const Abi &abi,
|
MsvcToolChain::MsvcToolChain(const QString &name,
|
||||||
const QString &varsBat, const QString &varsBatArg, Core::Id l,
|
const Abi &abi,
|
||||||
Detection d) :
|
const QString &varsBat,
|
||||||
MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID, name, abi, varsBat, varsBatArg, l, d)
|
const QString &varsBatArg,
|
||||||
{ }
|
Core::Id l,
|
||||||
|
Detection d)
|
||||||
|
: MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID, name, abi, varsBat, varsBatArg, l, d)
|
||||||
|
{}
|
||||||
|
|
||||||
MsvcToolChain::MsvcToolChain(const MsvcToolChain &other)
|
MsvcToolChain::MsvcToolChain(const MsvcToolChain &other)
|
||||||
: ToolChain(other)
|
: ToolChain(other)
|
||||||
@@ -804,8 +810,12 @@ MsvcToolChain::MsvcToolChain(const MsvcToolChain &other)
|
|||||||
setDisplayName(other.displayName());
|
setDisplayName(other.displayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &abi,
|
MsvcToolChain::MsvcToolChain(Core::Id typeId,
|
||||||
const QString &varsBat, const QString &varsBatArg, Core::Id l,
|
const QString &name,
|
||||||
|
const Abi &abi,
|
||||||
|
const QString &varsBat,
|
||||||
|
const QString &varsBatArg,
|
||||||
|
Core::Id l,
|
||||||
Detection d)
|
Detection d)
|
||||||
: ToolChain(typeId, d)
|
: ToolChain(typeId, d)
|
||||||
, m_predefinedMacrosCache(std::make_shared<Cache<MacroInspectionReport, 64>>())
|
, m_predefinedMacrosCache(std::make_shared<Cache<MacroInspectionReport, 64>>())
|
||||||
@@ -818,7 +828,8 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &ab
|
|||||||
setLanguage(l);
|
setLanguage(l);
|
||||||
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
||||||
&MsvcToolChain::environmentModifications,
|
&MsvcToolChain::environmentModifications,
|
||||||
varsBat, varsBatArg));
|
varsBat,
|
||||||
|
varsBatArg));
|
||||||
|
|
||||||
Q_ASSERT(!name.isEmpty());
|
Q_ASSERT(!name.isEmpty());
|
||||||
|
|
||||||
@@ -829,7 +840,7 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId)
|
|||||||
: ToolChain(typeId, ManualDetection)
|
: ToolChain(typeId, ManualDetection)
|
||||||
, m_predefinedMacrosCache(std::make_shared<Cache<MacroInspectionReport, 64>>())
|
, m_predefinedMacrosCache(std::make_shared<Cache<MacroInspectionReport, 64>>())
|
||||||
, m_lastEnvironment(Utils::Environment::systemEnvironment())
|
, m_lastEnvironment(Utils::Environment::systemEnvironment())
|
||||||
{ }
|
{}
|
||||||
|
|
||||||
void MsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags &flags)
|
void MsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags &flags)
|
||||||
{
|
{
|
||||||
@@ -837,12 +848,14 @@ void MsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags &flags)
|
|||||||
flags = flags & WarningFlags::AsErrors;
|
flags = flags & WarningFlags::AsErrors;
|
||||||
|
|
||||||
if (warningLevel >= 1)
|
if (warningLevel >= 1)
|
||||||
flags |= WarningFlags(WarningFlags::Default | WarningFlags::IgnoredQualfiers | WarningFlags::HiddenLocals | WarningFlags::UnknownPragma);
|
flags |= WarningFlags(WarningFlags::Default | WarningFlags::IgnoredQualfiers
|
||||||
|
| WarningFlags::HiddenLocals | WarningFlags::UnknownPragma);
|
||||||
if (warningLevel >= 2)
|
if (warningLevel >= 2)
|
||||||
flags |= WarningFlags::All;
|
flags |= WarningFlags::All;
|
||||||
if (warningLevel >= 3) {
|
if (warningLevel >= 3) {
|
||||||
flags |= WarningFlags(WarningFlags::Extra | WarningFlags::NonVirtualDestructor | WarningFlags::SignedComparison
|
flags |= WarningFlags(WarningFlags::Extra | WarningFlags::NonVirtualDestructor
|
||||||
| WarningFlags::UnusedLocals | WarningFlags::Deprecated);
|
| WarningFlags::SignedComparison | WarningFlags::UnusedLocals
|
||||||
|
| WarningFlags::Deprecated);
|
||||||
}
|
}
|
||||||
if (warningLevel >= 4)
|
if (warningLevel >= 4)
|
||||||
flags |= WarningFlags::UnusedParams;
|
flags |= WarningFlags::UnusedParams;
|
||||||
@@ -853,8 +866,9 @@ void MsvcToolChain::toolChainUpdated()
|
|||||||
m_predefinedMacrosCache->invalidate();
|
m_predefinedMacrosCache->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
MsvcToolChain::MsvcToolChain() : MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID)
|
MsvcToolChain::MsvcToolChain()
|
||||||
{ }
|
: MsvcToolChain(Constants::MSVC_TOOLCHAIN_TYPEID)
|
||||||
|
{}
|
||||||
|
|
||||||
MsvcToolChain::~MsvcToolChain()
|
MsvcToolChain::~MsvcToolChain()
|
||||||
{
|
{
|
||||||
@@ -876,8 +890,7 @@ bool MsvcToolChain::isValid() const
|
|||||||
|
|
||||||
QString MsvcToolChain::originalTargetTriple() const
|
QString MsvcToolChain::originalTargetTriple() const
|
||||||
{
|
{
|
||||||
return m_abi.wordWidth() == 64
|
return m_abi.wordWidth() == 64 ? QLatin1String("x86_64-pc-windows-msvc")
|
||||||
? QLatin1String("x86_64-pc-windows-msvc")
|
|
||||||
: QLatin1String("i686-pc-windows-msvc");
|
: QLatin1String("i686-pc-windows-msvc");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -961,12 +974,12 @@ bool MsvcToolChain::fromMap(const QVariantMap &data)
|
|||||||
|
|
||||||
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
||||||
&MsvcToolChain::environmentModifications,
|
&MsvcToolChain::environmentModifications,
|
||||||
m_vcvarsBat, m_varsBatArg));
|
m_vcvarsBat,
|
||||||
|
m_varsBatArg));
|
||||||
|
|
||||||
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
|
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<ToolChainConfigWidget> MsvcToolChain::createConfigurationWidget()
|
std::unique_ptr<ToolChainConfigWidget> MsvcToolChain::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return std::make_unique<MsvcToolChainConfigWidget>(this);
|
return std::make_unique<MsvcToolChainConfigWidget>(this);
|
||||||
@@ -1046,16 +1059,18 @@ WarningFlags MsvcToolChain::warningFlags(const QStringList &cflags) const
|
|||||||
if (!flag.isEmpty() && flag[0] == QLatin1Char('-'))
|
if (!flag.isEmpty() && flag[0] == QLatin1Char('-'))
|
||||||
flag[0] = QLatin1Char('/');
|
flag[0] = QLatin1Char('/');
|
||||||
|
|
||||||
if (flag == QLatin1String("/WX"))
|
if (flag == QLatin1String("/WX")) {
|
||||||
flags |= WarningFlags::AsErrors;
|
flags |= WarningFlags::AsErrors;
|
||||||
else if (flag == QLatin1String("/W0") || flag == QLatin1String("/w"))
|
} else if (flag == QLatin1String("/W0") || flag == QLatin1String("/w")) {
|
||||||
inferWarningsForLevel(0, flags);
|
inferWarningsForLevel(0, flags);
|
||||||
else if (flag == QLatin1String("/W1"))
|
} else if (flag == QLatin1String("/W1")) {
|
||||||
inferWarningsForLevel(1, flags);
|
inferWarningsForLevel(1, flags);
|
||||||
else if (flag == QLatin1String("/W2"))
|
} else if (flag == QLatin1String("/W2")) {
|
||||||
inferWarningsForLevel(2, flags);
|
inferWarningsForLevel(2, flags);
|
||||||
else if (flag == QLatin1String("/W3") || flag == QLatin1String("/W4") || flag == QLatin1String("/Wall"))
|
} else if (flag == QLatin1String("/W3") || flag == QLatin1String("/W4")
|
||||||
|
|| flag == QLatin1String("/Wall")) {
|
||||||
inferWarningsForLevel(3, flags);
|
inferWarningsForLevel(3, flags);
|
||||||
|
}
|
||||||
|
|
||||||
WarningFlagAdder add(flag, flags);
|
WarningFlagAdder add(flag, flags);
|
||||||
if (add.triggered())
|
if (add.triggered())
|
||||||
@@ -1092,14 +1107,17 @@ ToolChain::BuiltInHeaderPathsRunner MsvcToolChain::createBuiltInHeaderPathsRunne
|
|||||||
return [this, env](const QStringList &, const QString &) {
|
return [this, env](const QStringList &, const QString &) {
|
||||||
QMutexLocker locker(m_headerPathsMutex);
|
QMutexLocker locker(m_headerPathsMutex);
|
||||||
if (m_headerPaths.isEmpty()) {
|
if (m_headerPaths.isEmpty()) {
|
||||||
foreach (const QString &path, env.value(QLatin1String("INCLUDE")).split(QLatin1Char(';')))
|
foreach (const QString &path,
|
||||||
|
env.value(QLatin1String("INCLUDE")).split(QLatin1Char(';'))) {
|
||||||
m_headerPaths.append({path, HeaderPathType::BuiltIn});
|
m_headerPaths.append({path, HeaderPathType::BuiltIn});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return m_headerPaths;
|
return m_headerPaths;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderPaths MsvcToolChain::builtInHeaderPaths(const QStringList &cxxflags, const Utils::FileName &sysRoot) const
|
HeaderPaths MsvcToolChain::builtInHeaderPaths(const QStringList &cxxflags,
|
||||||
|
const Utils::FileName &sysRoot) const
|
||||||
{
|
{
|
||||||
return createBuiltInHeaderPathsRunner()(cxxflags, sysRoot.toString());
|
return createBuiltInHeaderPathsRunner()(cxxflags, sysRoot.toString());
|
||||||
}
|
}
|
||||||
@@ -1138,7 +1156,9 @@ QString MsvcToolChain::makeCommand(const Utils::Environment &environment) const
|
|||||||
|
|
||||||
QString command;
|
QString command;
|
||||||
if (useJom) {
|
if (useJom) {
|
||||||
tmp = environment.searchInPath(jom, {Utils::FileName::fromString(QCoreApplication::applicationDirPath())});
|
tmp = environment.searchInPath(jom,
|
||||||
|
{Utils::FileName::fromString(
|
||||||
|
QCoreApplication::applicationDirPath())});
|
||||||
if (!tmp.isEmpty())
|
if (!tmp.isEmpty())
|
||||||
command = tmp.toString();
|
command = tmp.toString();
|
||||||
}
|
}
|
||||||
@@ -1163,7 +1183,8 @@ Utils::FileName MsvcToolChain::compilerCommand() const
|
|||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||||
addToEnvironment(env);
|
addToEnvironment(env);
|
||||||
|
|
||||||
Utils::FileName clexe = env.searchInPath(QLatin1String("cl.exe"), {}, [](const Utils::FileName &name) {
|
Utils::FileName clexe
|
||||||
|
= env.searchInPath(QLatin1String("cl.exe"), {}, [](const Utils::FileName &name) {
|
||||||
QDir dir(QDir::cleanPath(name.toFileInfo().absolutePath() + QStringLiteral("/..")));
|
QDir dir(QDir::cleanPath(name.toFileInfo().absolutePath() + QStringLiteral("/..")));
|
||||||
do {
|
do {
|
||||||
if (QFile::exists(dir.absoluteFilePath(QStringLiteral("vcvarsall.bat")))
|
if (QFile::exists(dir.absoluteFilePath(QStringLiteral("vcvarsall.bat")))
|
||||||
@@ -1186,10 +1207,10 @@ IOutputParser *MsvcToolChain::outputParser() const
|
|||||||
// call setFromMsvcToolChain().
|
// call setFromMsvcToolChain().
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc) :
|
MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc)
|
||||||
ToolChainConfigWidget(tc),
|
: ToolChainConfigWidget(tc)
|
||||||
m_nameDisplayLabel(new QLabel(this)),
|
, m_nameDisplayLabel(new QLabel(this))
|
||||||
m_varsBatDisplayLabel(new QLabel(this))
|
, m_varsBatDisplayLabel(new QLabel(this))
|
||||||
{
|
{
|
||||||
m_nameDisplayLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
m_nameDisplayLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
m_mainLayout->addRow(m_nameDisplayLabel);
|
m_mainLayout->addRow(m_nameDisplayLabel);
|
||||||
@@ -1200,7 +1221,7 @@ MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc) :
|
|||||||
void MsvcBasedToolChainConfigWidget::setFromMsvcToolChain()
|
void MsvcBasedToolChainConfigWidget::setFromMsvcToolChain()
|
||||||
{
|
{
|
||||||
const auto *tc = static_cast<const MsvcToolChain *>(toolChain());
|
const auto *tc = static_cast<const MsvcToolChain *>(toolChain());
|
||||||
QTC_ASSERT(tc, return);
|
QTC_ASSERT(tc, return );
|
||||||
m_nameDisplayLabel->setText(tc->displayName());
|
m_nameDisplayLabel->setText(tc->displayName());
|
||||||
QString varsBatDisplay = QDir::toNativeSeparators(tc->varsBat());
|
QString varsBatDisplay = QDir::toNativeSeparators(tc->varsBat());
|
||||||
if (!tc->varsBatArg().isEmpty()) {
|
if (!tc->varsBatArg().isEmpty()) {
|
||||||
@@ -1214,8 +1235,8 @@ void MsvcBasedToolChainConfigWidget::setFromMsvcToolChain()
|
|||||||
// MsvcToolChainConfigWidget
|
// MsvcToolChainConfigWidget
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
MsvcToolChainConfigWidget::MsvcToolChainConfigWidget(ToolChain *tc) :
|
MsvcToolChainConfigWidget::MsvcToolChainConfigWidget(ToolChain *tc)
|
||||||
MsvcBasedToolChainConfigWidget(tc)
|
: MsvcBasedToolChainConfigWidget(tc)
|
||||||
{
|
{
|
||||||
addErrorLabel();
|
addErrorLabel();
|
||||||
setFromMsvcToolChain();
|
setFromMsvcToolChain();
|
||||||
@@ -1244,8 +1265,10 @@ ClangClToolChainConfigWidget::ClangClToolChainConfigWidget(ToolChain *tc)
|
|||||||
setFromClangClToolChain();
|
setFromClangClToolChain();
|
||||||
|
|
||||||
if (m_compilerCommand) {
|
if (m_compilerCommand) {
|
||||||
connect(m_compilerCommand, &Utils::PathChooser::rawPathChanged,
|
connect(m_compilerCommand,
|
||||||
this, &ClangClToolChainConfigWidget::dirty);
|
&Utils::PathChooser::rawPathChanged,
|
||||||
|
this,
|
||||||
|
&ClangClToolChainConfigWidget::dirty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,28 +1285,28 @@ void ClangClToolChainConfigWidget::setFromClangClToolChain()
|
|||||||
static const MsvcToolChain *findMsvcToolChain(unsigned char wordWidth, Abi::OSFlavor flavor)
|
static const MsvcToolChain *findMsvcToolChain(unsigned char wordWidth, Abi::OSFlavor flavor)
|
||||||
{
|
{
|
||||||
return Utils::findOrDefault(g_availableMsvcToolchains,
|
return Utils::findOrDefault(g_availableMsvcToolchains,
|
||||||
[wordWidth, flavor] (const MsvcToolChain *tc)
|
[wordWidth, flavor](const MsvcToolChain *tc) {
|
||||||
{ const Abi abi = tc->targetAbi();
|
const Abi abi = tc->targetAbi();
|
||||||
return abi.osFlavor() == flavor
|
return abi.osFlavor() == flavor && wordWidth == abi.wordWidth();
|
||||||
&& wordWidth == abi.wordWidth();} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static QVersionNumber clangClVersion(const QString& clangClPath)
|
static QVersionNumber clangClVersion(const QString &clangClPath)
|
||||||
{
|
{
|
||||||
Utils::SynchronousProcess clangClProcess;
|
Utils::SynchronousProcess clangClProcess;
|
||||||
const Utils::SynchronousProcessResponse response = clangClProcess.runBlocking(
|
const Utils::SynchronousProcessResponse response
|
||||||
clangClPath, {QStringLiteral("--version")});
|
= clangClProcess.runBlocking(clangClPath, {QStringLiteral("--version")});
|
||||||
if (response.result != Utils::SynchronousProcessResponse::Finished || response.exitCode != 0)
|
if (response.result != Utils::SynchronousProcessResponse::Finished || response.exitCode != 0)
|
||||||
return {};
|
return {};
|
||||||
const QRegularExpressionMatch match = QRegularExpression(
|
const QRegularExpressionMatch match = QRegularExpression(
|
||||||
QStringLiteral("clang version (\\d+(\\.\\d+)+)")).match(response.stdOut());
|
QStringLiteral("clang version (\\d+(\\.\\d+)+)"))
|
||||||
|
.match(response.stdOut());
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return {};
|
return {};
|
||||||
return QVersionNumber::fromString(match.captured(1));
|
return QVersionNumber::fromString(match.captured(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MsvcToolChain *selectMsvcToolChain(const QString &clangClPath,
|
static const MsvcToolChain *selectMsvcToolChain(const QString &clangClPath, unsigned char wordWidth)
|
||||||
unsigned char wordWidth)
|
|
||||||
{
|
{
|
||||||
const MsvcToolChain *toolChain = nullptr;
|
const MsvcToolChain *toolChain = nullptr;
|
||||||
const QVersionNumber version = clangClVersion(clangClPath);
|
const QVersionNumber version = clangClVersion(clangClPath);
|
||||||
@@ -1297,8 +1320,9 @@ static const MsvcToolChain *selectMsvcToolChain(const QString &clangClPath,
|
|||||||
return toolChain;
|
return toolChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QList<ToolChain *> detectClangClToolChainInPath(
|
static QList<ToolChain *> detectClangClToolChainInPath(const QString &clangClPath,
|
||||||
const QString &clangClPath, const QList<ToolChain *> &alreadyKnown, bool isDefault = false)
|
const QList<ToolChain *> &alreadyKnown,
|
||||||
|
bool isDefault = false)
|
||||||
{
|
{
|
||||||
QList<ToolChain *> res;
|
QList<ToolChain *> res;
|
||||||
const unsigned char wordWidth = Utils::is64BitWindowsBinary(clangClPath) ? 64 : 32;
|
const unsigned char wordWidth = Utils::is64BitWindowsBinary(clangClPath) ? 64 : 32;
|
||||||
@@ -1316,18 +1340,17 @@ static QList<ToolChain *> detectClangClToolChainInPath(
|
|||||||
.arg(QLatin1String(isDefault ? "Default " : ""))
|
.arg(QLatin1String(isDefault ? "Default " : ""))
|
||||||
.arg(wordWidth)
|
.arg(wordWidth)
|
||||||
.arg(Abi::toString(targetAbi.osFlavor()).toUpper());
|
.arg(Abi::toString(targetAbi.osFlavor()).toUpper());
|
||||||
for (auto language: {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
for (auto language : {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
||||||
ClangClToolChain *tc = static_cast<ClangClToolChain *>(
|
ClangClToolChain *tc = static_cast<ClangClToolChain *>(
|
||||||
Utils::findOrDefault(
|
Utils::findOrDefault(alreadyKnown, [&](ToolChain *tc) -> bool {
|
||||||
alreadyKnown,
|
|
||||||
[&targetAbi, &language, &clangClPath, &systemEnvironment](ToolChain *tc) -> bool {
|
|
||||||
if (tc->typeId() != Constants::CLANG_CL_TOOLCHAIN_TYPEID)
|
if (tc->typeId() != Constants::CLANG_CL_TOOLCHAIN_TYPEID)
|
||||||
return false;
|
return false;
|
||||||
if (tc->targetAbi() != targetAbi)
|
if (tc->targetAbi() != targetAbi)
|
||||||
return false;
|
return false;
|
||||||
if (tc->language() != language)
|
if (tc->language() != language)
|
||||||
return false;
|
return false;
|
||||||
return systemEnvironment.isSameExecutable(tc->compilerCommand().toString(), clangClPath);
|
return systemEnvironment.isSameExecutable(tc->compilerCommand().toString(),
|
||||||
|
clangClPath);
|
||||||
}));
|
}));
|
||||||
if (!tc) {
|
if (!tc) {
|
||||||
tc = new ClangClToolChain(name, clangClPath, language, ToolChain::AutoDetection);
|
tc = new ClangClToolChain(name, clangClPath, language, ToolChain::AutoDetection);
|
||||||
@@ -1382,16 +1405,17 @@ void ClangClToolChainConfigWidget::discardImpl()
|
|||||||
// clang-cl.exe as a [to some extent] compatible drop-in replacement for cl.
|
// clang-cl.exe as a [to some extent] compatible drop-in replacement for cl.
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
ClangClToolChain::ClangClToolChain(const QString &name, const QString &clangPath,
|
ClangClToolChain::ClangClToolChain(const QString &name,
|
||||||
|
const QString &clangPath,
|
||||||
Core::Id language,
|
Core::Id language,
|
||||||
Detection d)
|
Detection d)
|
||||||
: MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID, name, Abi(), "", "", language, d)
|
: MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID, name, Abi(), "", "", language, d)
|
||||||
, m_clangPath(clangPath)
|
, m_clangPath(clangPath)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
ClangClToolChain::ClangClToolChain() : MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID)
|
ClangClToolChain::ClangClToolChain()
|
||||||
{ }
|
: MsvcToolChain(Constants::CLANG_CL_TOOLCHAIN_TYPEID)
|
||||||
|
{}
|
||||||
|
|
||||||
bool ClangClToolChain::isValid() const
|
bool ClangClToolChain::isValid() const
|
||||||
{
|
{
|
||||||
@@ -1433,7 +1457,10 @@ ToolChain *ClangClToolChain::clone() const
|
|||||||
return new ClangClToolChain(*this);
|
return new ClangClToolChain(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString llvmDirKey() { return QStringLiteral("ProjectExplorer.ClangClToolChain.LlvmDir"); }
|
static inline QString llvmDirKey()
|
||||||
|
{
|
||||||
|
return QStringLiteral("ProjectExplorer.ClangClToolChain.LlvmDir");
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap ClangClToolChain::toMap() const
|
QVariantMap ClangClToolChain::toMap() const
|
||||||
{
|
{
|
||||||
@@ -1473,12 +1500,13 @@ void ClangClToolChain::resetMsvcToolChain(const MsvcToolChain *base)
|
|||||||
|
|
||||||
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
initEnvModWatcher(Utils::runAsync(envModThreadPool(),
|
||||||
&ClangClToolChain::environmentModifications,
|
&ClangClToolChain::environmentModifications,
|
||||||
m_vcvarsBat, base->varsBatArg()));
|
m_vcvarsBat,
|
||||||
|
base->varsBatArg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClangClToolChain::operator ==(const ToolChain &other) const
|
bool ClangClToolChain::operator==(const ToolChain &other) const
|
||||||
{
|
{
|
||||||
if (!MsvcToolChain::operator ==(other))
|
if (!MsvcToolChain::operator==(other))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto *clangClTc = static_cast<const ClangClToolChain *>(&other);
|
const auto *clangClTc = static_cast<const ClangClToolChain *>(&other);
|
||||||
@@ -1500,8 +1528,7 @@ Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
|
|||||||
arguments.append("-");
|
arguments.append("-");
|
||||||
Utils::SynchronousProcessResponse response = cpp.runBlocking(compilerCommand().toString(),
|
Utils::SynchronousProcessResponse response = cpp.runBlocking(compilerCommand().toString(),
|
||||||
arguments);
|
arguments);
|
||||||
if (response.result != Utils::SynchronousProcessResponse::Finished ||
|
if (response.result != Utils::SynchronousProcessResponse::Finished || response.exitCode != 0) {
|
||||||
response.exitCode != 0) {
|
|
||||||
// Show the warning but still parse the output.
|
// Show the warning but still parse the output.
|
||||||
QTC_CHECK(false && "clang-cl exited with non-zero code.");
|
QTC_CHECK(false && "clang-cl exited with non-zero code.");
|
||||||
}
|
}
|
||||||
@@ -1532,7 +1559,8 @@ QSet<Core::Id> MsvcToolChainFactory::supportedLanguages() const
|
|||||||
return {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID};
|
return {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform,
|
QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath,
|
||||||
|
MsvcToolChain::Platform platform,
|
||||||
const QVersionNumber &v)
|
const QVersionNumber &v)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
@@ -1547,17 +1575,16 @@ QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, MsvcToolChai
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QList<ToolChain *> findOrCreateToolChain(
|
static QList<ToolChain *> findOrCreateToolChain(const QList<ToolChain *> &alreadyKnown,
|
||||||
const QList<ToolChain *> &alreadyKnown,
|
const QString &name,
|
||||||
const QString &name, const Abi &abi,
|
const Abi &abi,
|
||||||
const QString &varsBat, const QString &varsBatArg,
|
const QString &varsBat,
|
||||||
|
const QString &varsBatArg,
|
||||||
ToolChain::Detection d = ToolChain::ManualDetection)
|
ToolChain::Detection d = ToolChain::ManualDetection)
|
||||||
{
|
{
|
||||||
QList<ToolChain *> res;
|
QList<ToolChain *> res;
|
||||||
for (auto language: {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
for (auto language : {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
||||||
ToolChain *tc = Utils::findOrDefault(
|
ToolChain *tc = Utils::findOrDefault(alreadyKnown, [&](ToolChain *tc) -> bool {
|
||||||
alreadyKnown,
|
|
||||||
[&varsBat, &varsBatArg, &abi, &language](ToolChain *tc) -> bool {
|
|
||||||
if (tc->typeId() != Constants::MSVC_TOOLCHAIN_TYPEID)
|
if (tc->typeId() != Constants::MSVC_TOOLCHAIN_TYPEID)
|
||||||
return false;
|
return false;
|
||||||
if (tc->targetAbi() != abi)
|
if (tc->targetAbi() != abi)
|
||||||
@@ -1565,8 +1592,7 @@ static QList<ToolChain *> findOrCreateToolChain(
|
|||||||
if (tc->language() != language)
|
if (tc->language() != language)
|
||||||
return false;
|
return false;
|
||||||
auto mtc = static_cast<MsvcToolChain *>(tc);
|
auto mtc = static_cast<MsvcToolChain *>(tc);
|
||||||
return mtc->varsBat() == varsBat
|
return mtc->varsBat() == varsBat && mtc->varsBatArg() == varsBatArg;
|
||||||
&& mtc->varsBatArg() == varsBatArg;
|
|
||||||
});
|
});
|
||||||
if (!tc)
|
if (!tc)
|
||||||
tc = new MsvcToolChain(name, abi, varsBat, varsBatArg, language, d);
|
tc = new MsvcToolChain(name, abi, varsBat, varsBatArg, language, d);
|
||||||
@@ -1578,7 +1604,8 @@ static QList<ToolChain *> findOrCreateToolChain(
|
|||||||
// Detect build tools introduced with MSVC2015
|
// Detect build tools introduced with MSVC2015
|
||||||
static void detectCppBuildTools2015(QList<ToolChain *> *list)
|
static void detectCppBuildTools2015(QList<ToolChain *> *list)
|
||||||
{
|
{
|
||||||
struct Entry {
|
struct Entry
|
||||||
|
{
|
||||||
const char *postFix;
|
const char *postFix;
|
||||||
const char *varsBatArg;
|
const char *varsBatArg;
|
||||||
Abi::Architecture architecture;
|
Abi::Architecture architecture;
|
||||||
@@ -1586,25 +1613,29 @@ static void detectCppBuildTools2015(QList<ToolChain *> *list)
|
|||||||
unsigned char wordSize;
|
unsigned char wordSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Entry entries[] = {
|
const Entry entries[] = {{" (x86)", "x86", Abi::X86Architecture, Abi::PEFormat, 32},
|
||||||
{" (x86)", "x86", Abi::X86Architecture, Abi::PEFormat, 32},
|
|
||||||
{" (x64)", "amd64", Abi::X86Architecture, Abi::PEFormat, 64},
|
{" (x64)", "amd64", Abi::X86Architecture, Abi::PEFormat, 64},
|
||||||
{" (x86_arm)", "x86_arm", Abi::ArmArchitecture, Abi::PEFormat, 32},
|
{" (x86_arm)", "x86_arm", Abi::ArmArchitecture, Abi::PEFormat, 32},
|
||||||
{" (x64_arm)", "amd64_arm", Abi::ArmArchitecture, Abi::PEFormat, 64}
|
{" (x64_arm)", "amd64_arm", Abi::ArmArchitecture, Abi::PEFormat, 64}};
|
||||||
};
|
|
||||||
|
|
||||||
const QString name = QStringLiteral("Microsoft Visual C++ Build Tools");
|
const QString name = QStringLiteral("Microsoft Visual C++ Build Tools");
|
||||||
const QString vcVarsBat = windowsProgramFilesDir()
|
const QString vcVarsBat = windowsProgramFilesDir() + QLatin1Char('/') + name
|
||||||
+ QLatin1Char('/') + name + QStringLiteral("/vcbuildtools.bat");
|
+ QStringLiteral("/vcbuildtools.bat");
|
||||||
if (!QFileInfo(vcVarsBat).isFile())
|
if (!QFileInfo(vcVarsBat).isFile())
|
||||||
return;
|
return;
|
||||||
for (const Entry &e : entries) {
|
for (const Entry &e : entries) {
|
||||||
const Abi abi(e.architecture, Abi::WindowsOS, Abi::WindowsMsvc2015Flavor,
|
const Abi abi(e.architecture,
|
||||||
e.format, e.wordSize);
|
Abi::WindowsOS,
|
||||||
for (auto language: {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
Abi::WindowsMsvc2015Flavor,
|
||||||
list->append(new MsvcToolChain(name + QLatin1String(e.postFix), abi,
|
e.format,
|
||||||
vcVarsBat, QLatin1String(e.varsBatArg),
|
e.wordSize);
|
||||||
language, ToolChain::AutoDetection));
|
for (auto language : {Constants::C_LANGUAGE_ID, Constants::CXX_LANGUAGE_ID}) {
|
||||||
|
list->append(new MsvcToolChain(name + QLatin1String(e.postFix),
|
||||||
|
abi,
|
||||||
|
vcVarsBat,
|
||||||
|
QLatin1String(e.varsBatArg),
|
||||||
|
language,
|
||||||
|
ToolChain::AutoDetection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1614,13 +1645,17 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
|||||||
QList<ToolChain *> results;
|
QList<ToolChain *> results;
|
||||||
|
|
||||||
// 1) Installed SDKs preferred over standalone Visual studio
|
// 1) Installed SDKs preferred over standalone Visual studio
|
||||||
const QSettings sdkRegistry(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows"),
|
const QSettings
|
||||||
|
sdkRegistry(QLatin1String(
|
||||||
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows"),
|
||||||
QSettings::NativeFormat);
|
QSettings::NativeFormat);
|
||||||
const QString defaultSdkPath = sdkRegistry.value(QLatin1String("CurrentInstallFolder")).toString();
|
const QString defaultSdkPath = sdkRegistry.value(QLatin1String("CurrentInstallFolder"))
|
||||||
|
.toString();
|
||||||
if (!defaultSdkPath.isEmpty()) {
|
if (!defaultSdkPath.isEmpty()) {
|
||||||
foreach (const QString &sdkKey, sdkRegistry.childGroups()) {
|
foreach (const QString &sdkKey, sdkRegistry.childGroups()) {
|
||||||
const QString name = sdkRegistry.value(sdkKey + QLatin1String("/ProductName")).toString();
|
const QString name = sdkRegistry.value(sdkKey + QLatin1String("/ProductName")).toString();
|
||||||
const QString folder = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder")).toString();
|
const QString folder = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder"))
|
||||||
|
.toString();
|
||||||
if (folder.isEmpty())
|
if (folder.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1632,17 +1667,22 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QList<ToolChain *> tmp;
|
QList<ToolChain *> tmp;
|
||||||
const QVector<QPair<MsvcToolChain::Platform, QString> > platforms = {
|
const QVector<QPair<MsvcToolChain::Platform, QString>> platforms = {
|
||||||
{MsvcToolChain::x86, "x86"},
|
{MsvcToolChain::x86, "x86"},
|
||||||
{MsvcToolChain::amd64, "x64"},
|
{MsvcToolChain::amd64, "x64"},
|
||||||
{MsvcToolChain::ia64, "ia64"},
|
{MsvcToolChain::ia64, "ia64"},
|
||||||
};
|
};
|
||||||
for (auto platform: platforms) {
|
for (auto platform : platforms) {
|
||||||
tmp.append(findOrCreateToolChain(
|
tmp.append(findOrCreateToolChain(alreadyKnown,
|
||||||
alreadyKnown,
|
generateDisplayName(name,
|
||||||
generateDisplayName(name, MsvcToolChain::WindowsSDK, platform.first),
|
MsvcToolChain::WindowsSDK,
|
||||||
findAbiOfMsvc(MsvcToolChain::WindowsSDK, platform.first, sdkKey),
|
platform.first),
|
||||||
fi.absoluteFilePath(), "/" + platform.second, ToolChain::AutoDetection));
|
findAbiOfMsvc(MsvcToolChain::WindowsSDK,
|
||||||
|
platform.first,
|
||||||
|
sdkKey),
|
||||||
|
fi.absoluteFilePath(),
|
||||||
|
"/" + platform.second,
|
||||||
|
ToolChain::AutoDetection));
|
||||||
}
|
}
|
||||||
// Make sure the default is front.
|
// Make sure the default is front.
|
||||||
if (folder == defaultSdkPath)
|
if (folder == defaultSdkPath)
|
||||||
@@ -1657,23 +1697,27 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
|||||||
// x86_arm was put before amd64_arm as a workaround for auto detected windows phone
|
// x86_arm was put before amd64_arm as a workaround for auto detected windows phone
|
||||||
// toolchains. As soon as windows phone builds support x64 cross builds, this change
|
// toolchains. As soon as windows phone builds support x64 cross builds, this change
|
||||||
// can be reverted.
|
// can be reverted.
|
||||||
const MsvcToolChain::Platform platforms[] = {
|
const MsvcToolChain::Platform platforms[] = {MsvcToolChain::x86,
|
||||||
MsvcToolChain::x86, MsvcToolChain::amd64_x86,
|
MsvcToolChain::amd64_x86,
|
||||||
MsvcToolChain::amd64, MsvcToolChain::x86_amd64,
|
MsvcToolChain::amd64,
|
||||||
MsvcToolChain::arm, MsvcToolChain::x86_arm, MsvcToolChain::amd64_arm,
|
MsvcToolChain::x86_amd64,
|
||||||
MsvcToolChain::ia64, MsvcToolChain::x86_ia64
|
MsvcToolChain::arm,
|
||||||
};
|
MsvcToolChain::x86_arm,
|
||||||
|
MsvcToolChain::amd64_arm,
|
||||||
|
MsvcToolChain::ia64,
|
||||||
|
MsvcToolChain::x86_ia64};
|
||||||
|
|
||||||
foreach (const VisualStudioInstallation &i, detectVisualStudio()) {
|
foreach (const VisualStudioInstallation &i, detectVisualStudio()) {
|
||||||
for (MsvcToolChain::Platform platform : platforms) {
|
for (MsvcToolChain::Platform platform : platforms) {
|
||||||
const bool toolchainInstalled =
|
const bool toolchainInstalled
|
||||||
QFileInfo(vcVarsBatFor(i.vcVarsPath, platform, i.version)).isFile();
|
= QFileInfo(vcVarsBatFor(i.vcVarsPath, platform, i.version)).isFile();
|
||||||
if (hostSupportsPlatform(platform) && toolchainInstalled) {
|
if (hostSupportsPlatform(platform) && toolchainInstalled) {
|
||||||
results.append(findOrCreateToolChain(
|
results.append(
|
||||||
alreadyKnown,
|
findOrCreateToolChain(alreadyKnown,
|
||||||
generateDisplayName(i.vsName, MsvcToolChain::VS, platform),
|
generateDisplayName(i.vsName, MsvcToolChain::VS, platform),
|
||||||
findAbiOfMsvc(MsvcToolChain::VS, platform, i.vsName),
|
findAbiOfMsvc(MsvcToolChain::VS, platform, i.vsName),
|
||||||
i.vcVarsAll, platformName(platform),
|
i.vcVarsAll,
|
||||||
|
platformName(platform),
|
||||||
ToolChain::AutoDetection));
|
ToolChain::AutoDetection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1712,8 +1756,10 @@ QList<ToolChain *> ClangClToolChainFactory::autoDetect(const QList<ToolChain *>
|
|||||||
|
|
||||||
QString qtCreatorsClang = Core::ICore::clangExecutable(CLANG_BINDIR);
|
QString qtCreatorsClang = Core::ICore::clangExecutable(CLANG_BINDIR);
|
||||||
if (!qtCreatorsClang.isEmpty()) {
|
if (!qtCreatorsClang.isEmpty()) {
|
||||||
qtCreatorsClang = Utils::FileName::fromString(qtCreatorsClang).parentDir()
|
qtCreatorsClang = Utils::FileName::fromString(qtCreatorsClang)
|
||||||
.appendPath("clang-cl.exe").toString();
|
.parentDir()
|
||||||
|
.appendPath("clang-cl.exe")
|
||||||
|
.toString();
|
||||||
results.append(detectClangClToolChainInPath(qtCreatorsClang, alreadyKnown, true));
|
results.append(detectClangClToolChainInPath(qtCreatorsClang, alreadyKnown, true));
|
||||||
known.append(results);
|
known.append(results);
|
||||||
}
|
}
|
||||||
@@ -1741,14 +1787,13 @@ ToolChain *ClangClToolChainFactory::create(Core::Id l)
|
|||||||
return new ClangClToolChain("clang-cl", "", l, ToolChain::ManualDetection);
|
return new ClangClToolChain("clang-cl", "", l, ToolChain::ManualDetection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MsvcToolChain::operator ==(const ToolChain &other) const
|
bool MsvcToolChain::operator==(const ToolChain &other) const
|
||||||
{
|
{
|
||||||
if (!ToolChain::operator ==(other))
|
if (!ToolChain::operator==(other))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto *msvcTc = dynamic_cast<const MsvcToolChain *>(&other);
|
const auto *msvcTc = dynamic_cast<const MsvcToolChain *>(&other);
|
||||||
return targetAbi() == msvcTc->targetAbi()
|
return targetAbi() == msvcTc->targetAbi() && m_vcvarsBat == msvcTc->m_vcvarsBat
|
||||||
&& m_vcvarsBat == msvcTc->m_vcvarsBat
|
|
||||||
&& m_varsBatArg == msvcTc->m_varsBatArg;
|
&& m_varsBatArg == msvcTc->m_varsBatArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1795,12 +1840,12 @@ Utils::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils:
|
|||||||
runEnv.unset(QLatin1String("ORIGINALPATH"));
|
runEnv.unset(QLatin1String("ORIGINALPATH"));
|
||||||
run.setEnvironment(runEnv.toStringList());
|
run.setEnvironment(runEnv.toStringList());
|
||||||
run.setTimeoutS(30);
|
run.setTimeoutS(30);
|
||||||
Utils::FileName cmdPath = Utils::FileName::fromUserInput(QString::fromLocal8Bit(qgetenv("COMSPEC")));
|
Utils::FileName cmdPath = Utils::FileName::fromUserInput(
|
||||||
|
QString::fromLocal8Bit(qgetenv("COMSPEC")));
|
||||||
if (cmdPath.isEmpty())
|
if (cmdPath.isEmpty())
|
||||||
cmdPath = env.searchInPath(QLatin1String("cmd.exe"));
|
cmdPath = env.searchInPath(QLatin1String("cmd.exe"));
|
||||||
// Windows SDK setup scripts require command line switches for environment expansion.
|
// Windows SDK setup scripts require command line switches for environment expansion.
|
||||||
QStringList cmdArguments({
|
QStringList cmdArguments({QLatin1String("/E:ON"), QLatin1String("/V:ON"), QLatin1String("/c")});
|
||||||
QLatin1String("/E:ON"), QLatin1String("/V:ON"), QLatin1String("/c")});
|
|
||||||
cmdArguments << QDir::toNativeSeparators(saver.fileName());
|
cmdArguments << QDir::toNativeSeparators(saver.fileName());
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "readEnvironmentSetting: " << call << cmdPath << cmdArguments.join(' ')
|
qDebug() << "readEnvironmentSetting: " << call << cmdPath << cmdArguments.join(' ')
|
||||||
@@ -1818,7 +1863,8 @@ Utils::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils:
|
|||||||
command += ' ' + batchArgs;
|
command += ' ' + batchArgs;
|
||||||
return QCoreApplication::translate("ProjectExplorer::Internal::MsvcToolChain",
|
return QCoreApplication::translate("ProjectExplorer::Internal::MsvcToolChain",
|
||||||
"Failed to retrieve MSVC Environment from \"%1\":\n"
|
"Failed to retrieve MSVC Environment from \"%1\":\n"
|
||||||
"%2").arg(command, message);
|
"%2")
|
||||||
|
.arg(command, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The SDK/MSVC scripts do not return exit codes != 0. Check on stdout.
|
// The SDK/MSVC scripts do not return exit codes != 0. Check on stdout.
|
||||||
@@ -1858,7 +1904,7 @@ bool MsvcToolChainFactory::canRestore(const QVariantMap &data)
|
|||||||
return id == Constants::MSVC_TOOLCHAIN_TYPEID;
|
return id == Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ToolChainType>
|
template<class ToolChainType>
|
||||||
ToolChainType *readFromMap(const QVariantMap &data)
|
ToolChainType *readFromMap(const QVariantMap &data)
|
||||||
{
|
{
|
||||||
auto result = new ToolChainType;
|
auto result = new ToolChainType;
|
||||||
@@ -1904,12 +1950,11 @@ MsvcToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, WarningFl
|
|||||||
m_triggered = true;
|
m_triggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MsvcToolChain::WarningFlagAdder::operator ()(int warningCode, WarningFlags flagsSet)
|
void MsvcToolChain::WarningFlagAdder::operator()(int warningCode, WarningFlags flagsSet)
|
||||||
{
|
{
|
||||||
if (m_triggered)
|
if (m_triggered)
|
||||||
return;
|
return;
|
||||||
if (warningCode == m_warningCode)
|
if (warningCode == m_warningCode) {
|
||||||
{
|
|
||||||
m_triggered = true;
|
m_triggered = true;
|
||||||
if (m_doesEnable)
|
if (m_doesEnable)
|
||||||
m_flags |= flagsSet;
|
m_flags |= flagsSet;
|
||||||
|
@@ -38,7 +38,9 @@
|
|||||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||||
QT_FORWARD_DECLARE_CLASS(QVersionNumber)
|
QT_FORWARD_DECLARE_CLASS(QVersionNumber)
|
||||||
|
|
||||||
namespace Utils { class PathChooser; }
|
namespace Utils {
|
||||||
|
class PathChooser;
|
||||||
|
}
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -51,20 +53,14 @@ class MsvcToolChain : public ToolChain
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type { WindowsSDK, VS };
|
enum Type { WindowsSDK, VS };
|
||||||
enum Platform { x86,
|
enum Platform { x86, amd64, x86_amd64, ia64, x86_ia64, arm, x86_arm, amd64_arm, amd64_x86 };
|
||||||
amd64,
|
|
||||||
x86_amd64,
|
|
||||||
ia64,
|
|
||||||
x86_ia64,
|
|
||||||
arm,
|
|
||||||
x86_arm,
|
|
||||||
amd64_arm,
|
|
||||||
amd64_x86
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit MsvcToolChain(const QString &name, const Abi &abi,
|
explicit MsvcToolChain(const QString &name,
|
||||||
const QString &varsBat, const QString &varsBatArg,
|
const Abi &abi,
|
||||||
Core::Id l, Detection d = ManualDetection);
|
const QString &varsBat,
|
||||||
|
const QString &varsBatArg,
|
||||||
|
Core::Id l,
|
||||||
|
Detection d = ManualDetection);
|
||||||
MsvcToolChain(const MsvcToolChain &other);
|
MsvcToolChain(const MsvcToolChain &other);
|
||||||
MsvcToolChain();
|
MsvcToolChain();
|
||||||
~MsvcToolChain() override;
|
~MsvcToolChain() override;
|
||||||
@@ -104,7 +100,7 @@ public:
|
|||||||
QString varsBat() const { return m_vcvarsBat; }
|
QString varsBat() const { return m_vcvarsBat; }
|
||||||
void setVarsBatArg(const QString &varsBA) { m_varsBatArg = varsBA; }
|
void setVarsBatArg(const QString &varsBA) { m_varsBatArg = varsBA; }
|
||||||
|
|
||||||
bool operator == (const ToolChain &) const override;
|
bool operator==(const ToolChain &) const override;
|
||||||
|
|
||||||
static void cancelMsvcToolChainDetection();
|
static void cancelMsvcToolChainDetection();
|
||||||
static Utils::optional<QString> generateEnvironmentSettings(const Utils::Environment &env,
|
static Utils::optional<QString> generateEnvironmentSettings(const Utils::Environment &env,
|
||||||
@@ -112,7 +108,6 @@ public:
|
|||||||
const QString &batchArgs,
|
const QString &batchArgs,
|
||||||
QMap<QString, QString> &envPairs);
|
QMap<QString, QString> &envPairs);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class WarningFlagAdder
|
class WarningFlagAdder
|
||||||
{
|
{
|
||||||
@@ -120,22 +115,27 @@ protected:
|
|||||||
WarningFlags &m_flags;
|
WarningFlags &m_flags;
|
||||||
bool m_doesEnable = false;
|
bool m_doesEnable = false;
|
||||||
bool m_triggered = false;
|
bool m_triggered = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WarningFlagAdder(const QString &flag, WarningFlags &flags);
|
WarningFlagAdder(const QString &flag, WarningFlags &flags);
|
||||||
void operator ()(int warningCode, WarningFlags flagsSet);
|
void operator()(int warningCode, WarningFlags flagsSet);
|
||||||
|
|
||||||
bool triggered() const;
|
bool triggered() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit MsvcToolChain(Core::Id typeId, const QString &name, const Abi &abi,
|
explicit MsvcToolChain(Core::Id typeId,
|
||||||
const QString &varsBat, const QString &varsBatArg,
|
const QString &name,
|
||||||
Core::Id l, Detection d);
|
const Abi &abi,
|
||||||
|
const QString &varsBat,
|
||||||
|
const QString &varsBatArg,
|
||||||
|
Core::Id l,
|
||||||
|
Detection d);
|
||||||
explicit MsvcToolChain(Core::Id typeId);
|
explicit MsvcToolChain(Core::Id typeId);
|
||||||
|
|
||||||
static void inferWarningsForLevel(int warningLevel, WarningFlags &flags);
|
static void inferWarningsForLevel(int warningLevel, WarningFlags &flags);
|
||||||
void toolChainUpdated() override;
|
void toolChainUpdated() override;
|
||||||
|
|
||||||
Utils::Environment readEnvironmentSetting(const Utils::Environment& env) const;
|
Utils::Environment readEnvironmentSetting(const Utils::Environment &env) const;
|
||||||
// Function must be thread-safe!
|
// Function must be thread-safe!
|
||||||
virtual Macros msvcPredefinedMacros(const QStringList &cxxflags,
|
virtual Macros msvcPredefinedMacros(const QStringList &cxxflags,
|
||||||
const Utils::Environment &env) const;
|
const Utils::Environment &env) const;
|
||||||
@@ -149,7 +149,8 @@ protected:
|
|||||||
QList<Utils::EnvironmentItem> environmentItems;
|
QList<Utils::EnvironmentItem> environmentItems;
|
||||||
};
|
};
|
||||||
static void environmentModifications(QFutureInterface<GenerateEnvResult> &future,
|
static void environmentModifications(QFutureInterface<GenerateEnvResult> &future,
|
||||||
QString vcvarsBat, QString varsBatArg);
|
QString vcvarsBat,
|
||||||
|
QString varsBatArg);
|
||||||
void initEnvModWatcher(const QFuture<GenerateEnvResult> &future);
|
void initEnvModWatcher(const QFuture<GenerateEnvResult> &future);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -177,9 +178,7 @@ protected:
|
|||||||
class ClangClToolChain : public MsvcToolChain
|
class ClangClToolChain : public MsvcToolChain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangClToolChain(const QString &name, const QString &llvmDir,
|
ClangClToolChain(const QString &name, const QString &llvmDir, Core::Id language, Detection d);
|
||||||
Core::Id language,
|
|
||||||
Detection d);
|
|
||||||
ClangClToolChain();
|
ClangClToolChain();
|
||||||
|
|
||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
@@ -204,7 +203,8 @@ public:
|
|||||||
const Core::Id &language,
|
const Core::Id &language,
|
||||||
const Macros ¯os) const override;
|
const Macros ¯os) const override;
|
||||||
|
|
||||||
bool operator ==(const ToolChain &) const override;
|
bool operator==(const ToolChain &) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_clangPath;
|
QString m_clangPath;
|
||||||
};
|
};
|
||||||
@@ -226,7 +226,8 @@ public:
|
|||||||
bool canRestore(const QVariantMap &data) override;
|
bool canRestore(const QVariantMap &data) override;
|
||||||
ToolChain *restore(const QVariantMap &data) override;
|
ToolChain *restore(const QVariantMap &data) override;
|
||||||
|
|
||||||
static QString vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform,
|
static QString vcVarsBatFor(const QString &basePath,
|
||||||
|
MsvcToolChain::Platform platform,
|
||||||
const QVersionNumber &v);
|
const QVersionNumber &v);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +247,6 @@ public:
|
|||||||
ToolChain *create(Core::Id l) override;
|
ToolChain *create(Core::Id l) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// MsvcBasedToolChainConfigWidget
|
// MsvcBasedToolChainConfigWidget
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -259,10 +259,10 @@ public:
|
|||||||
explicit MsvcBasedToolChainConfigWidget(ToolChain *);
|
explicit MsvcBasedToolChainConfigWidget(ToolChain *);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void applyImpl() override { }
|
void applyImpl() override {}
|
||||||
void discardImpl() override { setFromMsvcToolChain(); }
|
void discardImpl() override { setFromMsvcToolChain(); }
|
||||||
bool isDirtyImpl() const override { return false; }
|
bool isDirtyImpl() const override { return false; }
|
||||||
void makeReadOnlyImpl() override { }
|
void makeReadOnlyImpl() override {}
|
||||||
|
|
||||||
void setFromMsvcToolChain();
|
void setFromMsvcToolChain();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user