|
|
@@ -119,10 +119,11 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
|
|
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
|
|
cmMakefile* mf)
|
|
|
{
|
|
|
+ std::string arch;
|
|
|
if (p.empty()) {
|
|
|
cmSystemTools::Message(
|
|
|
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
|
|
|
- std::string arch = "arm";
|
|
|
+ arch = "arm";
|
|
|
|
|
|
/* store the platform name for later use
|
|
|
* -- already done if -A<arch> was specified
|
|
|
@@ -130,19 +131,51 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
|
|
mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
|
|
|
"Name of generator platform.",
|
|
|
cmStateEnums::INTERNAL);
|
|
|
+ } else {
|
|
|
+ arch = p;
|
|
|
}
|
|
|
|
|
|
- const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
|
|
|
- if (tgtPlatform == nullptr) {
|
|
|
- cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
|
|
|
- "specified; defaulting to \"integrity\"");
|
|
|
- tgtPlatform = "integrity";
|
|
|
+ /* check if OS location has been updated by platform scripts */
|
|
|
+ std::string platform = mf->GetSafeDefinition("GHS_TARGET_PLATFORM");
|
|
|
+ std::string osdir = mf->GetSafeDefinition("GHS_OS_DIR");
|
|
|
+ if (cmSystemTools::IsOff(osdir.c_str()) &&
|
|
|
+ platform.find("integrity") != std::string::npos) {
|
|
|
+ if (!this->CMakeInstance->GetIsInTryCompile()) {
|
|
|
+ /* required OS location is not found */
|
|
|
+ std::string m =
|
|
|
+ "Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \"";
|
|
|
+ m += mf->GetSafeDefinition("GHS_OS_ROOT");
|
|
|
+ m += "\"";
|
|
|
+ cmSystemTools::Message(m);
|
|
|
+ }
|
|
|
+ osdir = "GHS_OS_DIR-NOT-SPECIFIED";
|
|
|
+ } else if (!this->CMakeInstance->GetIsInTryCompile() &&
|
|
|
+ cmSystemTools::IsOff(this->OsDir) &&
|
|
|
+ !cmSystemTools::IsOff(osdir)) {
|
|
|
+ /* OS location was updated by auto-selection */
|
|
|
+ std::string m = "Green Hills MULTI: GHS_OS_DIR not specified; found \"";
|
|
|
+ m += osdir;
|
|
|
+ m += "\"";
|
|
|
+ cmSystemTools::Message(m);
|
|
|
}
|
|
|
+ this->OsDir = osdir;
|
|
|
|
|
|
- /* store the platform name for later use */
|
|
|
- mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
|
|
|
- "Name of GHS target platform.",
|
|
|
- cmStateEnums::INTERNAL);
|
|
|
+ // Determine GHS_BSP_NAME
|
|
|
+ std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
|
|
|
+
|
|
|
+ if (cmSystemTools::IsOff(bspName.c_str()) &&
|
|
|
+ platform.find("integrity") != std::string::npos) {
|
|
|
+ bspName = "sim" + arch;
|
|
|
+ /* write back the calculate name for next time */
|
|
|
+ mf->AddCacheDefinition("GHS_BSP_NAME", bspName.c_str(),
|
|
|
+ "Name of GHS target platform.",
|
|
|
+ cmStateEnums::STRING, true);
|
|
|
+ std::string m =
|
|
|
+ "Green Hills MULTI: GHS_BSP_NAME not specified; defaulting to \"";
|
|
|
+ m += bspName;
|
|
|
+ m += "\"";
|
|
|
+ cmSystemTools::Message(m);
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -153,6 +186,21 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
|
|
|
mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
|
|
|
|
|
|
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
|
|
|
+
|
|
|
+ const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
|
|
|
+ if (!tgtPlatform) {
|
|
|
+ cmSystemTools::Message("Green Hills MULTI: GHS_TARGET_PLATFORM not "
|
|
|
+ "specified; defaulting to \"integrity\"");
|
|
|
+ tgtPlatform = "integrity";
|
|
|
+ }
|
|
|
+
|
|
|
+ /* store the platform name for later use */
|
|
|
+ mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
|
|
|
+ "Name of GHS target platform.", cmStateEnums::STRING);
|
|
|
+
|
|
|
+ /* store original OS location */
|
|
|
+ this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR");
|
|
|
+
|
|
|
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
|
|
|
}
|
|
|
|
|
|
@@ -230,53 +278,25 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(
|
|
|
fout << "# Top Level Project File" << std::endl;
|
|
|
|
|
|
// Specify BSP option if supplied by user
|
|
|
- // -- not all platforms require this entry in the project file
|
|
|
- // integrity platforms require this field; use default if needed
|
|
|
- std::string platform;
|
|
|
- if (const char* p =
|
|
|
- this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM")) {
|
|
|
- platform = p;
|
|
|
- }
|
|
|
-
|
|
|
- std::string bspName;
|
|
|
- if (char const* bspCache =
|
|
|
- this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME")) {
|
|
|
- bspName = bspCache;
|
|
|
- this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
|
|
|
- } else {
|
|
|
- bspName = "IGNORE";
|
|
|
- }
|
|
|
-
|
|
|
- if (platform.find("integrity") != std::string::npos &&
|
|
|
- cmSystemTools::IsOff(bspName.c_str())) {
|
|
|
- const char* a =
|
|
|
- this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
|
|
|
- bspName = "sim";
|
|
|
- bspName += (a ? a : "");
|
|
|
- }
|
|
|
-
|
|
|
- if (!cmSystemTools::IsOff(bspName.c_str())) {
|
|
|
+ const char* bspName =
|
|
|
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
|
|
|
+ if (!cmSystemTools::IsOff(bspName)) {
|
|
|
fout << " -bsp " << bspName << std::endl;
|
|
|
}
|
|
|
|
|
|
// Specify OS DIR if supplied by user
|
|
|
// -- not all platforms require this entry in the project file
|
|
|
- std::string osDir;
|
|
|
- std::string osDirOption;
|
|
|
- if (char const* osDirCache =
|
|
|
- this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR")) {
|
|
|
- osDir = osDirCache;
|
|
|
- }
|
|
|
-
|
|
|
- if (char const* osDirOptionCache =
|
|
|
- this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION")) {
|
|
|
- osDirOption = osDirOptionCache;
|
|
|
- }
|
|
|
-
|
|
|
- if (!cmSystemTools::IsOff(osDir.c_str()) ||
|
|
|
- platform.find("integrity") != std::string::npos) {
|
|
|
- std::replace(osDir.begin(), osDir.end(), '\\', '/');
|
|
|
- fout << " " << osDirOption << "\"" << osDir << "\"" << std::endl;
|
|
|
+ if (!cmSystemTools::IsOff(this->OsDir.c_str())) {
|
|
|
+ const char* osDirOption =
|
|
|
+ this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION");
|
|
|
+ std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/');
|
|
|
+ fout << " ";
|
|
|
+ if (cmSystemTools::IsOff(osDirOption)) {
|
|
|
+ fout << "";
|
|
|
+ } else {
|
|
|
+ fout << osDirOption;
|
|
|
+ }
|
|
|
+ fout << "\"" << this->OsDir << "\"" << std::endl;
|
|
|
}
|
|
|
|
|
|
WriteSubProjects(fout, root, generators);
|