Browse Source

KWSys 2012-10-01 (bab53989)

Extract upstream KWSys using the following shell code.

$ sha1=bab53989d7c4027259bff837574f75003396d59f &&
git archive --prefix=KWSys-snapshot/ $sha1 |
tar x

$ git log 719638e2..bab53989 ^341043cf --no-merges --oneline --abbrev=8
bab53989 Tell Git to check tab-in-indent and no-lf-at-eof
8115bd1b SystemInformation: Pass extern "C" functions to sigaction
4f4dd224 SystemInformation: Fix unused assignment warnings
6b26d2fe SystemInformation: Use ifaddrs.h only where available
381923ed SystemInformation: Use si_code constants only where available
8f85338c SystemInformation: Use execinfo.h backtrace only where available
a8e98f98 SystemInformation: Use Windows API more portably
750b4b5c SystemInformation: Use long long or __int64 only where available
8d2cafcd SystemInformation: Fix UNIX system includes for FQDN
857bda17 SystemInformation: Report more information
63cbea35 Add and configure developer setup helper scripts
924466f5 SystemTools: Fix accidental bitwise instead of logical OR
2f423229 SystemTools: Remove unused environ declaration
a49c2417 Disable warnings about MS deprecation of C library
e3390720 CTestConfig: Submit to dedicated KWSys dashboard
KWSys Robot 13 years ago
parent
commit
5d0de36d2b
6 changed files with 679 additions and 111 deletions
  1. 36 4
      CMakeLists.txt
  2. 5 6
      CTestConfig.cmake
  3. 0 14
      Configure.h.in
  4. 591 72
      SystemInformation.cxx
  5. 46 10
      SystemInformation.hxx.in
  6. 1 5
      SystemTools.cxx

+ 36 - 4
CMakeLists.txt

@@ -566,9 +566,28 @@ IF(KWSYS_USE_SystemTools)
 ENDIF()
 ENDIF()
 
 
 IF(KWSYS_USE_SystemInformation)
 IF(KWSYS_USE_SystemInformation)
-  SET_PROPERTY(SOURCE SystemInformation.cxx PROPERTY
-    COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=${KWSYS_USE_LONG_LONG}
-                        KWSYS_USE___INT64=${KWSYS_USE___INT64})
+  IF(NOT CYGWIN)
+    INCLUDE(CheckIncludeFiles)
+    CHECK_INCLUDE_FILES("sys/types.h;ifaddrs.h" KWSYS_SYS_HAS_IFADDRS_H)
+    IF(KWSYS_SYS_HAS_IFADDRS_H)
+      SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+        COMPILE_DEFINITIONS KWSYS_SYS_HAS_IFADDRS_H=1)
+    ENDIF()
+  ENDIF()
+  IF(WIN32)
+    INCLUDE(CheckSymbolExists)
+    SET(CMAKE_REQUIRED_LIBRARIES Psapi)
+    CHECK_SYMBOL_EXISTS(GetProcessMemoryInfo "windows.h;psapi.h" KWSYS_SYS_HAS_PSAPI)
+    UNSET(CMAKE_REQUIRED_LIBRARIES)
+    IF(KWSYS_SYS_HAS_PSAPI)
+      SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+        COMPILE_DEFINITIONS KWSYS_SYS_HAS_PSAPI=1)
+      IF(MSVC70 OR MSVC71)
+        # Suppress LNK4089: all references to 'PSAPI.DLL' discarded by /OPT:REF
+        SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /IGNORE:4089")
+      ENDIF()
+    ENDIF()
+  ENDIF()
 ENDIF()
 ENDIF()
 
 
 #-----------------------------------------------------------------------------
 #-----------------------------------------------------------------------------
@@ -802,9 +821,12 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
       TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS})
       TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS})
     ENDIF(UNIX)
     ENDIF(UNIX)
   ENDIF(KWSYS_USE_DynamicLoader)
   ENDIF(KWSYS_USE_DynamicLoader)
-  
+
   IF(KWSYS_USE_SystemInformation AND WIN32)
   IF(KWSYS_USE_SystemInformation AND WIN32)
     TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32)
     TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32)
