forked from qt-creator/qt-creator
BareMetal: Fix detection of C++ language option for IAR
... which is used at dumping of predefined macros and a header paths. Reason is that for the different architectures the IAR use different C++ language options: * for ARM: --c++ * for AVR or 8051: --ec++ Change-Id: I00ceadaf87348ee2250b9455ca04eed4bcb703a7 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -66,6 +66,16 @@ static bool compilerExists(const FilePath &compilerPath)
|
|||||||
return fi.exists() && fi.isExecutable() && fi.isFile();
|
return fi.exists() && fi.isExecutable() && fi.isFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString cppLanguageOption(const FilePath &compiler)
|
||||||
|
{
|
||||||
|
const QString baseName = compiler.toFileInfo().baseName();
|
||||||
|
if (baseName == "iccarm")
|
||||||
|
return "--c++";
|
||||||
|
if (baseName == "icc8051" || baseName == "iccavr")
|
||||||
|
return "--ec++";
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id languageId,
|
static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id languageId,
|
||||||
const QStringList &env)
|
const QStringList &env)
|
||||||
{
|
{
|
||||||
@@ -88,7 +98,7 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.push_back(fakeIn.fileName());
|
arguments.push_back(fakeIn.fileName());
|
||||||
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
||||||
arguments.push_back("--c++");
|
arguments.push_back(cppLanguageOption(compiler));
|
||||||
arguments.push_back("--predef_macros");
|
arguments.push_back("--predef_macros");
|
||||||
arguments.push_back(outpath);
|
arguments.push_back(outpath);
|
||||||
|
|
||||||
@@ -134,7 +144,7 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments.push_back(fakeIn.fileName());
|
arguments.push_back(fakeIn.fileName());
|
||||||
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
||||||
arguments.push_back("--c++");
|
arguments.push_back(cppLanguageOption(compiler));
|
||||||
arguments.push_back("--preinclude");
|
arguments.push_back("--preinclude");
|
||||||
arguments.push_back(".");
|
arguments.push_back(".");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user