git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4313 626c5289-ae23-0410-ae9c-e8d60b6d4f22
136 lines
3.9 KiB
Text
136 lines
3.9 KiB
Text
Wrappers for the Visualization Toolkit (VTK).
|
|
|
|
VTK must be installed first.
|
|
|
|
VTK Installation Instructions
|
|
-----------------------------
|
|
|
|
Warning to GCC users:
|
|
|
|
GCC version 3 cannot be used to compile VTK; you may check the version
|
|
of gcc with "gcc -version". GCC version 3 is the default compiler on
|
|
recent cygwin systems, and is used on some other newer systems as
|
|
well. Be sure that you have another compiler or GCC version 2 on your
|
|
system (for example, the package "gcc2" on cygwin). You will specify
|
|
your other compiler on *ALL* commands that start with "make". For
|
|
example, if you have the "gcc2" package on cygwin, when you get to the
|
|
following VTK build instruction:
|
|
|
|
make VTKVER=40 vtkcygwin
|
|
|
|
use instead:
|
|
|
|
make VTKVER=40 CC="gcc-2" CXX="c++-2" LDSHARED="gcc-2 -shared" CXXSHARED="c++-2 -shared" vtkcygwin
|
|
|
|
On non-cygwin system, the VTK build instruction:
|
|
|
|
make VTKVER=40 vtkunix
|
|
|
|
would be replaced by:
|
|
|
|
make VTKVER=40 CC="<path to non-gcc3 C compiler>" CXX="<path to non-gcc3 C++ compiler>" LDSHARED="<path to non-gcc3 C shared linker>" CXXSHARED="<path to non-gcc3 C++ shared linker>" vtkunix
|
|
|
|
and so on ...
|
|
|
|
GENERAL NOTE: At this moment, Common/vtkViewport.o is not included in
|
|
libCommon.a for VTK 4.0. This causes problems and is an obvious
|
|
mistake. So the Makefile looks for vtkViewport.o in the
|
|
vtk40/VTK/Common directory when building this SWIG example. So only
|
|
Method 3 is an option right now (or Method 2 if you copy vtkViewport.o
|
|
to .../chicken/vtk/vtk40/VTK/Common/).
|
|
|
|
|
|
-- Method 1 (Win32 with mingw) --
|
|
|
|
Download vtk40Core.exe and vtkCpp.exe from
|
|
http://public.kitware.com/VTK/get-software.php.
|
|
|
|
Run vtk40Core.exe and install to wherever (I will assume you
|
|
installed to the default "C:\Program Files\vtk4.0").
|
|
|
|
Run vtkCpp.exe and install to the same directory you install
|
|
vtk40Core.
|
|
|
|
Before building this SWIG example, set
|
|
VTKHOME=C:\Program Files\vtk4.0
|
|
|
|
and then run "make" in this chicken/vtk directory using Mingw32 (that
|
|
is, run Cygwin shell, and set the PATH to .../mingw/bin).
|
|
|
|
-- Method 2 --
|
|
|
|
Download a source archive (either vtk40Src.zip or vtk40Src.tar.gz)
|
|
from http://public.kitware.com/VTK/get-software.php and follow the
|
|
instructions using "README.html" (which is inside vtk40Src).
|
|
|
|
-- Method 3 (Unix or Cygwin) --
|
|
|
|
If you do not have "cmake" installed on your system, do the following
|
|
and it will be installed in chicken/vtk/cmakelocal:
|
|
|
|
Download
|
|
|
|
cmake-1.6.2.tar.gz from
|
|
http://www.cmake.org/HTML/Download.html
|
|
|
|
and place it in this chicken/vtk directory.
|
|
|
|
Type:
|
|
make CMAKEVER=cmake-1.6.2 cmake
|
|
PATH=${PWD}/cmakelocal/bin:$PATH
|
|
export PATH
|
|
|
|
If you do not have "vtk" installed on your system, do the following
|
|
and it will be installed in chicken/vtk/vtklocal:
|
|
|
|
Download
|
|
|
|
vtk40Src.tar.gz from
|
|
http://public.kitware.com/VTK/get-software.php
|
|
|
|
and place it in this chicken/vtk directory.
|
|
|
|
Type (for cygwin):
|
|
make VTKVER=40 vtkcygwin
|
|
|
|
(for everyone else):
|
|
make VTKVER=40 vtkunix
|
|
|
|
VTK SWIG Example
|
|
----------------
|
|
|
|
Make sure that VTK is installed. If you followed the previous
|
|
instructions, then VTK will be installed in .../chicken/vtk/vtklocal.
|
|
The following instructions will assume ${PWD}/vtklocal; if you
|
|
installed VTK elsewhere, use the correct installation path
|
|
(ie. /usr/local instead of ${PWD}/vtklocal).
|
|
|
|
First, test to make sure VTK is working ...
|
|
|
|
cygwin:
|
|
make EXTRALIBS="-lgdi32 -lopengl32" VTKHOME=${PWD}/vtklocal c
|
|
./c-sphere.exe
|
|
./c-quadric.exe
|
|
|
|
other Unixes:
|
|
make EXTRALIBS="-L/usr/X11R6/lib -lGL -lGLU -lGLw" VTKHOME=${PWD}/vtklocal c
|
|
./c-sphere
|
|
./c-quadric
|
|
|
|
|
|
You should see a blue sphere that you can manipulate with the mouse
|
|
buttons.
|
|
|
|
Second, test to make sure the SWIG wrappers can be generated and work
|
|
for VTK ...
|
|
|
|
cygwin:
|
|
make EXTRALIBS="-lgdi32 -lopengl32" VTKHOME=${PWD}/vtklocal
|
|
./vtk test-vtk-sphere.scm
|
|
./vtk test-vtk-quadric.scm
|
|
|
|
other Unixes:
|
|
make EXTRALIBS="-L/usr/X11R6/lib -lGL -lGLU -lGLw" VTKHOME=${PWD}/vtklocal
|
|
./vtk test-vtk-sphere.scm
|
|
./vtk test-vtk-quadric.scm
|
|
|