Files
MSYS2-packages/cmake/3.9.3-cpuinfo.patch
2019-07-18 10:32:59 +03:00

93 lines
3.4 KiB
Diff

--- cmake-3.15.0/Source/kwsys/SystemInformation.cxx.orig 2019-07-17 15:07:17.000000000 +0300
+++ cmake-3.15.0/Source/kwsys/SystemInformation.cxx 2019-07-18 09:46:35.830666200 +0300
@@ -879,7 +879,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)
{
// Load each line in the given file into a the vector.
@@ -909,7 +909,7 @@
return nRead;
}
-# if defined(__linux)
+# if defined(__linux) || defined(__CYGWIN__)
// *****************************************************************************
int LoadLines(const char* fileName, std::vector<std::string>& lines)
{
@@ -942,7 +942,7 @@
}
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__)
// ****************************************************************************
template <typename T>
int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
@@ -1542,7 +1542,7 @@
this->QueryBSDProcessor();
#elif defined(__hpux)
this->QueryHPUXProcessor();
-#elif defined(__linux) || defined(__CYGWIN__)
+#elif defined(__linux) || defined(__CYGWIN__) || defined(__MSYS__)
this->RetreiveInformationFromCpuInfoFile();
#else
this->QueryProcessor();
@@ -1567,7 +1567,7 @@
#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__DragonFly__)
this->QueryBSDMemory();
-#elif defined(__CYGWIN__)
+#elif defined(__CYGWIN__) || defined(__MSYS__)
this->QueryCygwinMemory();
#elif defined(_WIN32)
this->QueryWindowsMemory();
@@ -3618,7 +3618,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) {
@@ -3743,7 +3743,7 @@
GlobalMemoryStatusEx(&statex);
return (statex.ullTotalPhys - statex.ullAvailPhys) / 1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
// First try to use MemAvailable, but it only works on newer kernels
const char* names2[3] = { "MemTotal:", "MemAvailable:", NULL };
SystemInformation::LongLong values2[2] = { SystemInformation::LongLong(0) };
@@ -3807,7 +3807,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) {
@@ -3884,7 +3884,7 @@
#if defined(_WIN32)
return GetCurrentProcessId();
#elif defined(__linux) || defined(__APPLE__) || defined(__OpenBSD__) || \
- defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+ defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__MSYS__)
return getpid();
#else
return -1;
@@ -4196,7 +4196,7 @@
bool SystemInformationImplementation::QueryCygwinMemory()
{
-#ifdef __CYGWIN__
+#if defined __CYGWIN__ || defined __MSYS__
// _SC_PAGE_SIZE does return the mmap() granularity on Cygwin,
// see http://cygwin.com/ml/cygwin/2006-06/msg00350.html
// Therefore just use 4096 as the page size of Windows.