[vtkusers] Instructions for Compiling VTK 5.0 with Java Wrappings on OS X 10.4.X

Vivek Dwivedi vivekd at mail630.gsfc.nasa.gov
Mon Jul 3 10:22:19 EDT 2006


VTK Users:

The following instruction set allows MAC OS X tiger users to compile  
VTK 5.0 with Java wrappings.  This instruction set would not have  
been possible without the help of Mike Jackson.  Thanks Mike!!!

Folks let me know if there are any mistakes with the instructions or  
further clarification is necessary.

Thanks:

-Vivek

STEP 1:  Downloading Software



1. Java:  Make sure your JAVA is update go to your terminal app and  
type:

java -version



You should have at least build 1.5 patch 2



2.  Download the CMAKE Darwin Universal binary (Tiger only  
installer ) from:

http://www.cmake.org/HTML/Download.html



Install CMAKE by double clicking on the icon



3. Download the VTK source from:

  http://vtk.org/get-software.php



(Note:  The Latest Release (5.0.0) does not allow the java wrapping  
to work you need to get the source code via the CVS source-code  
repository)



Open the terminal app.  cd to /Users/user-name

type the following:



cvs -d :pserver:anonymous at public.kitware.com:/cvsroot/VTK login
(respond with password vtk)



cvs -d :pserver:anonymous at public.kitware.com:/cvsroot/VTK checkout VTK

You will see the source code and corresponding folders downloading in  
to a new folder called VTK

cd to that folder in my case the folder path is /Users/vivekd/VTK

STEP 2: Compiling VTK

1) Type ccmake ../vtk

2) Type c

3) Edit the list of options with the following:

BUILD_EXAMPLES                                                        
ON                                                                       
                                                       
BUILD_SHARED_LIBS                                                     
ON                                                                       
                                                       
CMAKE_BACKWARDS_COMPATIBILITY                 
2.4                                                                      
                                                       
CMAKE_BUILD_TYPE                                                         
                                                                         
                CMAKE_INSTALL_PREFIX                              / 
usr/ 
local                                                                    
                                                
CMAKE_OSX_ARCHITECTURES                       
ppc                                                                      
                                                       
CMAKE_OSX_SYSROOT                /Developer/SDKs/ 
MacOSX10.4u.sdk                                                          
                                       
VTK_DATA_ROOT                                                         
VTK_DATA_ROOT- 
NOTFOUND                                                                 
                                         
VTK_USE_CARBON                                                        
OFF                                                                      
                                                       
VTK_USE_COCOA                                                         
OFF                                                                      
                                                       
VTK_USE_FFMPEG_ENCODER                                    
OFF                                                                      
                                                       
VTK_USE_PARALLEL                                                      
OFF                                                                      
                                                       
VTK_USE_RENDERING                                  
ON                                                                       
                                                       
VTK_USE_RPATH                                                         
ON                                                                       
                                                       
VTK_USE_X                                                             
ON                                                                       
                                                       
VTK_WRAP_JAVA                                                         
ON                                                                       
                                                       
VTK_WRAP_PYTHON                                           
OFF                                                                      
                                                       
VTK_WRAP_TCL                                                         OFF

4) Type c

5) Type t for advanced options:  Change the following

JAVACOMMAND

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java



JAVA_ARCHIVE

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/jar



JAVA_AWT_INCLUDE_PATH

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_AWT_LIBRARY

-framework JavaVM -framework JavaEmbedding



JAVA_COMPILE

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/javac



JAVA_INCLUDE_PATH

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_INCLUDE_PATH2

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_RUNTIME

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java

OPENGL_INCLUDE_DIR:PATH=/usr/X11R6/include



OPENGL_gl_LIBRARY:STRING=-framework OpenGL



OPENGL_glu_LIBRARY:STRING=-framework AGL

6) Type c then Type g

STEP 3:  Editing build.make

Go to  VTK/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/
Using Text edit open the build.make file
Change the following:
cd /Users/vivekd/vtk/Wrapping/Java && /System/Library/Frameworks/ 
JavaVM.framework/Versions/1.5/Commands/javac -classpath /Users/vivekd/ 
vtk/java/vtk/.. -d /Users/vivekd/vtk/java/vtk/.. /Users/vivekd/vtk/ 
java/vtk/vtkBuildAllDriver.java

to

cd /Users/vivekd/vtk/Wrapping/Java && /System/Library/Frameworks/ 
JavaVM.framework/Versions/1.5/Commands/javac -J-Xmx256m -classpath / 
Users/vivekd/vtk/java/vtk/.. -d /Users/vivekd/vtk/java/vtk/.. /Users/ 
vivekd/vtk/java/vtk/vtkBuildAllDriver.java

STEP 4:  MAKE

At the command prompt in your terminal application go to the VTK  
directory in my case it is at /Users/vivekd/VTK

Type make and wait, on a MAC G5 it takes about 25 minutes to build  
the application.



STEP 5:  Editing or creating .tcshrc

My shell is the T shell.

You need to tell java where your .dylib and vtk.jar file is located

1) If you don’t have a .tcshrc file type emacs .tcshrc file

2) Add the following lines

setenv DYLD_LIBRARY_PATH /Users/vivekd/VTK/bin

setenv CLASSPATH .:/Users/vivekd/VTK/bin/vtk.jar

don’t forget the .: before the path to the vtk.jar file

3) exit emacs by typing ctrl x then ctrl c it will ask you if you  
want to save type y and hit return

4) at the command prompt type source .tcshrc

5) check to see if the paths were added by typing env

  STEP 6:  Testing with an example

Make sure you are in X11

Go to the Java examples which are located at /Users/vivekd/VTK/ 
Examples/Tutorials/Step*/Java

Type javac Step*.java

Type java Step*

* = 1,2,3,4,5













  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060703/2bd5963c/attachment.htm>


More information about the vtkusers mailing list