[vtkusers] Universal Binary of vtk on Mac OS X... initial investigations...

Sean McBride sean at rogue-research.com
Thu Feb 16 11:43:41 EST 2006


On 2006-02-16 09:31, David Cole said:

>Unfortunately, I believe the short answer to your question is "yes"...

Doh! :)

>The longer answer:
>CMake system introspection and TRY_COMPILE functionality are great for 
>helping to build code that compiles everywhere, but has the unfortunate 
>side effect of building in assumptions that the target platform is the 
>same as the build platform.

That's exactly the assumption I'm worried about.  Would you say it is
widely assumed by cmake users?
 
>You'd have to dig deeper to see what TRY_COMPILE results are actually 
>important in terms of building the two different flavors of executable 
>for the two different Mac architectures. It may be limited to a handful 
>of settings (like the "endian-ness") that could be primed in the CMake 
>cache prior to the first configure (thereby avoiding the corresponding 
>TRY_COMPILE steps). Ideally, *all* TRY_COMPILE steps should be avoided 
>for cross-compiling.
>
>In order to do this effectively, I would recommend building VTK with 
>"identical" settings on a PPC mac and also on an Intel mac and then 
>comparing the resulting build trees... The differences should yield some 
>clues about what settings need to be forced for a cross-compile.

Well, first let me say that I know nothing about cmake, only enough to
use it to build vtk.  I don't know what "TRY_COMPILE" is for example.

Anyway, I looked in vtk's CMakeLists.txt and found "VTK_WORDS_BIGENDIAN"
which I assume is set by testing the build machine.  Then I searched the
VTK source, and it is used in several places in #ifdef statements.  So
indeed this is exactly the invalid assumption I feared.

But I'm not sure what to propose instead.  Checking endian-ness at
runtime is in general not acceptable since for performance-critical code
you may want to know at compile time.  Apple's gcc and Intel's mac
compiler automatically #define __BIG_ENDIAN__ or __LITTLE_ENDIAN__, but
this is not necessarily true of other compilers.  Any ideas?

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the vtkusers mailing list