GHS: Update default BSP name

-- Use default value of sim<arch> if not user defined
-- Also no reason to trim quotes or changes slashes; it is just a name not a path
This commit is contained in:
Fred Baksik 2018-07-07 07:27:22 -04:00
parent 01c98c6ccc
commit 281c601024
3 changed files with 19 additions and 12 deletions

View File

@ -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<arch>`` if not set by user.
Customizations are available through the following cache variables:
* ``GHS_BSP_NAME``
* ``GHS_CUSTOMIZATION``
* ``GHS_GPJ_MACROS``

View File

@ -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")

View File

@ -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);
}