[vtk-developers] Re: VTK Python Installation [was: VTK 5.0 branch in mid-August]

Sander Niemeijer niemeijer at science-and-technology.nl
Mon Aug 8 10:39:38 EDT 2005


On vrijdag, aug 5, 2005, at 20:44 Europe/Amsterdam, Prabhu Ramachandran  
wrote:

>     Sander> Now that you mention it, I still have a question about
>     Sander> this TkWidgets library.  Is it maybe possible to implement
>     Sander> a way to turn off the Tk dependent parts when building VTK
>     Sander> with Python wrapping? (this only affects the widgets,
>     Sander> right?)
>
> AFAIK, this library is not built if the TK_LIBRARY is not defined.
> Look in Rendering/CMakeLists.txt::
>
> IF (VTK_WRAP_PYTHON)
>   IF (TK_LIBRARY)
>      IF(NOT VTK_USE_COCOA)
>        SET(RenderingPythonTkWidgets_SRCS
>           vtkTkWidgetsInit.cxx
>           vtkTkRenderWidgetPython.cxx
>           vtkTkImageViewerWidgetPython.cxx
>           )
> [...]
>
> So, I think if you turn on VTK_WRAP_PYTHON but don't set the
> TK_LIBRARY this should never be built.
>
> Could you test this and see?

On Windows (Using VTK from CVS (today) and CMake 2.0.6) I do the  
following:

CALL "C:\Program Files\Microsoft Visual Studio .NET  
2003\Common7\Tools\vsvars32.bat"
"C:\CMake\bin\cmake.exe" -G"Visual Studio 7 .NET 2003"  
-DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON  
-DVTK_WRAP_PYTHON:BOOL=ON  
-DPYTHON_LIBRARY="C:\Python23\libs\python23.lib"  
-DPYTHON_INCLUDE_PATH="C:\Python23\include"  
-DPYTHON_EXECUTABLE="C:\Python23\python.exe" ../VTK

And this gives:

================================================================
....
-- Check size of unsigned char
-- Check size of unsigned char - done
-- Performing NetCDF Test HAVE_ST_BLKSIZE
-- Performing NetCDF Test HAVE_ST_BLKSIZE - Failed
-- Performing NetCDF Test HAVE_FTRUNCATE
-- Performing NetCDF Test HAVE_FTRUNCATE - Failed
-- Check if the system is big endian
-- Check if the system is big endian - little endian
CMake Error: This project requires some variables to be set,
and cmake can not find them.
Please set the following variables:
TK_XLIB_PATH (ADVANCED)

-- Configuring done
================================================================

As far as I could track this down, this test result comes from the  
following VTK/CMakeLists.txt fragment:

#----------------------------------------------------------------------- 
------
# Configure the Tk library for vtkRendering.
IF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)
   IF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
     SET(VTK_INCLUDE_NEED_TCL 1)
   ENDIF(VTK_USE_RENDERING OR VTK_WRAP_TCL)
   IF(VTK_USE_RENDERING)
     SET(VTK_INCLUDE_NEED_TK 1)
     SET(VTK_DISABLE_TK_INIT ${VTK_USE_COCOA} CACHE INTERNAL
       "Disables the automatic initialization of Tk widgets when loading  
the rendering library.")
   ENDIF(VTK_USE_RENDERING)
ENDIF(VTK_WRAP_TCL OR VTK_WRAP_PYTHON)

IF(VTK_INCLUDE_NEED_TK)
   # Need Tk sources on windows
   IF(WIN32)
     FIND_PATH(TK_XLIB_PATH
               X11/Xlib.h ${TK_INCLUDE_PATH}
               ${TK_INCLUDE_PATH}/../xlib)
     MARK_AS_ADVANCED(TK_XLIB_PATH)
   ENDIF(WIN32)
   # Need Tk headers and libraries for python TK widgets
   IF(NOT VTK_WRAP_TCL)
     VTK_INCLUDE_TCL_TK_MODULES()
   ENDIF(NOT VTK_WRAP_TCL)
ENDIF(VTK_INCLUDE_NEED_TK)

If you look at the last part, a similar thing will happen on  
non-Windows systems: VKT_INCLUDE_TCL_TK_MODULES() is called, which  
means CMake will start looking for Tcl/Tk on those platforms too.

Best regards,
Sander




More information about the vtk-developers mailing list