Files
MSYS2-packages/cmake/3.5.2-cpuinfo.patch
T
J. Peter Mugaas a5badda0b4 cmake 3.5.2 - Update to latest version, rekey all patches
Update to latest version
Rekey all patches
Hopefully have improvements from #584.
jsoncpp is dependency
2016-05-23 04:42:32 -04:00

90 lines
3.0 KiB
Diff

diff -aur cmake-3.5.2/Source/kwsys/SystemInformation.cxx.orig cmake-3.5.2/Source/kwsys/SystemInformation.cxx
--- cmake-3.5.2/Source/kwsys/SystemInformation.cxx.orig 2016-04-15 09:41:22.000000000 -0400
+++ cmake-3.5.2/Source/kwsys/SystemInformation.cxx 2016-05-19 01:51:07.346713700 -0400
@@ -917,7 +917,7 @@
// Hide implementation details in an anonymous namespace.
namespace {
// *****************************************************************************
-#if defined(__linux) || defined(__APPLE__)
+#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
int LoadLines(
FILE *file,
std::vector<std::string> &lines)
@@ -953,7 +953,7 @@
return nRead;
}
-# if defined(__linux)
+# if defined(__linux) || defined(__CYGWIN__)
// *****************************************************************************
int LoadLines(
const char *fileName,
@@ -992,7 +992,7 @@
}
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__CYGWIN__)
// ****************************************************************************
template<typename T>
int GetFieldsFromFile(
@@ -3200,7 +3200,6 @@
pos = buffer.find("processor\t",pos+1);
}
-#ifdef __linux
// Find the largest physical id.
int maxId = -1;
std::string idc =
@@ -3233,14 +3232,6 @@
atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
}
-#else // __CYGWIN__
- // does not have "physical id" entries, neither "cpu cores"
- // this has to be fixed for hyper-threading.
- std::string cpucount =
- this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
- this->NumberOfPhysicalCPU=
- this->NumberOfLogicalCPU = atoi(cpucount.c_str());
-#endif
// gotta have one, and if this is 0 then we get a / by 0n
// better to have a bad answer than a crash
if(this->NumberOfPhysicalCPU <= 0)
@@ -3438,7 +3429,7 @@
GlobalMemoryStatusEx(&statex);
return statex.ullTotalPhys/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memTotal=0;
int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
if (ierr)
@@ -3569,7 +3560,7 @@
GlobalMemoryStatusEx(&statex);
return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
const char *names[3]={"MemTotal:","MemFree:",NULL};
SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
@@ -3628,7 +3619,7 @@
return -2;
}
return pmc.WorkingSetSize/1024;
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memUsed=0;
int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
if (ierr)
@@ -3712,7 +3703,7 @@
{
#if defined(_WIN32)
return GetCurrentProcessId();
-#elif defined(__linux) || defined(__APPLE__)
+#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
return getpid();
#else
return -1;