forked from qt-creator/qt-creator
BareMetal: Simplify a few tests for executable compiler
Change-Id: I9d85623b09a949be88075b031fa973c218e93e80 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -34,14 +34,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
// Helpers:
|
|
||||||
|
|
||||||
static bool compilerExists(const FilePath &compilerPath)
|
|
||||||
{
|
|
||||||
const QFileInfo fi = compilerPath.toFileInfo();
|
|
||||||
return fi.exists() && fi.isExecutable() && fi.isFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString cppLanguageOption(const FilePath &compiler)
|
static QString cppLanguageOption(const FilePath &compiler)
|
||||||
{
|
{
|
||||||
const QString baseName = compiler.baseName();
|
const QString baseName = compiler.baseName();
|
||||||
@@ -485,7 +477,7 @@ Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) co
|
|||||||
// Build full compiler path.
|
// Build full compiler path.
|
||||||
compilerPath += entry.subExePath;
|
compilerPath += entry.subExePath;
|
||||||
const FilePath fn = FilePath::fromUserInput(compilerPath);
|
const FilePath fn = FilePath::fromUserInput(compilerPath);
|
||||||
if (compilerExists(fn)) {
|
if (fn.isExecutableFile()) {
|
||||||
// Note: threeLevelKey is a guessed toolchain version.
|
// Note: threeLevelKey is a guessed toolchain version.
|
||||||
candidates.push_back({fn, threeLevelKey});
|
candidates.push_back({fn, threeLevelKey});
|
||||||
}
|
}
|
||||||
@@ -634,14 +626,14 @@ void IarToolChainConfigWidget::setFromToolchain()
|
|||||||
m_compilerCommand->setFilePath(tc->compilerCommand());
|
m_compilerCommand->setFilePath(tc->compilerCommand());
|
||||||
m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags()));
|
m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags()));
|
||||||
m_abiWidget->setAbis({}, tc->targetAbi());
|
m_abiWidget->setAbis({}, tc->targetAbi());
|
||||||
const bool haveCompiler = compilerExists(m_compilerCommand->filePath());
|
const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile();
|
||||||
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IarToolChainConfigWidget::handleCompilerCommandChange()
|
void IarToolChainConfigWidget::handleCompilerCommandChange()
|
||||||
{
|
{
|
||||||
const FilePath compilerPath = m_compilerCommand->filePath();
|
const FilePath compilerPath = m_compilerCommand->filePath();
|
||||||
const bool haveCompiler = compilerExists(compilerPath);
|
const bool haveCompiler = compilerPath.isExecutableFile();
|
||||||
if (haveCompiler) {
|
if (haveCompiler) {
|
||||||
const auto env = Environment::systemEnvironment();
|
const auto env = Environment::systemEnvironment();
|
||||||
const QStringList extraArgs = splitString(m_platformCodeGenFlagsLineEdit->text());
|
const QStringList extraArgs = splitString(m_platformCodeGenFlagsLineEdit->text());
|
||||||
|
@@ -36,14 +36,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
// Helpers:
|
|
||||||
|
|
||||||
static bool compilerExists(const FilePath &compilerPath)
|
|
||||||
{
|
|
||||||
const QFileInfo fi = compilerPath.toFileInfo();
|
|
||||||
return fi.exists() && fi.isExecutable() && fi.isFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Abi::Architecture guessArchitecture(const FilePath &compilerPath)
|
static Abi::Architecture guessArchitecture(const FilePath &compilerPath)
|
||||||
{
|
{
|
||||||
const QFileInfo fi = compilerPath.toFileInfo();
|
const QFileInfo fi = compilerPath.toFileInfo();
|
||||||
@@ -785,14 +777,14 @@ void KeilToolChainConfigWidget::setFromToolChain()
|
|||||||
m_compilerCommand->setFilePath(tc->compilerCommand());
|
m_compilerCommand->setFilePath(tc->compilerCommand());
|
||||||
m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags()));
|
m_platformCodeGenFlagsLineEdit->setText(ProcessArgs::joinArgs(tc->extraCodeModelFlags()));
|
||||||
m_abiWidget->setAbis({}, tc->targetAbi());
|
m_abiWidget->setAbis({}, tc->targetAbi());
|
||||||
const bool haveCompiler = compilerExists(m_compilerCommand->filePath());
|
const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile();
|
||||||
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeilToolChainConfigWidget::handleCompilerCommandChange()
|
void KeilToolChainConfigWidget::handleCompilerCommandChange()
|
||||||
{
|
{
|
||||||
const FilePath compilerPath = m_compilerCommand->filePath();
|
const FilePath compilerPath = m_compilerCommand->filePath();
|
||||||
const bool haveCompiler = compilerExists(compilerPath);
|
const bool haveCompiler = compilerPath.isExecutableFile();
|
||||||
if (haveCompiler) {
|
if (haveCompiler) {
|
||||||
const auto env = Environment::systemEnvironment();
|
const auto env = Environment::systemEnvironment();
|
||||||
const QStringList prevExtraArgs = splitString(m_platformCodeGenFlagsLineEdit->text());
|
const QStringList prevExtraArgs = splitString(m_platformCodeGenFlagsLineEdit->text());
|
||||||
|
@@ -35,14 +35,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
// Helpers:
|
|
||||||
|
|
||||||
static bool compilerExists(const FilePath &compilerPath)
|
|
||||||
{
|
|
||||||
const QFileInfo fi = compilerPath.toFileInfo();
|
|
||||||
return fi.exists() && fi.isExecutable() && fi.isFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString compilerTargetFlag(const Abi &abi)
|
static QString compilerTargetFlag(const Abi &abi)
|
||||||
{
|
{
|
||||||
switch (abi.architecture()) {
|
switch (abi.architecture()) {
|
||||||
@@ -346,7 +338,7 @@ Toolchains SdccToolChainFactory::autoDetect(const ToolchainDetector &detector) c
|
|||||||
compilerPath += "/bin/sdcc.exe";
|
compilerPath += "/bin/sdcc.exe";
|
||||||
const FilePath fn = FilePath::fromString(
|
const FilePath fn = FilePath::fromString(
|
||||||
QFileInfo(compilerPath).absoluteFilePath());
|
QFileInfo(compilerPath).absoluteFilePath());
|
||||||
if (!compilerExists(fn))
|
if (!fn.isExecutableFile())
|
||||||
return Candidate{};
|
return Candidate{};
|
||||||
// Build compiler version.
|
// Build compiler version.
|
||||||
const QString version = QString("%1.%2.%3").arg(
|
const QString version = QString("%1.%2.%3").arg(
|
||||||
@@ -511,14 +503,14 @@ void SdccToolChainConfigWidget::setFromToolchain()
|
|||||||
const auto tc = static_cast<SdccToolChain *>(toolChain());
|
const auto tc = static_cast<SdccToolChain *>(toolChain());
|
||||||
m_compilerCommand->setFilePath(tc->compilerCommand());
|
m_compilerCommand->setFilePath(tc->compilerCommand());
|
||||||
m_abiWidget->setAbis({}, tc->targetAbi());
|
m_abiWidget->setAbis({}, tc->targetAbi());
|
||||||
const bool haveCompiler = compilerExists(m_compilerCommand->filePath());
|
const bool haveCompiler = m_compilerCommand->filePath().isExecutableFile();
|
||||||
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
m_abiWidget->setEnabled(haveCompiler && !tc->isAutoDetected());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdccToolChainConfigWidget::handleCompilerCommandChange()
|
void SdccToolChainConfigWidget::handleCompilerCommandChange()
|
||||||
{
|
{
|
||||||
const FilePath compilerPath = m_compilerCommand->filePath();
|
const FilePath compilerPath = m_compilerCommand->filePath();
|
||||||
const bool haveCompiler = compilerExists(compilerPath);
|
const bool haveCompiler = compilerPath.isExecutableFile();
|
||||||
if (haveCompiler) {
|
if (haveCompiler) {
|
||||||
const auto env = Environment::systemEnvironment();
|
const auto env = Environment::systemEnvironment();
|
||||||
m_macros = dumpPredefinedMacros(compilerPath, env, {});
|
m_macros = dumpPredefinedMacros(compilerPath, env, {});
|
||||||
|
Reference in New Issue
Block a user