diff options
author | Fred Baksik <fdk17@ftml.net> | 2021-11-15 18:15:11 (GMT) |
---|---|---|
committer | Fred Baksik <fdk17@ftml.net> | 2021-11-15 18:15:11 (GMT) |
commit | a55b5c4e188126cf73c3e0a25d39f10ed8fcbece (patch) | |
tree | ad35bcbd9f5d4655de4ec43c55dbcac620af42a0 | |
parent | 0427f225395d3fbc5df273596cb7b9d150a369b7 (diff) | |
download | CMake-a55b5c4e188126cf73c3e0a25d39f10ed8fcbece.zip CMake-a55b5c4e188126cf73c3e0a25d39f10ed8fcbece.tar.gz CMake-a55b5c4e188126cf73c3e0a25d39f10ed8fcbece.tar.bz2 |
GHS: Update BSP selection logic
Selection of a BSP only needs to be performed if not set by user.
Remove all the logic for printing error and status messages about BSP
selection. These messages also breaks CMake tests.
NOTE: If BSP selection fails then the compiler checks will result in
a build error. The build error will report that the BSP does not exist.
-rw-r--r-- | Help/generator/Green Hills MULTI.rst | 2 | ||||
-rw-r--r-- | Modules/Platform/GHS-MULTI-Determine.cmake | 18 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 18 |
3 files changed, 20 insertions, 18 deletions
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index bae4980..472f725 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -121,6 +121,8 @@ the ``GHS_BSP_NAME`` variable. * ``cmake -G "Green Hills MULTI" -A 86`` for ``sim86`` on ``86_integrity.tgt``. * ``cmake -G "Green Hills MULTI" -A ppc -D GHS_BSP_NAME=sim800`` for ``sim800`` on ``ppc_integrity.tgt``. + * ``cmake -G "Green Hills MULTI" -D GHS_PRIMARY_TARGET=ppc_integrity.tgt -D GHS_BSP_NAME=fsl-t1040`` + for ``fsl-t1040`` on ``ppc_integrity.tgt``. Target Properties ^^^^^^^^^^^^^^^^^ diff --git a/Modules/Platform/GHS-MULTI-Determine.cmake b/Modules/Platform/GHS-MULTI-Determine.cmake index ba1bebb..501acca 100644 --- a/Modules/Platform/GHS-MULTI-Determine.cmake +++ b/Modules/Platform/GHS-MULTI-Determine.cmake @@ -83,4 +83,20 @@ mark_as_advanced(GHS_OS_DIR) set(GHS_OS_DIR_OPTION "-os_dir " CACHE STRING "GHS compiler OS option") mark_as_advanced(GHS_OS_DIR_OPTION) -set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name") +# Select GHS_BSP_NAME if not set by user and is known to be required +if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity") + set(_ghs_bsp_name "GHS_BSP_NAME-NOT-SPECIFIED") +else() + set(_ghs_bsp_name "IGNORE") +endif() + +if(_ghs_bsp_name AND NOT DEFINED GHS_BSP_NAME) + # First try taking architecture from `-A` option + if(CMAKE_GENERATOR_PLATFORM) + set(_ghs_bsp_name "sim${CMAKE_GENERATOR_PLATFORM}") + else() + set(_ghs_bsp_name "simarm") + endif() +endif() + +set(GHS_BSP_NAME "${_ghs_bsp_name}" CACHE STRING "BSP name") diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index e319242..a237689 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -132,23 +132,6 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, "Generator selected GHS MULTI primaryTarget.", cmStateEnums::STRING, true); } - - // Determine GHS_BSP_NAME - std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME"); - - if (cmIsOff(bspName) && platform.find("integrity") != std::string::npos) { - std::string arch = "arm"; /* FIXME - extract from GHS_PRIMARY_TARGET */ - bspName = "sim" + arch; - /* write back the calculate name for next time */ - mf->AddCacheDefinition("GHS_BSP_NAME", bspName, - "Name of GHS target platform.", - cmStateEnums::STRING, true); - std::string m = cmStrCat( - "Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \"", - bspName, '"'); - cmSystemTools::Message(m); - } - return true; } @@ -308,6 +291,7 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout, fout << "# Top Level Project File\n"; // Specify BSP option if supplied by user + // -- not all platforms require this entry in the project file cmValue bspName = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); if (!cmIsOff(bspName)) { |