[CMake] CMake 2.6.0 RC 10 ready for testing

Stefan stefanspage at yahoo.de
Fri May 2 12:35:55 EDT 2008


Hi Bill,

it works, thanks!

To the Memory Problem. I tried this:

	MEMORYSTATUSEX ms;
	ms.dwLength = sizeof (ms); //<- If you don't do this, the values
will be wrong!
	GlobalMemoryStatusEx(&ms); // Use this instead of
GlobalMemoryStatus()

	unsigned __int64 tv = ms.ullTotalVirtual;
	unsigned __int64 tp = ms.ullTotalPhys;
	unsigned __int64 av = ms.ullAvailVirtual;
	unsigned __int64 ap = ms.ullAvailPhys;

	unsigned long TotalVirtualMemory = (unsigned long)tv>>10>>10;
	unsigned long TotalPhysicalMemory = (unsigned long)tp>>10>>10;
	unsigned long AvailableVirtualMemory = (unsigned long)av>>10>>10;
	unsigned long AvailablePhysicalMemory = (unsigned long)ap>>10>>10;

this code produce on my machine the following output that looks quite well:

TotalVirtualMemory: 2047
TotalPhysicalMemory: 3053
AvailableVirtualMemory: 2027
AvailablePhysicalMemory: 3053

The function that you have used to determine the memory values will always
return 2GB on a x86 machine with more than 2GB.
I found this on the MSDN
(http://msdn.microsoft.com/en-us/library/aa366586(VS.85).aspx ): 

"On Intel x86 computers with more than 2 GB and less than 4 GB of memory,
the GlobalMemoryStatus function will always return 2 GB in the dwTotalPhys
member of the MEMORYSTATUS structure. Similarly, if the total available
memory is between 2 and 4 GB, the dwAvailPhys member of the MEMORYSTATUS
structure will be rounded down to 2 GB. If the executable is linked using
the /LARGEADDRESSAWARE linker option, then the GlobalMemoryStatus function
will return the correct amount of physical memory in both members."



I hope that will help you.

-Stefan


-----Original Message-----
From: Bill Hoffman [mailto:bill.hoffman at kitware.com] 
Sent: Friday, May 02, 2008 5:28 PM
To: Stefan
Cc: cmake at cmake.org
Subject: Re: [CMake] CMake 2.6.0 RC 10 ready for testing

Stefan wrote:
> Perhaps there is a small bug.
> 
> If I build Test with and within Visual Studio 2008 there will be every
time
> the wrong build name "Win32-vs8". It have to be "Win32-vs9".
> 
OK, I see it, that is a bug in Modules/CTest.cmake.

I have checked in a fix:

$ cvs -q diff CTest.cmake
Index: CTest.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CTest.cmake,v
retrieving revision 1.11
diff -r1.11 CTest.cmake
13a14,25
 > # function to turn generator name into a version string
 > # like vs7 vs71 vs8 vs9
 > FUNCTION(GET_VS_VERSION_STRING generator var)
 >   STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" 
NUMBER "${generator}")
 >   IF("${generator}" MATCHES "Visual Studio 7 .NET 2003")
 >     SET(ver_string "vs71")
 >   ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003")
 >     SET(ver_string "vs${NUMBER}")
 >   ENDIF("${generator}" MATCHES "Visual Studio 7 .NET 2003")
 >   SET(${var} ${ver_string} PARENT_SCOPE)
 > ENDFUNCTION(GET_VS_VERSION_STRING)
 >
174,182c186
<       IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
<         SET(DART_CXX_NAME "vs70")
<       ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
<         IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
<           SET(DART_CXX_NAME "vs71")
<         ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
<           SET(DART_CXX_NAME "vs8")
<         ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
<       ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
---
 >       GET_VS_VERSION_STRING("${CMAKE_GENERATOR}" DART_CXX_NAME)

hoffman at CORRIN ~/My Builds/CMake/Modules
$ cvs commit -m "ENH: recognize vs 9 and possible 10 or greater when 
they come out..." CTest.cmake
/cvsroot/CMake/CMake/Modules/CTest.cmake,v  <--  CTest.cmake
new revision: 1.12; previous revision: 1.11

> The TotalVirtualMemory and TotalPhysicalMemory is also wrong. I have 3GB
> Physical Memory, but perhaps that could be a problem with Vista Business.
> 


Not sure what is wrong with the memory...

The code for that is here:
   MEMORYSTATUS ms;
   GlobalMemoryStatus(&ms);

   unsigned long tv = ms.dwTotalVirtual;
   unsigned long tp = ms.dwTotalPhys;
   unsigned long av = ms.dwAvailVirtual;
   unsigned long ap = ms.dwAvailPhys;
   this->TotalVirtualMemory = tv>>10>>10;
   this->TotalPhysicalMemory = tp>>10>>10;
   this->AvailableVirtualMemory = av>>10>>10;
   this->AvailablePhysicalMemory = ap>>10>>10;
   return 1;

If you have a fix great if not, I can live with this in 2.6.0.

Thanks.

-Bill


		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



More information about the CMake mailing list