mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
GHS: Update RTOS selection logic
Selection of an RTOS only needs to be performed if not set by user. Avoid CMake developer warnings for setting GHS_OS_DIR multiple times. Instead only set it once after searching has been performed. Remove all the logic for printing error and status messages about RTOS selection. This was broken and reporting incorrect messages. These messages also breaks CMake tests. NOTE: If RTOS selection fails then the compiler checks will result in a build error. The build error will report that the RTOS "GHS_OS_DIR-NOT-SPECIFIED" does not exist.
This commit is contained in:
@@ -33,24 +33,27 @@ if(CMAKE_GENERATOR MATCHES "Green Hills MULTI")
|
||||
mark_as_advanced(GHS_GPJ_MACROS)
|
||||
endif()
|
||||
|
||||
# Settings for OS selection
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||
set(_os_root "/usr/ghs")
|
||||
else()
|
||||
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||
set(_os_root "C:/ghs")
|
||||
endif()
|
||||
set(GHS_OS_ROOT "${_os_root}" CACHE PATH "GHS platform OS search root directory")
|
||||
unset(_os_root)
|
||||
mark_as_advanced(GHS_OS_ROOT)
|
||||
|
||||
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
|
||||
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_OS_DIR if not set by user
|
||||
if(NOT GHS_OS_DIR)
|
||||
# Search for GHS_OS_DIR if not set by user and is known to be required
|
||||
if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
|
||||
# Use a value that will make it apparent RTOS selection failed
|
||||
set(_ghs_os_dir "GHS_OS_DIR-NOT-SPECIFIED")
|
||||
else()
|
||||
set(_ghs_os_dir "IGNORE")
|
||||
endif()
|
||||
if(_ghs_os_dir AND NOT DEFINED GHS_OS_DIR)
|
||||
if(EXISTS ${GHS_OS_ROOT})
|
||||
|
||||
#get all directories in root directory
|
||||
# Get all directories in root directory
|
||||
FILE(GLOB GHS_CANDIDATE_OS_DIRS
|
||||
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
|
||||
FILE(GLOB GHS_CANDIDATE_OS_FILES
|
||||
@@ -59,23 +62,25 @@ if(NOT GHS_OS_DIR)
|
||||
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
|
||||
endif ()
|
||||
|
||||
#filter based on platform name
|
||||
# Filter based on platform name
|
||||
if(GHS_PRIMARY_TARGET MATCHES "integrity" OR GHS_TARGET_PLATFORM MATCHES "integrity")
|
||||
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z]")
|
||||
else() #fall-back for standalone
|
||||
unset(GHS_CANDIDATE_OS_DIRS)
|
||||
set(GHS_OS_DIR "IGNORE")
|
||||
endif()
|
||||
|
||||
# Select latest? of matching candidates
|
||||
if(GHS_CANDIDATE_OS_DIRS)
|
||||
list(SORT GHS_CANDIDATE_OS_DIRS)
|
||||
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
|
||||
string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
|
||||
string(CONCAT _ghs_os_dir ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
|
||||
endif()
|
||||
|
||||
#update cache with new value
|
||||
set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#Used for targets requiring RTOS
|
||||
set(GHS_OS_DIR "${_ghs_os_dir}" CACHE PATH "GHS platform OS directory")
|
||||
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")
|
||||
|
||||
@@ -133,27 +133,6 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
||||
cmStateEnums::STRING, true);
|
||||
}
|
||||
|
||||
/* 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 (cmIsOff(osdir) && platform.find("integrity") != std::string::npos) {
|
||||
if (!this->CMakeInstance->GetIsInTryCompile()) {
|
||||
/* required OS location is not found */
|
||||
std::string m = cmStrCat(
|
||||
"Green Hills MULTI: GHS_OS_DIR not specified; No OS found in \"",
|
||||
mf->GetSafeDefinition("GHS_OS_ROOT"), '"');
|
||||
cmSystemTools::Message(m);
|
||||
}
|
||||
osdir = "GHS_OS_DIR-NOT-SPECIFIED";
|
||||
} else if (!this->CMakeInstance->GetIsInTryCompile() &&
|
||||
cmIsOff(this->OsDir) && !cmIsOff(osdir)) {
|
||||
/* OS location was updated by auto-selection */
|
||||
std::string m = cmStrCat(
|
||||
"Green Hills MULTI: GHS_OS_DIR not specified; found \"", osdir, '"');
|
||||
cmSystemTools::Message(m);
|
||||
}
|
||||
this->OsDir = osdir;
|
||||
|
||||
// Determine GHS_BSP_NAME
|
||||
std::string bspName = mf->GetSafeDefinition("GHS_BSP_NAME");
|
||||
|
||||
@@ -180,9 +159,6 @@ void cmGlobalGhsMultiGenerator::EnableLanguage(
|
||||
|
||||
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
|
||||
|
||||
/* store original OS location */
|
||||
this->OsDir = mf->GetSafeDefinition("GHS_OS_DIR");
|
||||
|
||||
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
|
||||
}
|
||||
|
||||
@@ -340,17 +316,17 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
|
||||
|
||||
// Specify OS DIR if supplied by user
|
||||
// -- not all platforms require this entry in the project file
|
||||
if (!cmIsOff(this->OsDir)) {
|
||||
cmValue osDir = this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR");
|
||||
if (!cmIsOff(osDir)) {
|
||||
cmValue osDirOption =
|
||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_OS_DIR_OPTION");
|
||||
std::replace(this->OsDir.begin(), this->OsDir.end(), '\\', '/');
|
||||
fout << " ";
|
||||
if (cmIsOff(osDirOption)) {
|
||||
fout << "";
|
||||
} else {
|
||||
fout << *osDirOption;
|
||||
}
|
||||
fout << "\"" << this->OsDir << "\"\n";
|
||||
fout << "\"" << osDir << "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ private:
|
||||
|
||||
static std::string TrimQuotes(std::string str);
|
||||
|
||||
std::string OsDir;
|
||||
static const char* DEFAULT_BUILD_PROGRAM;
|
||||
|
||||
bool ComputeTargetBuildOrder(cmGeneratorTarget const* tgt,
|
||||
|
||||
Reference in New Issue
Block a user