+    IF(KWSYS_SYS_HAS_PSAPI)
+      TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} Psapi)
+    ENDIF()
   ENDIF(KWSYS_USE_SystemInformation AND WIN32)
   ENDIF(KWSYS_USE_SystemInformation AND WIN32)
 
 
   # Apply user-defined target properties to the library.
   # Apply user-defined target properties to the library.
@@ -842,6 +864,16 @@ ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
 # line to configure the namespace in the C and C++ source files.
 # line to configure the namespace in the C and C++ source files.
 ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
 ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}")
 
 
+# Disable deprecation warnings for standard C functions.
+IF(MSVC OR (WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$"))
+  ADD_DEFINITIONS(
+    -D_CRT_NONSTDC_NO_DEPRECATE
+    -D_CRT_SECURE_NO_DEPRECATE
+    -D_CRT_SECURE_NO_WARNINGS
+    -D_SCL_SECURE_NO_DEPRECATE
+    )
+ENDIF()
+
 IF(KWSYS_USE_String)
 IF(KWSYS_USE_String)
   # Activate code in "String.c".  See the comment in the source.
   # Activate code in "String.c".  See the comment in the source.
   SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES
   SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES

+ 5 - 6
CTestConfig.cmake

@@ -1,6 +1,6 @@
 #=============================================================================
 #=============================================================================
 # KWSys - Kitware System Library
 # KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
 #
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
 # see accompanying file Copyright.txt for details.
@@ -9,10 +9,9 @@
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 # See the License for more information.
 # See the License for more information.
 #=============================================================================
 #=============================================================================
-set (CTEST_PROJECT_NAME "kwsys")
-set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-set (CTEST_DART_SERVER_VERSION "2")
+set(CTEST_PROJECT_NAME "KWSys")
+set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
 set(CTEST_DROP_METHOD "http")
 set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
+set(CTEST_DROP_SITE "open.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=KWSys")
 set(CTEST_DROP_SITE_CDASH TRUE)
 set(CTEST_DROP_SITE_CDASH TRUE)

+ 0 - 14
Configure.h.in

@@ -37,20 +37,6 @@
 /* Whether kwsys namespace is "kwsys".  */
 /* Whether kwsys namespace is "kwsys".  */
 #define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
 #define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
 
 
-/* If we are building a kwsys .c or .cxx file, suppress the Microsoft
-   deprecation warnings.  */
-#if defined(KWSYS_NAMESPACE)
-# ifndef _CRT_NONSTDC_NO_DEPRECATE
-#  define _CRT_NONSTDC_NO_DEPRECATE
-# endif
-# ifndef _CRT_SECURE_NO_DEPRECATE
-#  define _CRT_SECURE_NO_DEPRECATE
-# endif
-# ifndef _SCL_SECURE_NO_DEPRECATE
-#  define _SCL_SECURE_NO_DEPRECATE
-# endif
-#endif
-
 /* Whether Large File Support is requested.  */
 /* Whether Large File Support is requested.  */
 #define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
 #define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
 
 

File diff suppressed because it is too large
+ 591 - 72
SystemInformation.cxx


+ 46 - 10
SystemInformation.hxx.in

@@ -25,13 +25,22 @@ namespace @KWSYS_NAMESPACE@
 {
 {
 
 
 
 
-// forward declare the implementation class  
+// forward declare the implementation class
 class SystemInformationImplementation;
 class SystemInformationImplementation;
-  
-class @KWSYS_NAMESPACE@_EXPORT SystemInformation 
-{
 
 
+class @KWSYS_NAMESPACE@_EXPORT SystemInformation
+{
+#if @KWSYS_USE_LONG_LONG@
+  typedef long long LongLong;
+#elif @KWSYS_USE___INT64@
+  typedef __int64 LongLong;
+#else
+# error "No Long Long"
+#endif
+  friend class SystemInformationImplementation;
+  SystemInformationImplementation* Implementation;
 public:
 public:
+
   SystemInformation ();
   SystemInformation ();
   ~SystemInformation ();
   ~SystemInformation ();
 
 
@@ -40,6 +49,7 @@ public:
   kwsys_stl::string GetTypeID();
   kwsys_stl::string GetTypeID();
   kwsys_stl::string GetFamilyID();
   kwsys_stl::string GetFamilyID();
   kwsys_stl::string GetModelID();
   kwsys_stl::string GetModelID();
+  kwsys_stl::string GetModelName();
   kwsys_stl::string GetSteppingCode();
   kwsys_stl::string GetSteppingCode();
   const char * GetExtendedProcessorName();
   const char * GetExtendedProcessorName();
   const char * GetProcessorSerialNumber();
   const char * GetProcessorSerialNumber();
@@ -49,13 +59,27 @@ public:
   int GetProcessorAPICID();
   int GetProcessorAPICID();
   int GetProcessorCacheXSize(long int);
   int GetProcessorCacheXSize(long int);
   bool DoesCPUSupportFeature(long int);
   bool DoesCPUSupportFeature(long int);
-  
-  const char * GetOSName();
+
+  // returns an informative general description of the cpu
+  // on this system.
+  kwsys_stl::string GetCPUDescription();
+
   const char * GetHostname();
   const char * GetHostname();
+  kwsys_stl::string GetFullyQualifiedDomainName();
+
+  const char * GetOSName();
   const char * GetOSRelease();
   const char * GetOSRelease();
   const char * GetOSVersion();
   const char * GetOSVersion();
   const char * GetOSPlatform();
   const char * GetOSPlatform();
 
 
+  int GetOSIsWindows();
+  int GetOSIsLinux();
+  int GetOSIsApple();
+
+  // returns an informative general description of the os
+  // on this system.
+  kwsys_stl::string GetOSDescription();
+
   bool Is64Bits();
   bool Is64Bits();
 
 
   unsigned int GetNumberOfLogicalCPU(); // per physical cpu
   unsigned int GetNumberOfLogicalCPU(); // per physical cpu
@@ -63,19 +87,31 @@ public:
 
 
   bool DoesCPUSupportCPUID();
   bool DoesCPUSupportCPUID();
 
 
+  // Retrieve id of the current running process
+  LongLong GetProcessId();
+
   // Retrieve memory information in megabyte.
   // Retrieve memory information in megabyte.
   size_t GetTotalVirtualMemory();
   size_t GetTotalVirtualMemory();
   size_t GetAvailableVirtualMemory();
   size_t GetAvailableVirtualMemory();
   size_t GetTotalPhysicalMemory();
   size_t GetTotalPhysicalMemory();
-  size_t GetAvailablePhysicalMemory();  
+  size_t GetAvailablePhysicalMemory();
+
+  // returns an informative general description if the ram
+  // on this system
+  kwsys_stl::string GetMemoryDescription();
+
+  // Retrieve physical memory information in kib
+  LongLong GetMemoryTotal();
+  LongLong GetMemoryUsed();
+
+  // enable/disable stack trace signal handler.
+  static
+  void SetStackTraceOnError(int enable);
 
 
   /** Run the different checks */
   /** Run the different checks */
   void RunCPUCheck();
   void RunCPUCheck();
   void RunOSCheck();
   void RunOSCheck();
   void RunMemoryCheck();
   void RunMemoryCheck();
-private:
-  SystemInformationImplementation* Implementation;
-
 };
 };
 } // namespace @KWSYS_NAMESPACE@
 } // namespace @KWSYS_NAMESPACE@
 
 

+ 1 - 5
SystemTools.cxx

@@ -81,11 +81,7 @@
 #endif
 #endif
 
 
 #if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
 #if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
-# if defined(_WIN32)
-extern __declspec(dllimport) char **environ;
-# else
 extern char **environ;
 extern char **environ;
-# endif
 #endif
 #endif
 
 
 #ifdef __CYGWIN__
 #ifdef __CYGWIN__
@@ -1669,7 +1665,7 @@ kwsys_stl::string SystemTools::EscapeChars(
   kwsys_stl::string n;
   kwsys_stl::string n;
   if (str)
   if (str)
     {
     {
-    if (!chars_to_escape | !*chars_to_escape)
+    if (!chars_to_escape || !*chars_to_escape)
       {
       {
       n.append(str);
       n.append(str);
       }
       }

Some files were not shown because too many files changed in this diff