Commit 65a3abf9 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'GHS_updates'

21ab58d3 GHS: Update test suite
72e0c115 GHS: Add Compiler ID detection
436cc5e9 GHS: try_compile() now uses GHS platform variables
4a1ec0de GHS: Fix toolset selection
1a66acde GHS: Append ".gpj" to target name when generating build command
0c9e47d7 GHS: Integrity Application updates
80443184 GHS: Add support for some of the source file properties
73092b22

 GHS: Add support for object libraries
...
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2231
parents 2e7d4029 21ab58d3
......@@ -168,3 +168,6 @@ then the language standard variables are honored:
Their values are used to set the corresponding target properties in
the generated project (unless overridden by an explicit option).
For the :generator:`Green Hills MULTI` generator the GHS toolset and target
system customization cache variables are also propagated into the test project.
......@@ -3,49 +3,63 @@ Green Hills MULTI
Generates Green Hills MULTI project files (experimental, work-in-progress).
The buildsystem has predetermined build-configuration settings that can be controlled
via the :variable:`CMAKE_BUILD_TYPE` variable.
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.
The ``-T <toolset>`` can be supplied for setting the toolset to be used.
All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``.
If the toolset is not specified then the latest toolset will be used.
The ``-T <toolset>`` option can be used to set the directory location of the toolset.
Both absolute and relative paths are valid. Relative paths use ``GHS_TOOLSET_ROOT``
as the root. If the toolset is not specified then the latest toolset found in
``GHS_TOOLSET_ROOT`` will be used.
Cache variables that are used for toolset and target system customization:
* ``GHS_TARGET_PLATFORM``
Default to ``integrity``.
Usual values are ``integrity``, ``threadx``, ``uvelosity``,
``velosity``, ``vxworks``, ``standalone``.
| Defaults to ``integrity``.
| Usual values are ``integrity``, ``threadx``, ``uvelosity``, ``velosity``,
``vxworks``, ``standalone``.
* ``GHS_PRIMARY_TARGET``
Sets ``primaryTarget`` field in project file.
Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``.
| Sets ``primaryTarget`` entry in project file.
| Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``.
* ``GHS_TOOLSET_ROOT``
Default to ``C:/ghs``. Root path for ``toolset``.
| Root path for ``toolset`` searches.
| Defaults to ``C:/ghs``.
* ``GHS_OS_ROOT``
Default to ``C:/ghs``. Root path for RTOS searches.
| Root path for RTOS searches.
| Defaults to ``C:/ghs``.
* ``GHS_OS_DIR``
Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
a specific RTOS is to be used.
| Sets ``-os_dir`` entry in project file.
| Defaults to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
a specific RTOS is to be used.
* ``GHS_BSP_NAME``
Defaults to ``sim<arch>`` if not set by user.
| Sets ``-bsp`` entry in project file.
| Defaults to ``sim<arch>`` for ``integrity`` platforms.
Customizations are available through the following cache variables:
* ``GHS_CUSTOMIZATION``
* ``GHS_GPJ_MACROS``
The following properties are available:
* :prop_tgt:`GHS_INTEGRITY_APP`
.. note::
This generator is deemed experimental as of CMake |release|
and is still a work in progress. Future versions of CMake
......
......@@ -194,6 +194,7 @@ Properties on Targets
/prop_tgt/FRAMEWORK
/prop_tgt/FRAMEWORK_VERSION
/prop_tgt/GENERATOR_FILE_NAME
/prop_tgt/GHS_INTEGRITY_APP
/prop_tgt/GNUtoMS
/prop_tgt/HAS_CXX
/prop_tgt/IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
......
......@@ -482,11 +482,6 @@ Variables for Languages
/variable/CMAKE_LANG_FLAGS_RELEASE_INIT
/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO
/variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO_INIT
/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_CONFIG
/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_DEBUG
/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_MINSIZEREL
/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELEASE
/variable/CMAKE_LANG_GHS_KERNEL_FLAGS_RELWITHDEBINFO
/variable/CMAKE_LANG_IGNORE_EXTENSIONS
/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES
/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES
......
GHS_INTEGRITY_APP
-----------------
``ON`` / ``OFF`` boolean to determine if an executable target should
be treated as an `Integrity Application`.
If no value is set and if a `.int` file is added as a source file to the
executable target it will be treated as an `Integrity Application`.
Supported on :generator:`Green Hills MULTI`.
......@@ -19,6 +19,7 @@ include:
Embarcadero, Borland = Embarcadero (embarcadero.com)
G95 = G95 Fortran (g95.org)
GNU = GNU Compiler Collection (gcc.gnu.org)
GHS = Green Hills Software (www.ghs.com)
HP = Hewlett-Packard Compiler (hp.com)
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
......
CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG>
--------------------------------------
GHS kernel flags for language ``<LANG>`` when building for the ``<CONFIG>``
configuration.
CMAKE_<LANG>_GHS_KERNEL_FLAGS_DEBUG
-----------------------------------
This variable is the ``Debug`` variant of the
:variable:`CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG>` variable.
CMAKE_<LANG>_GHS_KERNEL_FLAGS_MINSIZEREL
----------------------------------------
This variable is the ``MinSizeRel`` variant of the
:variable:`CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG>` variable.
CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELEASE
-------------------------------------
This variable is the ``Release`` variant of the
:variable:`CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG>` variable.
CMAKE_<LANG>_GHS_KERNEL_FLAGS_RELWITHDEBINFO
--------------------------------------------
This variable is the ``RelWithDebInfo`` variant of the
:variable:`CMAKE_<LANG>_GHS_KERNEL_FLAGS_<CONFIG>` variable.
GHS-MULTI
---------
True when using Green Hills MULTI
``True`` when using :generator:`Green Hills MULTI` generator.
......@@ -63,6 +63,7 @@ function(compiler_id_detection outvar lang)
Cray
TI
Fujitsu
GHS
)
if (lang STREQUAL C)
list(APPEND ordered_compilers
......
......@@ -31,6 +31,7 @@ if(NOT CMAKE_C_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
_cmake_find_compiler_path(C)
......
......@@ -30,6 +30,7 @@ if(NOT CMAKE_CXX_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
_cmake_find_compiler_path(CXX)
......
......@@ -7,6 +7,7 @@
# code.
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
include(CMakeTestCompilerCommon)
function(CMAKE_DETERMINE_COMPILER_ABI lang src)
if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED)
......@@ -23,6 +24,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# from which we might detect implicit link libraries.
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
endif()
__TestCompiler_setTryCompileTargetType()
try_compile(CMAKE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
CMAKE_FLAGS ${CMAKE_FLAGS}
......
......@@ -52,6 +52,13 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endforeach()
endif()
# If the compiler is still unknown, fallback to GHS
if(NOT CMAKE_${lang}_COMPILER_ID AND "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(CMAKE_${lang}_COMPILER_ID GHS)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"The ${lang} compiler identification is falling back to GHS.\n\n")
endif()
# CUDA < 7.5 is missing version macros
if(lang STREQUAL "CUDA"
AND CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA"
......@@ -391,6 +398,40 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
separate_arguments(CMAKE_${lang}_XCODE_ARCHS)
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE)
endif()
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
set(id_src "${src}")
if (GHS_PRIMARY_TARGET)
set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
else()
set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
endif()
if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
endif()
set(command "${CMAKE_MAKE_PROGRAM}" "-commands" "-top" "GHS_default.gpj")
configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_default.gpj.in
${id_dir}/GHS_default.gpj @ONLY)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_lib.gpj.in
${id_dir}/GHS_lib.gpj @ONLY)
execute_process(COMMAND ${command}
WORKING_DIRECTORY ${id_dir}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
# 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_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
set(_comp "${CMAKE_MATCH_1}.exe")
if(EXISTS "${_comp}")
file(TO_CMAKE_PATH "${_comp}" _comp)
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
endif()
endif()
else()
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"
......@@ -550,7 +591,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
endif()
if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
......@@ -602,26 +643,28 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
if(WIN32)
# The offset to the PE signature is stored at 0x3c.
file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX)
string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
math(EXPR peoffset "${peoffsetexpression}")
file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
if(peheader STREQUAL "50450000a201")
set(ARCHITECTURE_ID "SH3")
elseif(peheader STREQUAL "50450000a301")
set(ARCHITECTURE_ID "SH3DSP")
elseif(peheader STREQUAL "50450000a601")
set(ARCHITECTURE_ID "SH4")
elseif(peheader STREQUAL "50450000a801")
set(ARCHITECTURE_ID "SH5")
if(NOT peoffsethex STREQUAL "")
string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
math(EXPR peoffset "${peoffsetexpression}")
file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
if(peheader STREQUAL "50450000a201")
set(ARCHITECTURE_ID "SH3")
elseif(peheader STREQUAL "50450000a301")
set(ARCHITECTURE_ID "SH3DSP")
elseif(peheader STREQUAL "50450000a601")
set(ARCHITECTURE_ID "SH4")
elseif(peheader STREQUAL "50450000a801")
set(ARCHITECTURE_ID "SH5")
endif()
endif()
endif()
......
......@@ -91,6 +91,14 @@
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
#else /* unknown platform */
# define PLATFORM_ID
......@@ -151,6 +159,26 @@
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
......
......@@ -22,6 +22,7 @@ unset(CMAKE_C_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_C_COMPILER_WORKS)
PrintTestCompilerStatus("C" "")
__TestCompiler_setTryCompileTargetType()
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
"#ifdef __cplusplus\n"
"# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
......@@ -41,6 +42,7 @@ if(NOT CMAKE_C_COMPILER_WORKS)
set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS})
unset(CMAKE_C_COMPILER_WORKS CACHE)
set(C_TEST_WAS_RUN 1)
__TestCompiler_restoreTryCompileTargetType()
endif()
if(NOT CMAKE_C_COMPILER_WORKS)
......
......@@ -22,6 +22,7 @@ unset(CMAKE_CXX_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_CXX_COMPILER_WORKS)
PrintTestCompilerStatus("CXX" "")
__TestCompiler_setTryCompileTargetType()
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
"#ifndef __cplusplus\n"
"# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
......@@ -34,6 +35,7 @@ if(NOT CMAKE_CXX_COMPILER_WORKS)
set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS})
unset(CMAKE_CXX_COMPILER_WORKS CACHE)
set(CXX_TEST_WAS_RUN 1)
__TestCompiler_restoreTryCompileTargetType()
endif()
if(NOT CMAKE_CXX_COMPILER_WORKS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment