GHS: Support ARM, PPC, 86 architectures

-- Update -A option to choose target architecture.
-- Update commentary about which variables are used to control toolset and target settings
-- Remove setting CMAKE_SYSTEM_PROCESSOR because the value is overwritten to be "" by subsequent CMAKE processing
This commit is contained in:
Fred Baksik 2018-07-07 07:27:21 -04:00
parent 4330f10186
commit 5d40d2b44f
5 changed files with 32 additions and 5 deletions

View File

@ -3,6 +3,12 @@ Green Hills MULTI
Generates Green Hills MULTI project files (experimental, work-in-progress).
Customizations that are used to pick toolset and target system:
The ``-A <arch>`` can be supplied for setting the target architecture.
``<arch>`` usually is one of "arm", "ppc", "86", etcetera. If the target architecture
is not specified then the default architecture of "arm" will be used.
Customizations are available through the following cache variables:
* ``GHS_BSP_NAME``

View File

@ -19,6 +19,8 @@ Platform specification is supported only on specific generators:
* For :ref:`Visual Studio Generators` with VS 2005 and above this
specifies the target architecture.
* For :generator:`Green Hills MULTI` this specifies the target architecture.
See native build system documentation for allowed platform names.
Visual Studio Platform Selection

View File

@ -6,5 +6,3 @@ The name of the CPU CMake is building for.
This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
you build for the host system instead of the target system when
cross compiling.
* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default.

View File

@ -41,11 +41,29 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry)
"Generates Green Hills MULTI files (experimental, work-in-progress).";
}
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
cmMakefile* mf)
{
if (p == "") {
cmSystemTools::Message(
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
std::string arch = "arm";
/* store the platform name for later use
* -- already done if -A<arch> was specified
*/
mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
"Name of generator platform.",
cmStateEnums::INTERNAL);
}
return true;
}
void cmGlobalGhsMultiGenerator::EnableLanguage(
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
{
mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM");
const std::string ghsCompRoot(GetCompRoot());
mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str());

View File

@ -40,13 +40,16 @@ public:
* Utilized by the generator factory to determine if this generator
* supports toolsets.
*/
static bool SupportsToolset() { return false; }
static bool SupportsToolset() { return true; }
/**
* Utilized by the generator factory to determine if this generator
* supports platforms.
*/
static bool SupportsPlatform() { return false; }
static bool SupportsPlatform() { return true; }
// Toolset / Platform Support
virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
/**
* Try to determine system information such as shared library