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

David Cole david.cole at kitware.com
Thu Feb 16 09:31:12 EST 2006


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

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.

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.

You are the brave pioneer - let me know if you'd recommend any source 
code changes in VTK to support this effort.


Good luck,
David Cole


Sean McBride wrote:

>Hi all,
>
>I've been looking at getting cmake and vtk to build as Universal
>Binaries on Mac OS X.  (A Universal Binary is a _single_ executable file
>that has both PowerPC and Intel object code, and so runs natively on
>both types of Mac).
>
>Building something as universal is pretty easy, at least in the sense
>that it only takes a few parameters to gcc.  It's hard in the sense that
>you must be sure you write your code in a portable way.
>
>Now obviously vtk is very portable, but I worry about something: when I
>build vtk, I see output like this:
>
>-- Check size of int
>-- Check size of int - done
>-- Check if the system is big endian
>-- Check if the system is big endian - big endian
>
>The size of int and endianess of the _build computer_ is unimportant. 
>My build computer may be big endian, but if I'm building as universal
>then I'm building for both big and little cpus.
>
>Does vtk actually use this information?  That is, does it assume that
>the build computer is of the same architecture I am building _for_?
>
>Thanks!
>
>  
>



More information about the vtkusers mailing list