blob: 93448245b4ab76b6b63504ce220339f35cbdb0f0 [file] [log] [blame]
diff --git a/Rendering/Tk/CMakeLists.txt b/Rendering/Tk/CMakeLists.txt
index 916d376..976cc4f 100644
--- a/Rendering/Tk/CMakeLists.txt
+++ b/Rendering/Tk/CMakeLists.txt
@@ -1,8 +1,6 @@
vtk_module_export_info()
-# The cmake code to find the libs is in vtkWrapTcl
-set(VTK_WRAP_TCL_FIND_LIBS 1)
-include(vtkWrapTcl)
+find_package(TCL)
if(TK_FOUND AND VTK_USE_TK)
@@ -31,6 +29,8 @@ if(TK_FOUND AND VTK_USE_TK)
set(try_paths "${TK_INCLUDE_PATH_PARENT}/PrivateHeaders")
endif()
if(try_file)
+ include(vtkTclTkMacros)
+
VTK_GET_TCL_TK_VERSION ("TCL_TK_MAJOR_VERSION" "TCL_TK_MINOR_VERSION")
set(TCL_TK_VERSIOND "${TCL_TK_MAJOR_VERSION}.${TCL_TK_MINOR_VERSION}")
set(try_paths ${try_paths}
@@ -50,53 +50,17 @@ if(TK_FOUND AND VTK_USE_TK)
${TK_INCLUDE_PATH}
${TK_INTERNAL_PATH}
${TK_XLIB_PATH}
- ${TCL_INCLUDE_PATH}
- ${VTK_SOURCE_DIR}/Wrapping/Tcl
- ${VTK_BINARY_DIR}/Wrapping/Tcl)
+ ${TCL_INCLUDE_PATH})
if(VTK_USE_X)
include_directories(${VTK_BINARY_DIR}/Utilities/KWSys)
endif()
- if (VTK_WRAP_TCL)
- set(Module_TCL_SRCS
- vtkTclTkWidgetsInit.cxx
- vtkTkRenderWidget.cxx
- vtkTkImageViewerWidget.cxx)
-
- if(VTK_USE_COCOA)
- set(Module_TCL_SRCS ${Module_TCL_SRCS} vtkCocoaTkUtilities.mm)
-
- # Set specified Objective-C++ flags, if any.
- if(VTK_REQUIRED_OBJCXX_FLAGS)
- set_source_files_properties(vtkCocoaTkUtilities.mm
- PROPERTIES COMPILE_FLAGS "${VTK_REQUIRED_OBJCXX_FLAGS}")
- endif()
- endif()
-
- set(Module_TCL_LIBS ${VTK_TK_LIBRARIES})
- # Use special interactor for X and Tk.
- if(VTK_USE_X)
- find_package(X11 REQUIRED)
- if(NOT X11_Xt_FOUND)
- message(FATAL_ERROR "X11_Xt_LIB could not be found. Required for VTK X lib.")
- endif()
- set(Module_TCL_SRCS ${Module_TCL_SRCS} vtkXRenderWindowTclInteractor.cxx)
- set(Module_TCL_LIBS vtksys vtkRendering${VTK_RENDERING_BACKEND} ${TK_LIBRARY} ${X11_LIBRARIES})
- endif()
-
- vtk_add_library(vtkRenderingTkTCL ${Module_TCL_SRCS})
-
- vtk_module_link_libraries(vtkRenderingTkTCL
- vtkRenderingCore vtkCommonDataModel vtkCommonCoreTCL
- vtkInteractionImage
- ${Module_TCL_LIBS})
-
- set_property(GLOBAL APPEND PROPERTY VTK_TCL_WRAPPED vtkRenderingTk)
-
- endif()
-
if (VTK_WRAP_PYTHON)
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/vtkTkAppInitConfigure.h.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/vtkTkAppInitConfigure.h")
+
set(Module_PYTHON_SRCS
vtkPythonTkWidgetsInit.cxx
vtkTkRenderWidgetPython.cxx
@@ -129,6 +93,8 @@ if(TK_FOUND AND VTK_USE_TK)
vtk_module_link_libraries(vtkRenderingPythonTkWidgets
vtkRenderingCore vtkCommonDataModel
vtkInteractionImage
- ${Module_PYTHON_LIBS})
+ ${Module_PYTHON_LIBS}
+ ${TCL_LIBRARY}
+ ${TK_LIBRARY})
endif()
endif()
diff --git a/Rendering/Tk/vtkPythonTkWidgetsInit.cxx b/Rendering/Tk/vtkPythonTkWidgetsInit.cxx
index 75a4e84..0b6e0b0 100644
--- a/Rendering/Tk/vtkPythonTkWidgetsInit.cxx
+++ b/Rendering/Tk/vtkPythonTkWidgetsInit.cxx
@@ -23,10 +23,10 @@
//----------------------------------------------------------------------------
// Vtkrenderingpythontkwidgets_Init
// Called upon system startup to create the widget commands.
-extern "C" {VTK_TK_EXPORT int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp);}
+extern "C" {VTK_EXPORT int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp);}
-extern "C" {VTK_TK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
-extern "C" {VTK_TK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
+extern "C" {VTK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
+extern "C" {VTK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
#define VTKTK_TO_STRING(x) VTKTK_TO_STRING0(x)
#define VTKTK_TO_STRING0(x) VTKTK_TO_STRING1(x)
diff --git a/Rendering/Tk/vtkTcl.h b/Rendering/Tk/vtkTcl.h
new file mode 100644
index 0000000..5b763d5
--- /dev/null
+++ b/Rendering/Tk/vtkTcl.h
@@ -0,0 +1,28 @@
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: vtkTcl.h
+
+ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+#ifndef vtkTcl_h
+#define vtkTcl_h
+
+#include "vtkTkAppInitConfigure.h"
+
+#ifdef VTK_TCL_TK_STATIC
+# ifndef STATIC_BUILD
+# define STATIC_BUILD
+# endif
+#endif
+
+#include <tcl.h>
+
+#endif
diff --git a/Rendering/Tk/vtkTclTkWidgetsInit.cxx b/Rendering/Tk/vtkTclTkWidgetsInit.cxx
deleted file mode 100644
index 9e5fc31..0000000
--- a/Rendering/Tk/vtkTclTkWidgetsInit.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: vtkTkWidgetsInit.cxx
-
- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include "vtkTcl.h"
-#include "vtkTk.h"
-#include "vtkVersionMacros.h"
-#include "vtkTkImageViewerWidget.h"
-#include "vtkTkRenderWidget.h"
-#include "vtkImageData.h"
-
-
-//----------------------------------------------------------------------------
-// Vtkrenderingtcltkwidgets_Init
-// Called upon system startup to create the widget commands.
-extern "C" {VTK_TK_EXPORT int Vtkrenderingtktcl_Init(Tcl_Interp *interp);}
-
-extern "C" {VTK_TK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
-extern "C" {VTK_TK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
-
-#define VTKTK_TO_STRING(x) VTKTK_TO_STRING0(x)
-#define VTKTK_TO_STRING0(x) VTKTK_TO_STRING1(x)
-#define VTKTK_TO_STRING1(x) #x
-#define VTKTK_VERSION VTKTK_TO_STRING(VTK_MAJOR_VERSION) "." VTKTK_TO_STRING(VTK_MINOR_VERSION)
-
-int Vtkrenderingtktcl_Init(Tcl_Interp *interp)
-{
- // Forward the call to the real init functions.
- if(Vtktkrenderwidget_Init(interp) == TCL_OK &&
- Vtktkimageviewerwidget_Init(interp) == TCL_OK)
- {
- // Report that the package is provided.
- return Tcl_PkgProvide(interp, (char*)"vtkRenderingTkTCL",
- (char*)VTKTK_VERSION);
- }
- else
- {
- // One of the widgets is not provided.
- return TCL_ERROR;
- }
-}
diff --git a/Rendering/Tk/vtkTclUtil.h b/Rendering/Tk/vtkTclUtil.h
new file mode 100644
index 0000000..45db3c0
--- /dev/null
+++ b/Rendering/Tk/vtkTclUtil.h
@@ -0,0 +1,118 @@
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: vtkTclUtil.h
+
+ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+
+#ifndef vtkTclUtil_h
+#define vtkTclUtil_h
+
+#include "vtkObject.h"
+#include "vtkCommand.h"
+#include "vtkTcl.h"
+
+#ifdef _WIN32
+#define VTKTCL_EXPORT __declspec( dllexport )
+#else
+#define VTKTCL_EXPORT
+#endif
+
+extern VTKTCL_EXPORT void vtkTclUpdateCommand(Tcl_Interp *interp,
+ char *name,
+ vtkObject *obj);
+
+extern VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *,
+ unsigned long eventId,
+ void *, void *);
+extern VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd);
+
+extern VTKTCL_EXPORT void
+vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp,
+ const char *targetType);
+
+extern VTKTCL_EXPORT void *
+vtkTclGetPointerFromObject(const char *name, const char *result_type,
+ Tcl_Interp *interp, int &error);
+
+extern VTKTCL_EXPORT void vtkTclVoidFunc(void *);
+extern VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *);
+extern VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp *interp,
+ ClientData arg);
+extern VTKTCL_EXPORT int vtkTclInDelete(Tcl_Interp *interp);
+
+extern VTKTCL_EXPORT int vtkTclNewInstanceCommand(ClientData cd,
+ Tcl_Interp *interp,
+ int argc, char *argv[]);
+extern VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd);
+extern VTKTCL_EXPORT
+void vtkTclCreateNew(Tcl_Interp *interp, const char *cname,
+ ClientData (*NewCommand)(),
+ int (*CommandFunction)(ClientData cd,
+ Tcl_Interp *interp,
+ int argc, char *argv[]));
+
+class vtkTclCommand : public vtkCommand
+{
+public:
+ static vtkTclCommand *New() { return new vtkTclCommand; };
+
+ void SetStringCommand(const char *arg);
+ void SetInterp(Tcl_Interp *interp) { this->Interp = interp; };
+
+ void Execute(vtkObject *, unsigned long, void *);
+
+ char *StringCommand;
+ Tcl_Interp *Interp;
+protected:
+ vtkTclCommand();
+ ~vtkTclCommand();
+};
+
+typedef struct _vtkTclVoidFuncArg
+{
+ Tcl_Interp *interp;
+ char *command;
+} vtkTclVoidFuncArg;
+
+struct vtkTclCommandArgStruct
+{
+ void *Pointer;
+ Tcl_Interp *Interp;
+ unsigned long Tag;
+};
+
+struct vtkTclCommandStruct
+{
+ ClientData (*NewCommand)();
+ int (*CommandFunction)(ClientData cd, Tcl_Interp *interp,
+ int argc, char *argv[]);
+};
+
+struct vtkTclInterpStruct
+{
+ Tcl_HashTable InstanceLookup;
+ Tcl_HashTable PointerLookup;
+ Tcl_HashTable CommandLookup;
+
+ int Number;
+ int DebugOn;
+ int InDelete;
+ int DeleteExistingObjectOnNew;
+};
+
+extern VTKTCL_EXPORT
+void vtkTclApplicationInitExecutable(int argc, const char* const argv[]);
+extern VTKTCL_EXPORT
+void vtkTclApplicationInitTclTk(Tcl_Interp* interp,
+ const char* const relative_dirs[]);
+
+#endif
diff --git a/Rendering/Tk/vtkTk.h b/Rendering/Tk/vtkTk.h
new file mode 100644
index 0000000..ff13966
--- /dev/null
+++ b/Rendering/Tk/vtkTk.h
@@ -0,0 +1,28 @@
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: vtkTk.h
+
+ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+#ifndef vtkTk_h
+#define vtkTk_h
+
+#include "vtkTkAppInitConfigure.h"
+
+#ifdef VTK_TCL_TK_STATIC
+# ifndef STATIC_BUILD
+# define STATIC_BUILD
+# endif
+#endif
+
+#include <tk.h>
+
+#endif
diff --git a/Rendering/Tk/vtkTkAppInitConfigure.h.in b/Rendering/Tk/vtkTkAppInitConfigure.h.in
new file mode 100644
index 0000000..3e0dec7
--- /dev/null
+++ b/Rendering/Tk/vtkTkAppInitConfigure.h.in
@@ -0,0 +1,18 @@
+#ifndef vtkTkAppInitConfigure_h
+#define vtkTkAppInitConfigure_h
+
+/* Whether we are linking to Tcl/Tk statically. */
+#cmakedefine VTK_TCL_TK_STATIC
+
+/* Whether Tk widgets are NOT initialized when vtkRendering loads. */
+#cmakedefine VTK_USE_TK
+
+/* Whether the Tcl/Tk support files are copied to the build dir */
+#cmakedefine VTK_TCL_TK_COPY_SUPPORT_LIBRARY
+
+/* Where the VTK Tcl packages can be found */
+#define VTK_INSTALL_TCL_DIR "@VTK_INSTALL_TCL_DIR@"
+
+@VTK_EXTRA_TCL_WRAPPING_CODE@
+
+#endif
diff --git a/Rendering/Tk/vtkTkImageViewerWidget.cxx b/Rendering/Tk/vtkTkImageViewerWidget.cxx
index d3ae0f0..5967b7f 100644
--- a/Rendering/Tk/vtkTkImageViewerWidget.cxx
+++ b/Rendering/Tk/vtkTkImageViewerWidget.cxx
@@ -443,7 +443,7 @@ extern "C"
//----------------------------------------------------------------------------
// vtkTkImageViewerWidget_Init
// Called upon system startup to create vtkTkImageViewerWidget command.
-extern "C" {VTK_TK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
+extern "C" {VTK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
#define VTKTK_TO_STRING(x) VTKTK_TO_STRING0(x)
#define VTKTK_TO_STRING0(x) VTKTK_TO_STRING1(x)
diff --git a/Rendering/Tk/vtkTkRenderWidget.cxx b/Rendering/Tk/vtkTkRenderWidget.cxx
index 6c1825d..a30cc38 100644
--- a/Rendering/Tk/vtkTkRenderWidget.cxx
+++ b/Rendering/Tk/vtkTkRenderWidget.cxx
@@ -759,14 +759,14 @@ extern "C"
//----------------------------------------------------------------------------
// vtkTkRenderWidget_Init
// Called upon system startup to create vtkTkRenderWidget command.
-extern "C" {VTK_TK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
+extern "C" {VTK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
#define VTKTK_TO_STRING(x) VTKTK_TO_STRING0(x)
#define VTKTK_TO_STRING0(x) VTKTK_TO_STRING1(x)
#define VTKTK_TO_STRING1(x) #x
#define VTKTK_VERSION VTKTK_TO_STRING(VTK_MAJOR_VERSION) "." VTKTK_TO_STRING(VTK_MINOR_VERSION)
-int VTK_TK_EXPORT Vtktkrenderwidget_Init(Tcl_Interp *interp)
+int VTK_EXPORT Vtktkrenderwidget_Init(Tcl_Interp *interp)
{
// This widget requires Tk to function.
Tcl_PkgRequire(interp, (char *)"Tk", (char*)TK_VERSION, 0);
diff --git a/ThirdParty/TclTk/CMakeLists.txt b/ThirdParty/TclTk/CMakeLists.txt
index eb2b61d..904acf0 100644
--- a/ThirdParty/TclTk/CMakeLists.txt
+++ b/ThirdParty/TclTk/CMakeLists.txt
@@ -19,9 +19,7 @@ endif()
vtk_dependent_option(VTK_USE_TK "Build VTK with Tk support"
${VTK_USE_TK_DEFAULT} "VTK_CAN_USE_TK" OFF)
-# The cmake code to find the libs is in vtkWrapTcl
-set(VTK_WRAP_TCL_FIND_LIBS 1)
-include(vtkWrapTcl)
+include(vtkTclTkMacros)
# Subdirs
ADD_SUBDIRECTORY(internals)