ENH: Enable library search path suffix for sparcv9 architecture. This should be generalized to a platform file later.
This commit is contained in:
parent
78fcb26695
commit
e417fb7100
|
@ -17,6 +17,8 @@ const char info_sizeof_dptr[] = {
|
||||||
# define ABI_ID "ELF N32"
|
# define ABI_ID "ELF N32"
|
||||||
#elif defined(__sgi) && defined(_ABI64)
|
#elif defined(__sgi) && defined(_ABI64)
|
||||||
# define ABI_ID "ELF 64"
|
# define ABI_ID "ELF 64"
|
||||||
|
#elif defined(__sparcv9)
|
||||||
|
# define ABI_ID "SPARCV9"
|
||||||
#elif defined(__ELF__)
|
#elif defined(__ELF__)
|
||||||
# define ABI_ID "ELF"
|
# define ABI_ID "ELF"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,13 +77,19 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(const char* abi =
|
if(const char* abi_name =
|
||||||
this->Makefile->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI"))
|
this->Makefile->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI"))
|
||||||
{
|
{
|
||||||
if(strncmp(abi, "ELF N32", 7) ==0)
|
std::string abi = abi_name;
|
||||||
|
if(abi.find("ELF N32") != abi.npos)
|
||||||
{
|
{
|
||||||
// Convert /lib to /lib32 if the architecture requests it.
|
// Convert lib to lib32.
|
||||||
this->AddLib32Paths();
|
this->AddArchitecturePaths("32");
|
||||||
|
}
|
||||||
|
else if(abi.find("SPARCV9") != abi.npos)
|
||||||
|
{
|
||||||
|
// Convert lib to lib/sparcv9.
|
||||||
|
this->AddArchitecturePaths("/sparcv9");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,42 +123,44 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmFindLibraryCommand::AddLib32Paths()
|
void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
|
||||||
{
|
{
|
||||||
std::vector<std::string> path32;
|
std::vector<std::string> newPaths;
|
||||||
bool found32 = false;
|
bool found = false;
|
||||||
|
std::string subpath = "lib";
|
||||||
|
subpath += suffix;
|
||||||
|
subpath += "/";
|
||||||
for(std::vector<std::string>::iterator i = this->SearchPaths.begin();
|
for(std::vector<std::string>::iterator i = this->SearchPaths.begin();
|
||||||
i != this->SearchPaths.end(); ++i)
|
i != this->SearchPaths.end(); ++i)
|
||||||
{
|
{
|
||||||
|
// Try replacing lib/ with lib<suffix>/
|
||||||
std::string s = *i;
|
std::string s = *i;
|
||||||
std::string s2 = *i;
|
cmSystemTools::ReplaceString(s, "lib/", subpath.c_str());
|
||||||
cmSystemTools::ReplaceString(s, "lib/", "lib32/");
|
|
||||||
// try to replace lib with lib32 and see if it is there,
|
|
||||||
// then prepend it to the path
|
|
||||||
if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
|
if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
|
||||||
{
|
{
|
||||||
path32.push_back(s);
|
found = true;
|
||||||
found32 = true;
|
newPaths.push_back(s);
|
||||||
}
|
}
|
||||||
// now just add a 32 to the path name and if it is there,
|
|
||||||
// add it to the path
|
// Now look for lib<suffix>
|
||||||
s2 += "32";
|
s = *i;
|
||||||
if(cmSystemTools::FileIsDirectory(s2.c_str()))
|
s += suffix;
|
||||||
|
if(cmSystemTools::FileIsDirectory(s.c_str()))
|
||||||
{
|
{
|
||||||
found32 = true;
|
found = true;
|
||||||
path32.push_back(s2);
|
newPaths.push_back(s);
|
||||||
}
|
}
|
||||||
// now add the original unchanged path
|
// now add the original unchanged path
|
||||||
if(cmSystemTools::FileIsDirectory(i->c_str()))
|
if(cmSystemTools::FileIsDirectory(i->c_str()))
|
||||||
{
|
{
|
||||||
path32.push_back(*i);
|
newPaths.push_back(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now replace the SearchPaths with the 32 bit converted path
|
|
||||||
// if any 32 bit paths were discovered
|
// If any new paths were found replace the original set.
|
||||||
if(found32)
|
if(found)
|
||||||
{
|
{
|
||||||
this->SearchPaths = path32;
|
this->SearchPaths = newPaths;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
cmTypeMacro(cmFindLibraryCommand, cmFindBase);
|
cmTypeMacro(cmFindLibraryCommand, cmFindBase);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddLib32Paths();
|
void AddArchitecturePaths(const char* suffix);
|
||||||
void AddLib64Paths();
|
void AddLib64Paths();
|
||||||
std::string FindLibrary(const char* name);
|
std::string FindLibrary(const char* name);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue