[cmake-developers] FW: FW: Initial Attempt at Green Hill MULTI IDE Generator Support

Brad King brad.king at kitware.com
Thu Mar 12 16:18:15 EDT 2015


On 03/11/2015 01:39 PM, Geoffrey Viola wrote:
> Attached is a patch with the recommended changes

Thanks!  The basic toolchain initialization is pretty close.
Here are more comments.

In Modules/Platform/GHS-MULTI-Initialize.cmake:

> +#Setup consistent compiler executables
> +find_program(CMAKE_GENERATOR_CC ccarm PATHS ${GHS_COMP_ROOT})
> +find_program(CMAKE_GENERATOR_CXX cxarm PATHS ${GHS_COMP_ROOT})

This should not be needed at all.  The CMAKE_GENERATOR_* variables
are just hints to the compiler detection logic.  Since this generator
hard-codes the compiler setting in C++ the logic that uses these
variables is never executed anyway.

> +string(REGEX MATCH "(comp_)([0-9]+)" CMAKE_SYSTEM_VERSION "${CMAKE_MAKE_PROGRAM}")
> +string(REPLACE "comp_" "" CMAKE_SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}")

EnableLanguage should be able to set CMAKE_SYSTEM_VERSION too
now that it has code to find the comp root.

> +mark_as_advanced(CMAKE_MAKE_PROGRAM)

This should not be needed.

> +include(Platform/WindowsPaths)

This should move to Modules/Platform/GHS-MULTI.cmake

In EnableLanguage:

> +  mf->AddDefinition("CMAKE_MAKE_PROGRAM",
> +                    std::string(ghsCompRootStart + "gbuild.exe").c_str());

The VS and Xcode generators no longer put this in the cache.
Take a look at how the Xcode generator now does this with

 cmGlobalXCodeGenerator::FindMakeProgram
 cmGlobalXCodeGenerator::GetXcodeBuildCommand
 cmGlobalXCodeGenerator::FindXcodeBuildCommand

and its call to SelectMakeProgram in GenerateBuildCommand:

  this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())

Together this all allows the generator to compute the proper build
tool without exposing any settings to the user.

> +  mf->AddDefinition("CMAKE_C_COMPILER_ID", "GhsMultiArmC");
[snip]
> +  mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GhsMultiArmCXX");

Instead of "GhsMultiArm*" these should be just "GHS", to be
consistent with "Modules/Compiler/GHS-DetermineCompiler.cmake".

-----------------------------------------------------------------

Please also look at modifying the Help/ directory to document
the new generator.  You'll need at least to create/update:

 Help/manual/cmake-generators.7.rst
 Help/generator/Green Hills MULTI.rst
 Help/variable/CMAKE_MAKE_PROGRAM.rst

where the change to the last one depends on the above updates.

Thanks,
-Brad



More information about the cmake-developers mailing list