- implement: correctly recognize clang (msys2 build)
This commit is contained in:
parent
f872512574
commit
bed1dab265
1
NEWS.md
1
NEWS.md
|
@ -6,6 +6,7 @@ Version 0.6.0
|
||||||
- change: auto open a new editor at start
|
- change: auto open a new editor at start
|
||||||
- enhancement: todo view
|
- enhancement: todo view
|
||||||
- add: about dialog
|
- add: about dialog
|
||||||
|
- implement: correctly recognize clang (msys2 build)
|
||||||
|
|
||||||
Version 0.5.0
|
Version 0.5.0
|
||||||
- enhancement: support C++ using type alias;
|
- enhancement: support C++ using type alias;
|
||||||
|
|
|
@ -1282,6 +1282,7 @@ Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set):
|
||||||
mName(set.mName),
|
mName(set.mName),
|
||||||
mDefines(set.mDefines),
|
mDefines(set.mDefines),
|
||||||
mTarget(set.mTarget),
|
mTarget(set.mTarget),
|
||||||
|
mCompilerType(set.mCompilerType),
|
||||||
mUseCustomCompileParams(set.mUseCustomCompileParams),
|
mUseCustomCompileParams(set.mUseCustomCompileParams),
|
||||||
mUseCustomLinkParams(set.mUseCustomLinkParams),
|
mUseCustomLinkParams(set.mUseCustomLinkParams),
|
||||||
mCustomCompileParams(set.mCustomCompileParams),
|
mCustomCompileParams(set.mCustomCompileParams),
|
||||||
|
@ -1726,36 +1727,50 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
|
||||||
mTarget = "i686";
|
mTarget = "i686";
|
||||||
|
|
||||||
//Find version number
|
//Find version number
|
||||||
targetStr = "gcc version ";
|
targetStr = "clang version ";
|
||||||
delimPos1 = output.indexOf(targetStr);
|
delimPos1 = output.indexOf(targetStr);
|
||||||
if (delimPos1<0)
|
if (delimPos1>=0) {
|
||||||
return; // unknown binary
|
mCompilerType = "Clang";
|
||||||
delimPos1+=strlen(targetStr);
|
delimPos1+=strlen(targetStr);
|
||||||
delimPos2 = delimPos1;
|
delimPos2 = delimPos1;
|
||||||
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
||||||
delimPos2++;
|
delimPos2++;
|
||||||
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
||||||
|
|
||||||
// Find compiler builder
|
mName = "Clang " + mVersion;
|
||||||
delimPos1 = delimPos2;
|
} else {
|
||||||
while ((delimPos1 < output.length()) && !(output[delimPos1] == '('))
|
mCompilerType = "GCC";
|
||||||
delimPos1++;
|
targetStr = "gcc version ";
|
||||||
while ((delimPos2 < output.length()) && !(output[delimPos2] == ')'))
|
delimPos1 = output.indexOf(targetStr);
|
||||||
delimPos2++;
|
if (delimPos1<0)
|
||||||
mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1);
|
return; // unknown binary
|
||||||
|
delimPos1+=strlen(targetStr);
|
||||||
|
delimPos2 = delimPos1;
|
||||||
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
||||||
|
delimPos2++;
|
||||||
|
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
||||||
|
|
||||||
// Assemble user friendly name if we don't have one yet
|
// Find compiler builder
|
||||||
if (mName == "") {
|
delimPos1 = delimPos2;
|
||||||
if (mType.contains("tdm64")) {
|
while ((delimPos1 < output.length()) && !(output[delimPos1] == '('))
|
||||||
mName = "TDM-GCC " + mVersion;
|
delimPos1++;
|
||||||
} else if (mType.contains("tdm")) {
|
while ((delimPos2 < output.length()) && !(output[delimPos2] == ')'))
|
||||||
mName = "TDM-GCC " + mVersion;
|
delimPos2++;
|
||||||
} else if (mType.contains("MSYS2")) {
|
mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1);
|
||||||
mName = "MinGW-w64 GCC " + mVersion;
|
|
||||||
} else if (mType.contains("GCC")) {
|
// Assemble user friendly name if we don't have one yet
|
||||||
mName = "MinGW GCC " + mVersion;
|
if (mName == "") {
|
||||||
} else {
|
if (mType.contains("tdm64")) {
|
||||||
mName = "MinGW GCC " + mVersion;
|
mName = "TDM-GCC " + mVersion;
|
||||||
|
} else if (mType.contains("tdm")) {
|
||||||
|
mName = "TDM-GCC " + mVersion;
|
||||||
|
} else if (mType.contains("MSYS2")) {
|
||||||
|
mName = "MinGW-w64 GCC " + mVersion;
|
||||||
|
} else if (mType.contains("GCC")) {
|
||||||
|
mName = "MinGW GCC " + mVersion;
|
||||||
|
} else {
|
||||||
|
mName = "MinGW GCC " + mVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2131,6 +2146,16 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
|
||||||
return result.trimmed();
|
return result.trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::CompilerSet::setCompilerType(const QString &newCompilerType)
|
||||||
|
{
|
||||||
|
mCompilerType = newCompilerType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString &Settings::CompilerSet::compilerType() const
|
||||||
|
{
|
||||||
|
return mCompilerType;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::CompilerSet::staticLink() const
|
bool Settings::CompilerSet::staticLink() const
|
||||||
{
|
{
|
||||||
return mStaticLink;
|
return mStaticLink;
|
||||||
|
|
|
@ -937,6 +937,10 @@ public:
|
||||||
|
|
||||||
static int charToValue(char valueChar);
|
static int charToValue(char valueChar);
|
||||||
static char valueToChar(int val);
|
static char valueToChar(int val);
|
||||||
|
const QString &compilerType() const;
|
||||||
|
|
||||||
|
void setCompilerType(const QString &newCompilerType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Initialization
|
// Initialization
|
||||||
void setExecutables();
|
void setExecutables();
|
||||||
|
@ -972,6 +976,7 @@ public:
|
||||||
QString mName; // "TDM-GCC 4.7.1 Release"
|
QString mName; // "TDM-GCC 4.7.1 Release"
|
||||||
QStringList mDefines; // list of predefined constants
|
QStringList mDefines; // list of predefined constants
|
||||||
QString mTarget; // 'X86_64' / 'i686'
|
QString mTarget; // 'X86_64' / 'i686'
|
||||||
|
QString mCompilerType;
|
||||||
|
|
||||||
// User settings
|
// User settings
|
||||||
bool mUseCustomCompileParams;
|
bool mUseCustomCompileParams;
|
||||||
|
|
Loading…
Reference in New Issue