[Cmake] cmVTKWrapTclCommand : the VTK Tk Widgets problem/suggestion
Sebastien BARRE
sebastien at barre.nom.fr
Sat May 12 21:05:18 EDT 2001
Hi
Yes, it's related to the compilation of the new VTK tree on Windows, but it
merely a CMake issue.
I've compiled the new VTK tree, as well as its TCL bindings. The Tcl
examples scripts run fine... well, not so fine, there is a problem with the
way they exit (they don't exit, the render window can not be closed except
by killing the process). The reason : these lines in
$(BIN)/Rendering/vtkRenderTCLInit.cxx are just missing :
#include "vtkWin32RenderWindowInteractor.h"
int Vtktcl_Init(Tcl_Interp *interp)
{
[...]
vtkWin32RenderWindowInteractor
::SetClassExitMethod((void (*)(void *))Tcl_Exit, 0);
}
Of course, in order to run the Tcl examples I had to replace the usual
"catch { load vtktcl}" with a more serious solution : "package require
VTK". More about that a later day.
Anyway, the examples using the Tk render widgets (vtkTkRenderWidget) don't
work. The vtkTkRenderWidget command is not found (all others are).
I've just checked that vtkTkRenderWidget.obj is properly linked in
vtkRenderTCL.dll.
Basically, here is what is missing to $(BIN)/Rendering/vtkRenderTCLInit.cxx :
extern "C" {int VTK_EXPORT Vtktkrenderwidget_Init(Tcl_Interp *interp);}
extern "C" {int VTK_EXPORT Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
extern "C" {int VTK_EXPORT Vtktkimagewindowwidget_Init(Tcl_Interp *interp);}
and
int Vtktcl_Init(Tcl_Interp *interp)
{
[...]
Vtktkrenderwidget_Init(interp);
Vtktkimageviewerwidget_Init(interp);
Vtktkimagewindowwidget_Init(interp);
}
As you see, these lines are used to make the interpreter know about these 3
commands, this explains why they are unknown in the current new tree build
(I've added them manually to vtkRenderTCLInit.cxx and I checked that it
solved the problem). These lines were properly generated in the old tree
(in $(BIN_OLD_TREE)/vtktcl/src/vtktcl.cxx file, without the VTK_EXPORT of
course), but they were manually generated by Pcmaker (in getclasses.cxx).
How are we going to handle this case in Cmake ?
If you remember correctly (see Rendering/CMakeLists.txt), the Tk Widgets
are not part of the wrapped sources, they are included specifically :
IF (VTK_WRAP_TCL)
SOURCE_FILES(RenderingTCL_SRCS
vtkTkRenderWidget
vtkTkImageViewerWidget
vtkTkImageWindowWidget)
[...]
VTK_WRAP_TCL(vtkRenderingTCL
RenderingTCL_SRCS
Rendering_SRCS
RenderingOpenGL_SRCS)
ADD_LIBRARY(vtkRenderingTCL RenderingTCL_SRCS)
I guess we might need to either introduce a new CMake command or change the
VTK_WRAP_TCL command (Ken ?) so that it handles a new parameter type, for ex:
VTK_WRAP_TCL(vtkRenderingTCL
SOURCES
RenderingTCL_SRCS
Rendering_SRCS
RenderingOpenGL_SRCS
COMMANDS
vtkTkRenderWidget
vtkTkImageViewerWidget
vtkTkImageWindowWidget)
and this would generate the proper lines...
At the moment I do not know how we are going to include lines like ...
vtkWin32RenderWindowInteractor
::SetClassExitMethod((void (*)(void *))Tcl_Exit, 0);
More information about the CMake
mailing list