diff options
author | Fred Baksik <frodak17@gmail.com> | 2018-07-07 11:27:21 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2018-07-11 12:44:49 (GMT) |
commit | bb77dc0cee95b2606ab6715aa9babc89c09d176f (patch) | |
tree | 23444417c8f30f91a864efa890d2c534b6aae21a | |
parent | f80692cf600675bae4d12810c8119a62e76aa701 (diff) | |
download | CMake-bb77dc0cee95b2606ab6715aa9babc89c09d176f.zip CMake-bb77dc0cee95b2606ab6715aa9babc89c09d176f.tar.gz CMake-bb77dc0cee95b2606ab6715aa9babc89c09d176f.tar.bz2 |
GHS: Set primary target using arch/platform values (or user specified value)
-rw-r--r-- | Help/generator/Green Hills MULTI.rst | 5 | ||||
-rw-r--r-- | Modules/Platform/GHS-MULTI-Initialize.cmake | 1 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 22 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 2 |
4 files changed, 26 insertions, 4 deletions
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index 7da93dd..7c2e643 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -19,6 +19,11 @@ Default 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``. + * ``GHS_TOOLSET_ROOT`` Default to ``C:/ghs``. Root path for ``toolset``. diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index bf61d7b..0b7422c 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -33,7 +33,6 @@ if (NOT GHS_INT_DIRECTORY) endif () set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory") -set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation") set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index ddf8147..17fac41 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -335,8 +335,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros() void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { - *this->GetBuildFileStream() - << "primaryTarget=arm_integrity.tgt" << std::endl; + /* set primary target */ + std::string tgt; + const char* t = + this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); + if (t) { + tgt = t; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); + } else { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + const char* p = + this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM"); + tgt = (a ? a : ""); + tgt += "_"; + tgt += (p ? p : ""); + tgt += ".tgt"; + } + + *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl; + char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (NULL != customization && strlen(customization) > 0) { diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b389a13..bd81a84 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2256,7 +2256,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-generator "Green Hills MULTI" --build-project ReturnNum --build-config $<CONFIGURATION> - --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt" + --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt -DGHS_BSP_NAME="simarm" ) endif () |