mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-07 04:02:23 +03:00
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys: KWSys 2017-03-07 (5da8cfe0)
This commit is contained in:
commit
83be64d99c
4 files changed
+22
-3
No files matched your search
@@ -539,6 +539,7 @@ protected:
|
||||
std::string OSRelease;
|
||||
std::string OSVersion;
|
||||
std::string OSPlatform;
|
||||
bool OSIs64Bit;
|
||||
};
|
||||
|
||||
SystemInformation::SystemInformation()
|
||||
@@ -1499,6 +1500,7 @@ SystemInformationImplementation::SystemInformationImplementation()
|
||||
this->OSRelease = "";
|
||||
this->OSVersion = "";
|
||||
this->OSPlatform = "";
|
||||
this->OSIs64Bit = (sizeof(void*) == 8);
|
||||
}
|
||||
|
||||
SystemInformationImplementation::~SystemInformationImplementation()
|
||||
@@ -5320,10 +5322,20 @@ bool SystemInformationImplementation::QueryOSInformation()
|
||||
this->Hostname = name;
|
||||
|
||||
const char* arch = getenv("PROCESSOR_ARCHITECTURE");
|
||||
const char* wow64 = getenv("PROCESSOR_ARCHITEW6432");
|
||||
if (arch) {
|
||||
this->OSPlatform = arch;
|
||||
}
|
||||
|
||||
if (wow64) {
|
||||
// the PROCESSOR_ARCHITEW6432 is only defined when running 32bit programs
|
||||
// on 64bit OS
|
||||
this->OSIs64Bit = true;
|
||||
} else if (arch) {
|
||||
// all values other than x86 map to 64bit architectures
|
||||
this->OSIs64Bit = (strncmp(arch, "x86", 3) != 0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
struct utsname unameInfo;
|
||||
@@ -5334,6 +5346,12 @@ bool SystemInformationImplementation::QueryOSInformation()
|
||||
this->OSRelease = unameInfo.release;
|
||||
this->OSVersion = unameInfo.version;
|
||||
this->OSPlatform = unameInfo.machine;
|
||||
|
||||
// This is still insufficient to capture 64bit architecture such
|
||||
// powerpc and possible mips and sparc
|
||||
if (this->OSPlatform.find_first_of("64") != std::string::npos) {
|
||||
this->OSIs64Bit = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -5387,6 +5405,6 @@ void SystemInformationImplementation::TrimNewline(std::string& output)
|
||||
/** Return true if the machine is 64 bits */
|
||||
bool SystemInformationImplementation::Is64Bits()
|
||||
{
|
||||
return (sizeof(void*) == 8);
|
||||
return this->OSIs64Bit;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
// on this system.
|
||||
std::string GetOSDescription();
|
||||
|
||||
// returns if the operating system is 64bit or not.
|
||||
bool Is64Bits();
|
||||
|
||||
unsigned int GetNumberOfLogicalCPU();
|
||||
|
||||
@@ -3331,7 +3331,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path,
|
||||
SystemTools::SplitPath(in_path, path_components);
|
||||
|
||||
// If the input path is relative, start with a base path.
|
||||
if (path_components[0].length() == 0) {
|
||||
if (path_components[0].empty()) {
|
||||
std::vector<std::string> base_components;
|
||||
if (in_base) {
|
||||
// Use the given base path.
|
||||
|
||||
@@ -52,6 +52,7 @@ int testSystemInformation(int, char* [])
|
||||
printMethod(info, GetOSRelease);
|
||||
printMethod(info, GetOSVersion);
|
||||
printMethod(info, GetOSPlatform);
|
||||
printMethod(info, Is64Bits);
|
||||
printMethod(info, GetVendorString);
|
||||
printMethod(info, GetVendorID);
|
||||
printMethod(info, GetTypeID);
|
||||
@@ -63,7 +64,6 @@ int testSystemInformation(int, char* [])
|
||||
printMethod2(info, GetProcessorCacheSize, "KB");
|
||||
printMethod(info, GetLogicalProcessorsPerPhysical);
|
||||
printMethod2(info, GetProcessorClockFrequency, "MHz");
|
||||
printMethod(info, Is64Bits);
|
||||
printMethod(info, GetNumberOfLogicalCPU);
|
||||
printMethod(info, GetNumberOfPhysicalCPU);
|
||||
printMethod(info, DoesCPUSupportCPUID);
|
||||
|
||||
Reference in new issue
Block a user