[vtkusers] FIx for compilation of VTK using X11 under Mac OS X Leopard

Benoit Desjardins bd_md_phd at mac.com
Wed Jan 23 08:50:03 EST 2008




There are still some OpenGL bugs in Mac OS X Leopard preventing proper  
compilation of VTK 5.0.3 (and the CVS version).  A workaround for  
Paraview was posted on the mailing list, and based on it I was able to  
create a fix for VTK.  The Paraview fix is:

http://public.kitware.com/pipermail/paraview/2007-October/006141.html


The fix for VTK is as follow (assuming something like that has not  
been posted already):

Modify the Top Level CmakeLists.txt file in the IF(VTK_USE_RENDERING)  
section as follow:

insert the lines:
IF ( OSX_LEOPARD_OPENGL_FIX )
   SET (CMAKE_EXE_LINKER_FLAGS "-Wl,-dylib_file,/System/Library/ 
Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/ 
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
   SET (CMAKE_SHARED_LINKER_FLAGS "-Wl,-dylib_file,/System/Library/ 
Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/ 
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
ENDIF ( OSX_LEOPARD_OPENGL_FIX )

and just before the IF(VTK_USE_RENDERING) section, insert the line:
OPTION(OSX_LEOPARD_OPENGL_FIX "Adds Linker arguments needed to  
correctly select the X11 OpenGL Library" TRUE)

so that the end result is:

#-----------------------------------------------------------------------------
# Configure OpenGL support.

OPTION(OSX_LEOPARD_OPENGL_FIX "Adds Linker arguments needed to  
correctly select the X11 OpenGL Library" TRUE)
IF(VTK_USE_RENDERING)
# At the moment CMake's FindOpenGL considers OpenGL should be found
# in the framework version on OSX. This is a reasonable assumption for
# few people are going to use X. The module warns that if X is to be
# used, one has to set the libs and include dir manually, which is
# exactly what we are going to do below.
IF(APPLE AND VTK_USE_X)
   FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
     /usr/X11R6/include)
   FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
     /usr/X11R6/include)
   FIND_LIBRARY(OPENGL_gl_LIBRARY NAMES GL MesaGL
     PATHS /usr/lib /usr/local/lib /usr/X11R6/lib)
   FIND_LIBRARY(OPENGL_glu_LIBRARY NAMES GLU MesaGLU
     PATHS ${OPENGL_gl_LIBRARY} /usr/lib /usr/local/lib /usr/X11R6/lib)
	 IF ( OSX_LEOPARD_OPENGL_FIX )
        SET (CMAKE_EXE_LINKER_FLAGS "-Wl,-dylib_file,/System/Library/ 
Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/ 
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
        SET (CMAKE_SHARED_LINKER_FLAGS "-Wl,-dylib_file,/System/ 
Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/ 
System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/ 
libGL.dylib")
	 ENDIF ( OSX_LEOPARD_OPENGL_FIX )
ENDIF(APPLE AND VTK_USE_X)
FIND_PACKAGE(OpenGL)
ENDIF(VTK_USE_RENDERING)

VTK_PREPARE_CMAKEDEFINE("" OPENGL_LIBRARY VTK_USE_OPENGL_LIBRARY)

#-----------------------------------------------------------------------------

It worked very well for me.  I use VMTK which requires the X11 version  
of VTK.
There are no problems in compiling the Carbon or Cocoa versions of VTK  
on
the Mac OS X Leopard.

Benoit Desajrdins



--------------------------------------------------------------
Benoit Desjardins, MD, PhD
Assistant Professor of Radiology
Director, Cardiovascular MR/CT Research Lab
Department of Radiology
University of Michigan
1500 E. Medical Center Dr, B2-A209R
Ann Arbor, MI 48109-0030
USA

Phone:    +1 (734) 647-3037
FAX:      +1 (734) 764-2412
Pager:    +1 (734) 566-5847
iPhone:    +1 (734) 730-7258
email:    benoitd at umich.edu
web:      http://cvmrct.med.umich.edu
video:    bd_md_phd at mac.com (iChat or AIM)
--------------------------------------------------------------






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080123/52690ff9/attachment.htm>


More information about the vtkusers mailing list