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

Brad King brad.king at kitware.com
Mon Mar 2 09:47:54 EST 2015


On 02/27/2015 11:29 AM, Geoffrey Viola wrote:
>> set(ENV{PATH} "c:\\Windows\\system32;c:\\Windows")
>> We should test with at least the basic Windows PATH set.
> I made the change just now. I'll rerun the tests.

I haven't seen "glv.asi" submit in a few days.  Is it running nightly?

> Let me know if there is anything more I can do.

I've looked more through the patch sent here:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/11260/focus=12469

> +void
> +cmGlobalGhsMultiGenerator::EnableLanguage(std::vector<std::string> const &l,
> +                                          cmMakefile *mf, bool optional) {
> +  mf->AddDefinition("CMAKE_C_COMPILER", "${CMAKE_GENERATOR_CC}");
> +  mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE");
> +  mf->AddDefinition("CMAKE_C_COMPILER_ID", "GhsMultiArmC");
> +  mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE");
> +
> +  mf->AddDefinition("CMAKE_CXX_COMPILER", "${CMAKE_GENERATOR_CXX}");
> +  mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE");
> +  mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GhsMultiArmCXX");
> +  mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE");
> +
> +  mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
> +  this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
> +}

This looks based on my suggestion from an earlier review:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/11260/focus=11538

so I think this is the right place for such code.  However, the
hunk above needs some work.  First, the changes to
Modules/CMakeCompilerIdDetection.cmake indicate that the compiler
id is "GHS", so the CMAKE_<LANG>_COMPILER_ID should be set to that
in the code above.

The compiler path values are set to literal "${...}"
strings but that will not be interpreted.  Alternatives:

* Set CMAKE_GENERATOR_CC and CMAKE_GENERATOR_CXX to ccarm
  and cxarm in the above code and let the normal compiler
  search logic in CMakeDetermine*Compiler.cmake actually
  find the compiler instead of using find_program in
  CMakeGreenHillsFindMake.

* Have EnableLanguage compute the exact path to the compiler
  tools itself, possibly using GHS_COMP_ROOT.

Most of the code in CMakeGreenHillsFindMake actually belongs
in "Modules/Platform/GHS-MULTI.cmake".  The EnableLanguage
method should set CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR.
It could even have C++-implemented logic to find GHS_COMP_ROOT
(are there registry values for it?).  Then CMakeGreenHillsFindMake
should have the minimum code needed to find the make tool given
GHS_COMP_ROOT.  Then I think everything else can go in

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

The -Initialize module will be loaded pretty early and is the
place to find platform-specific SDKs and such.  This is likely
the place for all those GHS_* cache options.

Thanks,
-Brad



More information about the cmake-developers mailing list