forked from qt-creator/qt-creator
BareMetal: Use new setup approach for toolchain factories
Change-Id: Ic91ccab925f054d80fbfa8bc018b3e86d207b186 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -16,15 +16,7 @@
|
|||||||
#include "keiltoolchain.h"
|
#include "keiltoolchain.h"
|
||||||
#include "sdcctoolchain.h"
|
#include "sdcctoolchain.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
|
||||||
#include <coreplugin/actionmanager/command.h>
|
|
||||||
#include <coreplugin/coreconstants.h>
|
|
||||||
#include <coreplugin/icontext.h>
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/deployconfiguration.h>
|
#include <projectexplorer/deployconfiguration.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -46,9 +38,6 @@ public:
|
|||||||
class BareMetalPluginPrivate
|
class BareMetalPluginPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IarToolChainFactory iarToolChainFactory;
|
|
||||||
KeilToolChainFactory keilToolChainFactory;
|
|
||||||
SdccToolChainFactory sdccToolChainFactory;
|
|
||||||
BareMetalDeviceFactory deviceFactory;
|
BareMetalDeviceFactory deviceFactory;
|
||||||
BareMetalRunConfigurationFactory runConfigurationFactory;
|
BareMetalRunConfigurationFactory runConfigurationFactory;
|
||||||
BareMetalCustomRunConfigurationFactory customRunConfigurationFactory;
|
BareMetalCustomRunConfigurationFactory customRunConfigurationFactory;
|
||||||
@@ -67,6 +56,10 @@ BareMetalPlugin::~BareMetalPlugin()
|
|||||||
void BareMetalPlugin::initialize()
|
void BareMetalPlugin::initialize()
|
||||||
{
|
{
|
||||||
d = new BareMetalPluginPrivate;
|
d = new BareMetalPluginPrivate;
|
||||||
|
|
||||||
|
setupIarToolChain();
|
||||||
|
setupKeilToolChain();
|
||||||
|
setupSdccToolChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalPlugin::extensionsInitialized()
|
void BareMetalPlugin::extensionsInitialized()
|
||||||
|
|||||||
@@ -405,17 +405,33 @@ bool IarToolChain::operator==(const ToolChain &other) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// IarToolChainFactory
|
// IarToolChainFactory
|
||||||
|
|
||||||
IarToolChainFactory::IarToolChainFactory()
|
class IarToolChainFactory final : public ToolChainFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
IarToolChainFactory()
|
||||||
|
{
|
||||||
setDisplayName(Tr::tr("IAREW"));
|
setDisplayName(Tr::tr("IAREW"));
|
||||||
setSupportedToolChainType(Constants::IAREW_TOOLCHAIN_TYPEID);
|
setSupportedToolChainType(Constants::IAREW_TOOLCHAIN_TYPEID);
|
||||||
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
|
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
|
||||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
||||||
setToolchainConstructor([] { return new IarToolChain; });
|
setToolchainConstructor([] { return new IarToolChain; });
|
||||||
setUserCreatable(true);
|
setUserCreatable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolchains autoDetect(const ToolchainDetector &detector) const final;
|
||||||
|
Toolchains detectForImport(const ToolChainDescription &tcd) const final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Toolchains autoDetectToolchains(const Candidates &candidates,
|
||||||
|
const Toolchains &alreadyKnown) const;
|
||||||
|
Toolchains autoDetectToolchain(const Candidate &candidate, Id languageId) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupIarToolChain()
|
||||||
|
{
|
||||||
|
static IarToolChainFactory theIarToolChainFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
Toolchains IarToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
||||||
|
|||||||
@@ -3,25 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
class IarToolChainFactory final : public ProjectExplorer::ToolChainFactory
|
void setupIarToolChain();
|
||||||
{
|
|
||||||
public:
|
|
||||||
IarToolChainFactory();
|
|
||||||
|
|
||||||
ProjectExplorer::Toolchains autoDetect(
|
|
||||||
const ProjectExplorer::ToolchainDetector &detector) const final;
|
|
||||||
ProjectExplorer::Toolchains detectForImport(
|
|
||||||
const ProjectExplorer::ToolChainDescription &tcd) const final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchains(const Candidates &candidates,
|
|
||||||
const ProjectExplorer::Toolchains &alreadyKnown) const;
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchain(
|
|
||||||
const Candidate &candidate, Utils::Id languageId) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // BareMetal::Internal
|
} // BareMetal::Internal
|
||||||
|
|||||||
@@ -538,14 +538,31 @@ QStringList KeilToolChain::extraCodeModelFlags() const
|
|||||||
|
|
||||||
// KeilToolchainFactory
|
// KeilToolchainFactory
|
||||||
|
|
||||||
KeilToolChainFactory::KeilToolChainFactory()
|
class KeilToolChainFactory final : public ToolChainFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
KeilToolChainFactory()
|
||||||
|
{
|
||||||
setDisplayName(Tr::tr("KEIL"));
|
setDisplayName(Tr::tr("KEIL"));
|
||||||
setSupportedToolChainType(Constants::KEIL_TOOLCHAIN_TYPEID);
|
setSupportedToolChainType(Constants::KEIL_TOOLCHAIN_TYPEID);
|
||||||
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
|
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID,
|
||||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
||||||
setToolchainConstructor([] { return new KeilToolChain; });
|
setToolchainConstructor([] { return new KeilToolChain; });
|
||||||
setUserCreatable(true);
|
setUserCreatable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolchains autoDetect(const ToolchainDetector &detector) const final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Toolchains autoDetectToolchains(const Candidates &candidates,
|
||||||
|
const Toolchains &alreadyKnown) const;
|
||||||
|
Toolchains autoDetectToolchain(
|
||||||
|
const Candidate &candidate, Utils::Id language) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupKeilToolChain()
|
||||||
|
{
|
||||||
|
static KeilToolChainFactory theKeilToolChainFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the 'tools.ini' file to fetch a toolchain version.
|
// Parse the 'tools.ini' file to fetch a toolchain version.
|
||||||
|
|||||||
@@ -3,23 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
class KeilToolChainFactory final : public ProjectExplorer::ToolChainFactory
|
void setupKeilToolChain();
|
||||||
{
|
|
||||||
public:
|
|
||||||
KeilToolChainFactory();
|
|
||||||
|
|
||||||
ProjectExplorer::Toolchains autoDetect(
|
|
||||||
const ProjectExplorer::ToolchainDetector &detector) const final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchains(const Candidates &candidates,
|
|
||||||
const ProjectExplorer::Toolchains &alreadyKnown) const;
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchain(
|
|
||||||
const Candidate &candidate, Utils::Id language) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // BareMetal::Internal
|
} // BareMetal::Internal
|
||||||
|
|||||||
@@ -300,13 +300,29 @@ bool SdccToolChain::operator==(const ToolChain &other) const
|
|||||||
|
|
||||||
// SdccToolChainFactory
|
// SdccToolChainFactory
|
||||||
|
|
||||||
SdccToolChainFactory::SdccToolChainFactory()
|
class SdccToolChainFactory final : public ToolChainFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
SdccToolChainFactory()
|
||||||
|
{
|
||||||
setDisplayName(Tr::tr("SDCC"));
|
setDisplayName(Tr::tr("SDCC"));
|
||||||
setSupportedToolChainType(Constants::SDCC_TOOLCHAIN_TYPEID);
|
setSupportedToolChainType(Constants::SDCC_TOOLCHAIN_TYPEID);
|
||||||
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID});
|
setSupportedLanguages({ProjectExplorer::Constants::C_LANGUAGE_ID});
|
||||||
setToolchainConstructor([] { return new SdccToolChain; });
|
setToolchainConstructor([] { return new SdccToolChain; });
|
||||||
setUserCreatable(true);
|
setUserCreatable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolchains autoDetect(const ToolchainDetector &detector) const final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Toolchains autoDetectToolchains(const Candidates &candidates,
|
||||||
|
const Toolchains &alreadyKnown) const;
|
||||||
|
Toolchains autoDetectToolchain(const Candidate &candidate, Id language) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupSdccToolChain()
|
||||||
|
{
|
||||||
|
static SdccToolChainFactory theSdccToolChainFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolchains SdccToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
Toolchains SdccToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
||||||
|
|||||||
@@ -3,23 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
|
|
||||||
namespace BareMetal::Internal {
|
namespace BareMetal::Internal {
|
||||||
|
|
||||||
class SdccToolChainFactory final : public ProjectExplorer::ToolChainFactory
|
void setupSdccToolChain();
|
||||||
{
|
|
||||||
public:
|
|
||||||
SdccToolChainFactory();
|
|
||||||
|
|
||||||
ProjectExplorer::Toolchains autoDetect(
|
|
||||||
const ProjectExplorer::ToolchainDetector &detector) const final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchains(const Candidates &candidates,
|
|
||||||
const ProjectExplorer::Toolchains &alreadyKnown) const;
|
|
||||||
ProjectExplorer::Toolchains autoDetectToolchain(
|
|
||||||
const Candidate &candidate, Utils::Id language) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // BareMetal::Internal
|
} // BareMetal::Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user