[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1558-g1314604
Brad King
brad.king at kitware.com
Fri Jan 11 11:37:37 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 13146046f0bf96f8b90bdfe79affd139ac40938a (commit)
via 6f57a9041e8a609ca45a7b26af5118f492b83ac2 (commit)
via 6318834b95fb4e666f9c135a883bb953579c3c8a (commit)
from 04255a0645dabb37a68681ebf316c2abbad7aa4a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13146046f0bf96f8b90bdfe79affd139ac40938a
commit 13146046f0bf96f8b90bdfe79affd139ac40938a
Merge: 04255a0 6f57a90
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jan 11 11:37:34 2013 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 11 11:37:34 2013 -0500
Merge topic 'update-kwsys' into next
6f57a90 Merge branch 'upstream-kwsys' into update-kwsys
6318834 KWSys 2013-01-10 (608d6b47)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f57a9041e8a609ca45a7b26af5118f492b83ac2
commit 6f57a9041e8a609ca45a7b26af5118f492b83ac2
Merge: c0c8ef8 6318834
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Jan 11 11:34:59 2013 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jan 11 11:34:59 2013 -0500
Merge branch 'upstream-kwsys' into update-kwsys
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6318834b95fb4e666f9c135a883bb953579c3c8a
commit 6318834b95fb4e666f9c135a883bb953579c3c8a
Author: KWSys Robot <kwrobot at kitware.com>
AuthorDate: Thu Jan 10 18:34:34 2013 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Jan 11 11:34:55 2013 -0500
KWSys 2013-01-10 (608d6b47)
Extract upstream KWSys using the following shell commands.
$ git archive --prefix=upstream-kwsys/ 608d6b47 | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' fc60c8b8..608d6b47
Rolf Eike Beer (6):
297758a5 SystemInformation: fix conversion warning
79ef34ef SystemInformation: fix calling kwsysProcess_WaitForData()
f1068caf SystemInformation: speed up copying process data
7dfc27d5 SystemInformation: check CPU vendor and SSE support on OpenBSD
494d9d7a SystemInformation: get stepping code on Intel Macs
608d6b47 SystemInformation: determine processor features on Intel Macs
Change-Id: I7f5bc5b7af2bf7d4e5c1ee291c286add0f17a7d5
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6bfcab0..5df5a74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -603,6 +603,13 @@ IF(KWSYS_USE_SystemInformation)
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1)
ENDIF()
ENDIF()
+ IF(CMAKE_SYSTEM MATCHES "BSD")
+ CHECK_INCLUDE_FILES("machine/cpu.h" KWSYS_SYS_HAS_MACHINE_CPU_H)
+ IF(KWSYS_SYS_HAS_MACHINE_CPU_H)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
+ ENDIF()
+ ENDIF()
IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1)
ENDIF()
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 0460b29..59a9abe 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -91,6 +91,10 @@ typedef int siginfo_t;
# include <sys/sysctl.h>
#endif
+#if defined(KWSYS_SYS_HAS_MACHINE_CPU_H)
+# include <machine/cpu.h>
+#endif
+
#if defined(__DragonFly__)
# include <sys/sysctl.h>
#endif
@@ -3026,7 +3030,7 @@ bool SystemInformationImplementation::QueryProcessor()
return false;
}
- this->NumberOfPhysicalCPU = c;
+ this->NumberOfPhysicalCPU = static_cast<unsigned int>(c);
this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
return true;
@@ -4000,6 +4004,81 @@ bool SystemInformationImplementation::ParseSysCtl()
len = sizeof(value);
err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
this->ChipID.Model = static_cast< int >( value );
+
+ // Chip Stepping
+ len = sizeof(value);
+ value = 0;
+ err = sysctlbyname("machdep.cpu.stepping", &value, &len, NULL, 0);
+ if (!err)
+ {
+ this->ChipID.Revision = static_cast< int >( value );
+ }
+
+ // feature string
+ char *buf = 0;
+ size_t allocSize = 128;
+
+ err = 0;
+ len = 0;
+
+ // sysctlbyname() will return with err==0 && len==0 if the buffer is too small
+ while (err == 0 && len == 0)
+ {
+ delete[] buf;
+ allocSize *= 2;
+ buf = new char[allocSize];
+ if (!buf)
+ {
+ break;
+ }
+ buf[0] = ' ';
+ len = allocSize - 2; // keep space for leading and trailing space
+ err = sysctlbyname("machdep.cpu.features", buf + 1, &len, NULL, 0);
+ }
+ if (!err && buf && len)
+ {
+ // now we can match every flags as space + flag + space
+ buf[len + 1] = ' ';
+ kwsys_stl::string cpuflags(buf, len + 2);
+
+ if ((cpuflags.find(" FPU ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasFPU = true;
+ }
+ if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasTSC = true;
+ }
+ if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasMMX = true;
+ }
+ if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasSSE = true;
+ }
+ if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasSSE2 = true;
+ }
+ if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasAPIC = true;
+ }
+ if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasCMOV = true;
+ }
+ if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasMTRR = true;
+ }
+ if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos))
+ {
+ this->Features.HasACPI = true;
+ }
+ }
+ delete[] buf;
}
// brand string
@@ -4059,13 +4138,12 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<
char* data = NULL;
int length;
double timeout = 255;
+ int pipe; // pipe id as returned by kwsysProcess_WaitForData()
- while(kwsysProcess_WaitForData(gp,&data,&length,&timeout)) // wait for 1s
+ while( ( pipe = kwsysProcess_WaitForData(gp,&data,&length,&timeout),
+ (pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR) ) ) // wait for 1s
{
- for(int i=0;i<length;i++)
- {
- buffer += data[i];
- }
+ buffer.append(data, length);
}
kwsysProcess_WaitForExit(gp, 0);
@@ -4424,6 +4502,45 @@ bool SystemInformationImplementation::QueryBSDProcessor()
this->CPUSpeedInMHz = (float) k;
#endif
+#if defined(CPU_SSE)
+ ctrl[0] = CTL_MACHDEP;
+ ctrl[1] = CPU_SSE;
+
+ if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
+ {
+ return false;
+ }
+
+ this->Features.HasSSE = (k > 0);
+#endif
+
+#if defined(CPU_SSE2)
+ ctrl[0] = CTL_MACHDEP;
+ ctrl[1] = CPU_SSE2;
+
+ if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
+ {
+ return false;
+ }
+
+ this->Features.HasSSE2 = (k > 0);
+#endif
+
+#if defined(CPU_CPUVENDOR)
+ ctrl[0] = CTL_MACHDEP;
+ ctrl[1] = CPU_CPUVENDOR;
+ char vbuf[25];
+ ::memset(vbuf, 0, sizeof(vbuf));
+ sz = sizeof(vbuf) - 1;
+ if (sysctl(ctrl, 2, vbuf, &sz, NULL, 0) != 0)
+ {
+ return false;
+ }
+
+ this->ChipID.Vendor = vbuf;
+ this->FindManufacturer();
+#endif
+
return true;
#else
return false;
-----------------------------------------------------------------------
Summary of changes:
Source/kwsys/CMakeLists.txt | 7 ++
Source/kwsys/SystemInformation.cxx | 129 ++++++++++++++++++++++++++++++++++--
2 files changed, 130 insertions(+), 6 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list