[CMake] [Insight-developers] 64 bit build detection

BRM bm_witness at yahoo.com
Thu Jun 18 09:11:28 EDT 2009


Of course the simpler solution - to include iPhone would be to add ARM detection into that list...
Nothing says you couldn't expand the list, my guess is that it was just a first wack at the list...



----- Original Message ----
From: Michael Wild <themiwi at gmail.com>
To: Sean McBride <sean at rogue-research.com>
Cc: Michael Jackson <mike.jackson at bluequartz.net>; cmake Mailing List <cmake at cmake.org>
Sent: Thursday, June 18, 2009 1:44:53 AM
Subject: Re: [CMake] [Insight-developers] 64 bit build detection


On 18. Jun, 2009, at 0:49, Sean McBride wrote:

> On 6/14/09 10:05 PM, Michael Wild said:
> 
>> On Mac OS X one shouldn't do this kind of detection during configure
>> step, because as has been mentioned a single file can be compiled
>> multiple times for different architectures during one single compiler
>> invocation. The size of void* and even endianness can change. It is
>> preferable to have a central config.h.in (or similar) containing
>> something like this:
>> 
>> #if defined(__APPLE__)
>> #  if defined(__i386__)
>> #    undef HAVE_64_BIT
>> #    undef HAVE_BIG_ENDIAN
>> #  elif defined(__ppc__)
>> #    undef HAVE_64_BIT
>> #    define HAVE_BIG_ENDIAN
>> #  elif defined(__x86_64__)
>> #    define HAVE_64_BIT
>> #    undef HAVE_BIG_ENDIAN
>> #  elif defined(__ppc64__)
>> #    define HAVE_64_BIT
>> #    define HAVE_BIG_ENDIAN
>> #  else
>>     // oops
>> #    error "Unknown architecture!"
>> #  endif
>> #else
>> #  cmakedefine HAVE_64_BIT
>> #  cmakedefine HAVE_BIG_ENDIAN
>> #endif
> 
> I agree with Hendrik that such things are better done with types like
> uin32_t, etc.  The quoted stuff above will fail with OS X running on ARM
> (ie iPhone).
> 

Above code for sure is far from ideal or perfect. But sometimes one inherits a code which relies on such details, so here is one relatively simple way to deal with it.  And I somehow doubt that there are many codes running both on x86/ppc and iPhone... Besides, uint32_t and related are not present on Windows, so using them is going to break the code there.

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list