Building VTK with GL2PS on Windows with MSVC
You need to have MSVC installed. These notes are for MSVC 6.0. The instructions are long but pretty straight forward.
Also note that these instructions mostly apply to VTK 4.2.x. CVS versions of VTK do not require downloading GL2PS separately, since it has been incorporated into the VTK sources. If you are using VTK from CVS or VTK 4.4.x and above (when released) the instructions are essentially the same, except that you do not have to download and build GL2PS separately.
Download packages
Get the latest available stable version of Python from the
Python web site and install it. Python-2.3.2 is fine. Make sure you install Tkinter (Tcl/Tk) that comes bundled with it.
Download and install ActiveTcl with the version as close to the
Python version of Tcl. Look here:
http://aspn.activestate.com/ASPN/Downloads/ActiveTcl/ .
Install the latest stable CMake from
http://www.cmake.org Download GL2PS from
http://www.geuz.org/gl2ps Download the VTK sources from
http://www.vtk.org/get-software.php
Build GL2PS
Untar the GL2PS sources somewhere.
Download the attached 添付ファイル"CMakeLists.txt"のアップロード
file and copy it to the source directory.
Start CMakeSetup and point it to the GL2PS source directory and
your prefered destination directory (you can set it to the same directory).
No need to choose advanced options. Simply hit configure once,
then again and then finally press the OK button.
Start up MSdev and open the generated GL2PS.dsw file (it will be
in the destination directory).
Select the ALL_BUILD classes, select your default build and build the
DLL. Your DLL will now be built in one of the subdirectories of your destination directory. The subdirectory depends on what your default build seeting was.
Build VTK
Download the VTK sources, get the latest CVS or a nightly release.
Untar the sources somewhere.
Click on CMakeSetup that you should have installed.
Set the source directory and destination directory, use a
different destination, since that is a little easier to manage. I'll call the build directory VTK_BUILD.
Select the advanced options checkbox.
Turn on the following options
Shared libraries, Hybrid, GL2PS, Patented, Tcl Wrapping and
Python Wrapping. Turning on Tcl wrapping is not a must but might be useful. Note that if you do not turn on Tcl wrapping, you still need to make sure that the entries for the Tcl and Tk libraries and headers are correctly entered to ensure that the Python-Tk widgets are built.
It should detect the right location and path for Python and
Tcl. It might complain about the python_debug_library, you can ignore it.
Now press the configure button.
After configure has run, edit the GL2PS settings, point the
include directory to the right place and choose the gl2ps.lib that we just built.
Press configure again. The OK button should be activated now.
Press OK.
It is recommended that you have a minimum of 300MByte swap space
or you'll have trouble during the link phase.
Start up MSdev and open the file VTK_BUILD/VTK.dsw.
Click on the ALL_BUILD classes item, go to project/settings and set
the default build to Release (or whatever you want).
Build the project.
Take a break. The build will take a few hours.
Installing GL2PS and VTK
First install VTK for Python by doing the following. Note that currently this works best
if you build VTK using the Release build. This step will install the pure Python files correctly and will copy all the vtk*Python.dll files into the site-packages/vtk_python directory. If that does not happen copy them manually.
cd VTK_BUILD/Wrapping/Python/ python setup.py install
Create a directory where you will put all the VTK dlls, lets call
this DLL_DIR. Now do the following.
cd VTK_BUILD/bin/Release copy vtk*.dll DLL_DIR cd DLL_DIR del vtk*Python.dll del vtk*TCL.dll
Copy the gl2ps.dll that you built into DLL_DIR.
Add DLL_DIR to system environments PATH.
Now untar MayaVi to say MAYAVI_DIR, test it like so:
-
cd MAYAVI_DIR python mayaviIf that works, you are all set and can do this:
python setup.py install --record=install.log
You should be all set now. You should be able to use VTK and MayaVi from Python.
MayaVi Wiki