Merge branch 'upstream-kwsys' into import-KWSys-subtree

This commit is contained in:
Brad King 2012-10-01 15:18:30 -04:00
commit 4b8d3639ad
6 changed files with 1094 additions and 339 deletions

View File

@ -566,9 +566,28 @@ IF(KWSYS_USE_SystemTools)
ENDIF() ENDIF()
IF(KWSYS_USE_SystemInformation) IF(KWSYS_USE_SystemInformation)
SET_PROPERTY(SOURCE SystemInformation.cxx PROPERTY IF(NOT CYGWIN)
COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=${KWSYS_USE_LONG_LONG} INCLUDE(CheckIncludeFiles)
KWSYS_USE___INT64=${KWSYS_USE___INT64}) 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()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -805,6 +824,9 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS)
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

View File

@ -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_PROJECT_NAME "KWSys")
set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set (CTEST_DART_SERVER_VERSION "2")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_SITE "open.cdash.org")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") set(CTEST_DROP_LOCATION "/submit.php?project=KWSys")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)

View File

@ -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 Load Diff

View File

@ -30,8 +30,17 @@ 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();
@ -50,12 +60,26 @@ public:
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@

View File

@ -1665,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);
} }