[vtkusers] Building on Mac OS 10.3.2 tips

David Bernstein dhbernstein at earthlink.net
Fri Mar 5 21:11:29 EST 2004


Hi All, After messing around a bit and getting help from a number of 
you I got vtk working with a C++ project in XCode.  I'm posting this 
little howto for other newbies who will search the archives in the 
future.

The OS is 10.3.2, XCode version 1.1, VTK version 4.2.3.

i) Install source code.  I put it in /Applications, probably not the 
best place

ii) Install CMake, the version I have is 1.8.3

iii) In the vtk-src-unix directory run cmake -i

iv) In the options which follow make sure you choose shared libraries, 
turn carbon off and cocoa on.

v) In the CMakeCache.txt file you may or may not have to modify the line

OPENGL_gl_LIBRARY:STRING=-framework OpenGL

to

OPENGL_gl_LIBRARY:STRING=-framework AppKit -framework OpenGL

You may also have to turn this option ON
VTK_USE_SYSTEM_ZLIB:BOOL=ON

I was messing around with the file and this is the state it was in when 
things began working

vi) Run make.  This should produce a bunch of .dylib files in 
vtk-src-unix/bin

vii) In your XCode project, go to Project->New build phase and add the 
frameworks and libraries phase to the appropriate
target.  My simple test code was an empty project with a bsd shell 
target.

viii) Add the libraries libvtkCommon, libvtkFiltering, libvtkGraphics, 
libvtkImaging, libvtkParallel, libvtkRendering, and libvtkIO
to your project.  You do this by just dragging them into the project, 
XCode will automatically add them to the Frameworks and Libraries 
folder.  I don't know if all these libraries are necessary, this is 
just the state my project was in when it started working.
You may not have the parallel library if you didn't turn on this option 
in CMake.  I'm not sure it's necessary, probably not, but
I did it anyway.

ix) Add the frameworks AppKit.framework, OpenGL.framework, 
AGL.framework to the project using Project->Add Frameworks.

x) Now you should be able to build and link your project.

That's a little cursory, but I hope it saves someone some time.

Dave Bernstein




More information about the vtkusers mailing list