[vtkusers] Building VTK for XDarwin

Sander Niemeijer niemeijer at science-and-technology.nl
Wed Feb 27 04:27:06 EST 2002


Marcel is right. I had the same problems. However I fixed them in a 
different form that shouldn't break compilation for Quartz (or any other 
platform) if you want to use the same sourcetree.
First of all if you want to build the quartz version make sure that in 
the cmake configuration you set VTK_USE_QUARTZ to ON en VTK_USE_X to 
OFF. And of course if you want to build the version for X set them vice 
versa.
Now change two sections (shouldn't be too hard to see which ones :-) in 
Rendering/CMakeLists.txt to:
---
IF(UNIX)
   IF(NOT WIN32)
     IF(NOT APPLE)
       SOURCE_FILES ( Rendering_SRCS
                    vtkXImageWindow
                    vtkXRenderWindowInteractor
                    vtkXTextMapper)
     ELSE (NOT APPLE)
       IF (NOT VTK_USE_QUARTZ)
         IF (VTK_USE_X)
           SOURCE_FILES ( Rendering_SRCS
                        vtkXImageWindow
                        vtkXRenderWindowInteractor
                        vtkXTextMapper)
         ENDIF (VTK_USE_X)
       ENDIF (NOT VTK_USE_QUARTZ)
     ENDIF(NOT APPLE)
   ENDIF(NOT WIN32)
ENDIF(UNIX)
---
and
---
ELSE (WIN32)
   IF (APPLE)
     IF (VTK_USE_QUARTZ)
       SET(HAVE_OPENGL_SRCS ON)
       SOURCE_FILES(RenderingOpenGL_SRCS
                    vtkQuartzImageWindow
                    vtkQuartzTextMapper
                    vtkQuartzRenderWindowInteractor
                    vtkQuartzRenderWindow
                    vtkQuartzWindow
                    vtkQuartzGLView)
       WRAP_EXCLUDE_FILES(vtkQuartzGLView
                          vtkQuartzWindow)
       LINK_LIBRARIES (${OPENGL_LIBRARY} )
       IF(MESA_OS_LIBRARY)
         LINK_LIBRARIES( ${MESA_OS_LIBRARY} )
       ENDIF(MESA_OS_LIBRARY)

       ADD_LIBRARY(vtkRendering Rendering_SRCS RenderingOpenGL_SRCS)
     ELSE (VTK_USE_QUARTZ)
       IF (VTK_USE_X)
         IF (OPENGL_LIBRARY)
           SET(HAVE_OPENGL_SRCS ON)

           SOURCE_FILES(RenderingOpenGL_SRCS
                        vtkOpenGLImageWindow
                        vtkXOpenGLRenderWindow
                        vtkXOpenGLTextMapper)
           ABSTRACT_FILES(
                          vtkXImageWindow
                          vtkXTextMapper)
           LINK_LIBRARIES (${OPENGL_LIBRARY} )
           IF(MESA_OS_LIBRARY)
             LINK_LIBRARIES( ${OSMESA_LIBRARY} )
           ENDIF(MESA_OS_LIBRARY)
         ENDIF (OPENGL_LIBRARY)
       ENDIF (VTK_USE_X)
     ENDIF (VTK_USE_QUARTZ)
   ELSE (APPLE)
---
This makes sure that the VTK_USE_X and VTK_USE_QUARTZ options do what 
you want and link in their respective objectfiles (with Quartz ruling in 
favor of X if both options are set to ON).

Then in the following files (in the Rendering directory):
vtkOpenGLTexture.cxx
vtkOpenGLActor.cxx
vtkOpenGLCamera.cxx
vtkOpenGLImageActor.cxx
vtkOpenGLImageMapper.cxx
vtkOpenGLImager.cxx
vtkOpenGLLight.cxx
vtkOpenGLPolyDataMapper.h
vtkOpenGLPolyDataMapper2D.cxx
vtkOpenGLProperty.cxx
vtkOpenGLRenderWindow.h
vtkOpenGLRenderer.cxx
vtkOpenGLStateCache.h
vtkOpenGLVolumeRayCastMapper.cxx
vtkOpenGLVolumeRayCastMapper.h
vtkOpenGLVolumeTextureMapper2D.cxx
change ALL occurances of __APPLE__ to VTK_USE_QUARTZ (we only want to 
include the OpenGL/gl.h if we are compiling for Quartz rendering)

Since all these changes are in such a way that it shouldn't break 
compilation/execution for other platforms they might be a welcome 
addition to the official VTK repository. Is there anybody who can give 
me some information on whether this should be done, and if so, how?

Regards,
Sander Niemeijer

On Wednesday, February 27, 2002, at 02:07 AM, Marcel Prastawa wrote:

> Robert Brown wrote:
>> I get an error building VTK for XDarwin -- ld: Undefined symbols:
>
> [snip]
>
>> Compiling for Quartz works fine, but not X.  Any suggestions?
>
> Robert,
>
> You need to make sure that you are not linking against Apple's OpenGL 
> library and link to /usr/X11R6/lib/libGL.dylib instead.
>
> If I recall correctly, I needed to modify several files in the 
> Rendering directory. In CMakeLists.txt you may need to add 
> vtkXOpenGL... in the APPLE section. Also, in some of the source files, 
> you need to change #include <OpenGL/gl.h> to #include <GL/gl.h> inside 
> the #ifdef __APPLE__ blocks.
>
> I did this quite some time ago, so all this may not apply to the 
> current version. If you are interested, I have the 4.0 binaries for 
> XDarwin ( a bit old). One warning though, VTK on XDarwin is slow (no 
> hardware acceleration).
>
> Marcel
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic. 
> Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list