From 281c601024e7a82f85ef02ce00a0fc5686c5412d Mon Sep 17 00:00:00 2001 From: Fred Baksik Date: Sat, 7 Jul 2018 07:27:22 -0400 Subject: GHS: Update default BSP name -- Use default value of sim if not user defined -- Also no reason to trim quotes or changes slashes; it is just a name not a path --- Help/generator/Green Hills MULTI.rst | 5 ++++- Modules/Platform/GHS-MULTI-Initialize.cmake | 3 ++- Source/cmGlobalGhsMultiGenerator.cxx | 23 +++++++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst index f148b4f..1b4960d 100644 --- a/Help/generator/Green Hills MULTI.rst +++ b/Help/generator/Green Hills MULTI.rst @@ -37,9 +37,12 @@ Default to ``C:/ghs``. Root path for RTOS searches. Default 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`` if not set by user. + Customizations are available through the following cache variables: -* ``GHS_BSP_NAME`` * ``GHS_CUSTOMIZATION`` * ``GHS_GPJ_MACROS`` diff --git a/Modules/Platform/GHS-MULTI-Initialize.cmake b/Modules/Platform/GHS-MULTI-Initialize.cmake index 62a7e9f..9b384df 100644 --- a/Modules/Platform/GHS-MULTI-Initialize.cmake +++ b/Modules/Platform/GHS-MULTI-Initialize.cmake @@ -37,7 +37,8 @@ if ( NOT GHS_OS_DIR ) endif () endif () -set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name") +set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name") + set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization") mark_as_advanced(GHS_CUSTOMIZATION) set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons") diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 17fac41..a9742c5 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -236,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->OSDirRelative = true; } - char const* bspName = + std::string bspName; + char const* bspCache = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (NULL == bspName) { - bspName = ""; - cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); - } else { + if (bspCache) { + bspName = bspCache; this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); } - std::string fBspName(this->trimQuotes(bspName)); - std::replace(fBspName.begin(), fBspName.end(), '\\', '/'); + if (bspName.empty() || bspName.compare("IGNORE") == 0) { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + bspName = "sim"; + bspName += (a ? a : ""); + } + this->WriteMacros(); this->WriteHighLevelDirectives(); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); this->WriteDisclaimer(this->GetBuildFileStream()); *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; - if (!fBspName.empty()) { - *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; - } + *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + this->WriteCompilerOptions(fOSDir); } -- cgit v0.12