[vtkusers] #Defines for Big or Little Endian

Mike Jackson mike.jackson at imts.us
Fri Sep 1 14:32:28 EDT 2006


On 9/1/06 2:22 PM, "Sean McBride" <sean at rogue-research.com> wrote:

> On 2006-09-01 12:03, Mike Jackson said:
> 
>> As a follow up to my own post I think that in the vtkConfigure.h on OS X I
>> think that there needs to be something like:
>> 
>> /* Byte order.  */
>> #if defined(__i386__) && defined(__GNUC__)
>>    #undef VTK_WORDS_BIGENDIAN
>> #elif defined(__ppc__) && defined(__GNUC__)
>>    #define VTK_WORDS_BIGENDIAN
>> #else
>> #error Do not know the endianess of this architecture
>> #endif
>> 
>> At the top. This is pretty much what Apple uses in there own files. Testing
>> is required.. Maybe put this into the next version of VTK to help out those
>> of us trying to compile universal binaries?
> 
> Well, this is all related to bug 3059. :)  Which I encourage you to
> read.  <http://www.vtk.org/Bug/bug.php?op=show&bugid=3059>
> 
> I would dearly like for vtk to stop checking the endianess of the
> machine that's doing the building.  But in order for that to happen, we
> need a way to know the endianess of the target.  All compilers on Mac OS
> set up the  __LITTLE_ENDIAN__ and __BIG_ENDIAN__ #defines, but other
> compilers on other platforms don't.  So, like you say, we could hack it
> to #undef and redefine VTK_WORDS_BIGENDIAN on Mac OS.
> 
> I'm willing to do it and test it, but I don't know enough about CMAKE
> and how vtkConfigure.h is generated to get any farther.
> 
> If anyone can help, please update bug 3059. :)
> 
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
> 
> 

Well, we can hack it now by changing the vtkConfigure.h.in which is at the
top level of the vtk source distribution. We could put some sort of IF
(APPLE) thing around the part that I describe above.

Might work... Just depends when and how that vtkConfigure.h.in is used
during the configuration process and build process.

We could start special casing the Cmake files for VTK to get rid of the
tryCompile for Apple machines and go with the __LITTLE_ENDIAN__ and
__BIG_ENDIAN__ #defines instead. This seems a bit of a kludge to me though..

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services







More information about the vtkusers mailing list