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