GHS: Add support for GHS Multi Generator in Linux

This commit is contained in:
Naren Manimohan 2019-03-21 17:00:04 +01:00 committed by Brad King
parent 2060a1445c
commit 0404efe786
8 changed files with 52 additions and 17 deletions

@ -33,12 +33,12 @@ Cache variables that are used for toolset and target system customization:
* ``GHS_TOOLSET_ROOT``
| Root path for ``toolset`` searches.
| Defaults to ``C:/ghs``.
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
* ``GHS_OS_ROOT``
| Root path for RTOS searches.
| Defaults to ``C:/ghs``.
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
* ``GHS_OS_DIR``

@ -0,0 +1,4 @@
ghs-linux
---------
* The :generator:`Green Hills MULTI` generator is now available on Linux.

@ -52,7 +52,8 @@ to configure the project:
possible.
* The :generator:`Green Hills MULTI` generator sets this to the full
path to ``gbuild.exe`` based upon the toolset being used.
path to ``gbuild.exe(Windows)`` or ``gbuild(Linux)`` based upon
the toolset being used.
Once the generator has initialized a particular value for this
variable, changing the value has undefined behavior.

@ -431,10 +431,18 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
)
# Match the compiler location line printed out.
set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}")
string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
if(CMAKE_HOST_UNIX)
string(REPLACE "/gbuild" "/" ghs_toolpath ${ghs_toolpath})
else()
string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
endif()
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
set(_comp "${CMAKE_MATCH_1}.exe")
if(CMAKE_HOST_UNIX)
set(_comp "${CMAKE_MATCH_1}")
else()
set(_comp "${CMAKE_MATCH_1}.exe")
endif()
if(EXISTS "${_comp}")
file(TO_CMAKE_PATH "${_comp}" _comp)
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)

@ -3,7 +3,11 @@
#Setup Green Hills MULTI specific compilation information
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
if(CMAKE_HOST_UNIX)
set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
else()
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
endif()
mark_as_advanced(GHS_OS_ROOT)
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")

@ -727,14 +727,6 @@ if (WIN32)
cmVisualStudioSlnParser.cxx
cmVisualStudioWCEPlatformParser.h
cmVisualStudioWCEPlatformParser.cxx
cmGlobalGhsMultiGenerator.cxx
cmGlobalGhsMultiGenerator.h
cmLocalGhsMultiGenerator.cxx
cmLocalGhsMultiGenerator.h
cmGhsMultiTargetGenerator.cxx
cmGhsMultiTargetGenerator.h
cmGhsMultiGpj.cxx
cmGhsMultiGpj.h
cmVSSetupHelper.cxx
cmVSSetupHelper.h
)
@ -754,6 +746,22 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
endif()
# GHS support
# Works only for windows and linux
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(SRCS ${SRCS}
cmGlobalGhsMultiGenerator.cxx
cmGlobalGhsMultiGenerator.h
cmLocalGhsMultiGenerator.cxx
cmLocalGhsMultiGenerator.h
cmGhsMultiTargetGenerator.cxx
cmGhsMultiTargetGenerator.h
cmGhsMultiGpj.cxx
cmGhsMultiGpj.h
)
endif()
# Ninja support
set(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx

@ -22,8 +22,13 @@
#include <utility>
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
#ifdef __linux__
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild";
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "/usr/ghs";
#elif defined(_WIN32)
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
#endif
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
: cmGlobalGenerator(cm)

@ -48,7 +48,6 @@
#if defined(_WIN32) && !defined(__CYGWIN__)
# if !defined(CMAKE_BOOT_MINGW)
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalGhsMultiGenerator.h"
# include "cmGlobalJOMMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
# include "cmGlobalVisualStudio10Generator.h"
@ -84,6 +83,10 @@
# include "cmExtraEclipseCDT4Generator.h"
#endif
#if defined(__linux__) || defined(_WIN32)
# include "cmGlobalGhsMultiGenerator.h"
#endif
#if defined(__APPLE__)
# if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGlobalXCodeGenerator.h"
@ -1833,13 +1836,15 @@ void cmake::AddDefaultGenerators()
this->Generators.push_back(cmGlobalBorlandMakefileGenerator::NewFactory());
this->Generators.push_back(cmGlobalNMakeMakefileGenerator::NewFactory());
this->Generators.push_back(cmGlobalJOMMakefileGenerator::NewFactory());
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
# endif
this->Generators.push_back(cmGlobalMSYSMakefileGenerator::NewFactory());
this->Generators.push_back(cmGlobalMinGWMakefileGenerator::NewFactory());
#endif
this->Generators.push_back(cmGlobalUnixMakefileGenerator3::NewFactory());
#if defined(CMAKE_BUILD_WITH_CMAKE)
# if defined(__linux__) || defined(_WIN32)
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
# endif
this->Generators.push_back(cmGlobalNinjaGenerator::NewFactory());
#endif
#if defined(CMAKE_USE_WMAKE)