Making Development Environment without compiling source distribution

From KitwarePublic
Jump to navigationJump to search

The tedious compiling from VTK source is gone by the help of ParaView 3.8.0 developer distribution. By simply installing ParaView 3.8.0 developer distribution, we can develop C++ program with VTK, run VTK python script in external python interpreter, and extending ParaView.

This document is based on Windows 32bit OS, and ParaView 3.8.0 developer distribution(ParaView-Development-3.8.0-Win32-x86.exe). The compiler should be Microsoft Visual Studio 2008 SP1 (MSVC 2008), which is used in compiling the distribution.

Prerequisites

Three prerequisites are DirectX SDK, Qt, and Python distributions. The tested versions are

- MS DirectX SDK (June 2010)

- Qt 4.6.3 (qt-win-opensource-4.6.3-vs2008.exe [1])

- Python 2.6.5 (python-2.6.5.msi [2])


Plan for directory tree

At the end of setup, we can get the following directory tree.

- c:/ParaView/3.8.0/Dev : Installation direction of ParaView developer distribution

- c:/ParaView/3.8.0/SRC : ParaView source directory

- c:/ParaView/3.8.0/ParaViewData : ParaView sample data directory

- c:/ParaView/3.8.0/VTKData : VTK sample data directory


Setup procedures

The setup procedure are as followings:


STEP 1. Download ParaView 3.8.0 developer distribution, source distribution, data and help files


- ParaView-Development-3.8.0-Win32-x86.exe, ParaView-3.8.0.zip, ParaViewData-3.8.0.zip, ParaView3-html.tar.gz [3]

- vtkdata-5.6.0.zip, vtkDocHtml-5.6.0.tar.gz [4]


STEP 2. Install ParaView-Development-3.8.0-Win32-x86.exe to C:/ParaView/3.8.0/Dev


STEP 3. Unzip ParaView-3.8.0.zip to c:/ParaView/3.8.0/SRC


STEP 4. Unzip ParaViewData-3.8.0.zip to c:/ParaView/3.8.0/ParaViewData


STEP 5. Unzip vtkdata-5.6.0.zip to c:/ParaView/3.8.0/VTKData


The directory tree is completed. Next some cmake setting file should be edited for the prerequisites. In VTKConfig.cmake, VTKConfigQt.cmake and VTKLibraryDepends.cmake, which can be found in Dev/Lib/ParaView-3.8.0, modify followings:

- C:/Python/Python26-x86 -> C:/Python26

- C:/qt/qt-4.6.2-x86 -> C:/Qt/4.6.3

- C:/Program Files (x86)/Microsoft DirectX SDK (February 2010) -> C:/Program Files/Microsoft DirectX SDK (June 2010)


Noting that '/' is used, not '\'.

Setup environment variables

In order for running ParaView client, and external python interpreter, we need two environment variables, PATH and PYTHONPATH. PATH should include the dll or exe file directories of python, Qt, ParaView and VTK. PYTHONPATH is needed for executing VTK python or ParaView python scripts in external python interpretor, which should includes the directories of python specific .pyd files and pure python packages. Followings are batch files for setup environment variables:


setenv.bat


@set PATH=c:\python26;c:\Qt\4.6.3\bin;c:\ParaView\3.8.0\Dev\BIN;%PATH%

@set PYTHONPATH=c:\ParaView\3.8.0\SRC\VTK\Wrapping\Python;c:\ParaView\3.8.0\Dev\LIB\paraview-3.8;%PYTHONPATH%


Now simply VTK python scripts can be run in console as following


setenv.bat

python test.py



Making local .chm help

In order to make .chm help file, HTML Help Workshop is needed. First, extract vtkDocHtml-5.6.0.tar.gz to temporary directory. Then type "hhc index.hhp" in console. index.chm is created. Rename it VTK-5.6.0.chm.

For ParaView help, trace same procedure for ParaView3-html.tar.gz.


Running CMake for C++ program

In making C++ program with VTK or extending ParaView, we should prepare CMakeLists.txt and run CMake for preparing project file. When using VTK, VTK_DIR cache in cmake should be set to "c:\ParaView\3.8.0\Dev\LIB\paraview-3.8". When using ParaView, PARAVIEW_DIR should be set to "c:\ParaView\3.8.0\Dev"

Limitations

Because ParaView developer distribution do not provide debug library, we can not debug into VTK and ParaView source. In addition, Debug build target is sometimes crushed. Try RelWithDebInfo build target instead of Debug build.

Dual 32/64bit development environment

If we have Windows 64 bit OS, we can setup the environment for developing both 32 and 64 bit applications. The directory trees may be as followings


The directory tree for prerequisites

- DirectX SDK  : both 32 and 64 versions are installed

- Python

C:\Python\2.6.5\Win32 : 32 bit install directory

C:\Python\2.6.5\Win64 : 64 bit install directory

- Qt

C:\Qt\4.6.3\Win32 : 32 bit install directory

C:\Qt\4.6.3\Win64 : 64 bit install directory ( compiled from source )


Noting that Qt 64 bit version should compiled by the source. It takes about 3 hours.


The directory tree for ParaView :

C:\ParaView\3.8.0\SRC

C:\ParaView\3.8.0\VTKData

C:\ParaView\3.8.0\ParaViewData

C:\ParaView\3.8.0\Dev\Win32

C:\ParaView\3.8.0\Dev\Win64