Commit 57da0ae3 authored by Ben Boeckel's avatar Ben Boeckel

vtkRenderingTk: update to the new module system

parent 15bf6ba3
vtk_module_export_info()
find_package(TCL)
if(TK_FOUND)
set(HAVE_LIMITS_H ${CMAKE_HAVE_LIMITS_H})
set(HAVE_UNISTD_H ${CMAKE_HAVE_UNISTD_H})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkTkInternals.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkTkInternals.h)
if(NOT VTK_INSTALL_NO_DEVELOPMENT)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/vtkTkInternals.h
DESTINATION ${VTK_INSTALL_INCLUDE_DIR}
COMPONENT Development
)
endif()
# Need Tk internal headers for Tk initialization.
set(try_file)
set(try_paths)
if(WIN32)
set(try_file "tkWinPort.h")
endif()
if (APPLE)
set(try_file "tkMacOSXDefault.h")
GET_FILENAME_COMPONENT(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
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}
"${TK_INCLUDE_PATH}/../win"
"${TK_INCLUDE_PATH}/../macosx")
find_path(
TK_INTERNAL_PATH
${try_file}
PATHS ${try_paths}
DOC "The path to the Tk internal headers (${try_file}).")
mark_as_advanced(TK_INTERNAL_PATH)
endif()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${TK_INCLUDE_PATH}
${TK_INTERNAL_PATH}
${TK_XLIB_PATH}
${TCL_INCLUDE_PATH})
if(VTK_USE_X)
include_directories(${VTK_BINARY_DIR}/Utilities/KWSys)
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
vtkTkImageViewerWidgetPython.cxx
)
if(VTK_USE_COCOA)
set(Module_PYTHON_SRCS ${Module_PYTHON_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()
add_library(vtkRenderingPythonTkWidgets SHARED ${Module_PYTHON_SRCS})
vtk_target_install(vtkRenderingPythonTkWidgets)
set_property(TARGET vtkRenderingPythonTkWidgets PROPERTY OUTPUT_NAME
vtkRenderingPythonTkWidgets-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION})
set(Module_PYTHON_LIBS ${VTK_TK_LIBRARIES})
if(VTK_USE_X)
set(Module_PYTHON_LIBS vtksys vtkRenderingOpenGL2 ${Module_PYTHON_LIBS}
${X11_LIBRARIES})
endif()
vtk_module_link_libraries(vtkRenderingPythonTkWidgets
vtkRenderingCore vtkCommonDataModel
vtkInteractionImage
${Module_PYTHON_LIBS}
${TCL_LIBRARY}
${TK_LIBRARY})
endif()
endif()
# TODO: Make FindTCL.cmake use imported targets
find_package(TCL REQUIRED)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/vtkTkAppInitConfigure.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/vtkTkAppInitConfigure.h")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/vtkTkInternals.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/vtkTkInternals.h")
set(sources
vtkPythonTkWidgetsInit.cxx
vtkTkImageViewerWidgetPython.cxx
vtkTkRenderWidgetPython.cxx)
set(private_headers
vtkTcl.h
vtkTclUtil.h
vtkTk.h
vtkTkImageViewerWidget.h
vtkTkRenderWidget.h
"${CMAKE_CURRENT_BINARY_DIR}/vtkTkAppInitConfigure.h"
"${CMAKE_CURRENT_BINARY_DIR}/vtkTkInternals.h")
if (VTK_USE_COCOA)
list(APPEND sources
vtkCocoaTkUtilities.mm)
list(APPEND private_headers
vtkCocoaTkUtilities.h)
endif ()
vtk_module_add_module(VTK::RenderingTk
SOURCES ${sources}
PRIVATE_HEADERS ${private_headers})
vtk_module_link(VTK::RenderingTk
PRIVATE
${TCL_LIBRARY}
${TK_LIBRARY})
vtk_module_test_data(
Data/neghip.slc)
if (VTK_WRAP_PYTHON)
add_subdirectory(Python)
endif ()
vtk_module(vtkRenderingTk
GROUPS
Tk
TEST_DEPENDS
vtkRenderingVolume
EXCLUDE_FROM_WRAPPING
DEPENDS
vtkCommonCore
vtkInteractionImage
vtkRenderingOpenGL2
vtkRenderingCore
PRIVATE_DEPENDS
vtkCommonDataModel
vtkCommonExecutionModel
)
NAME
VTK::RenderingTk
LIBRARY_NAME
vtkRenderingTk
CONDITION
VTK_WRAP_PYTHON AND VTK_USE_TK
GROUPS
Tk
DEPENDS
VTK::CommonCore
VTK::InteractionImage
VTK::RenderingCore
VTK::RenderingOpenGL2
PRIVATE_DEPENDS
VTK::CommonDataModel
VTK::CommonExecutionModel
VTK::vtksys
TEST_DEPENDS
VTK::RenderingVolume
EXCLUDE_WRAP
......@@ -61,3 +61,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkCocoaTkUtilities.h
......@@ -21,9 +21,9 @@
#include "vtkVersionMacros.h"
//----------------------------------------------------------------------------
// Vtkrenderingpythontkwidgets_Init
// Vtkrenderingtk_Init
// Called upon system startup to create the widget commands.
extern "C" {VTK_EXPORT int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp);}
extern "C" {VTK_EXPORT int Vtkrenderingtk_Init(Tcl_Interp *interp);}
extern "C" {VTK_EXPORT int Vtktkrenderwidget_Init(Tcl_Interp *interp);}
extern "C" {VTK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
......@@ -33,14 +33,14 @@ extern "C" {VTK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
#define VTKTK_TO_STRING1(x) #x
#define VTKTK_VERSION VTKTK_TO_STRING(VTK_MAJOR_VERSION) "." VTKTK_TO_STRING(VTK_MINOR_VERSION)
int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp)
int Vtkrenderingtk_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*)"Vtkrenderingpythontkwidgets",
return Tcl_PkgProvide(interp, (char*)"Vtkrenderingtk",
(char*)VTKTK_VERSION);
}
else
......
......@@ -26,3 +26,4 @@
#include <tcl.h>
#endif
// VTK-HeaderTest-Exclude: vtkTcl.h
......@@ -116,3 +116,4 @@ void vtkTclApplicationInitTclTk(Tcl_Interp* interp,
const char* const relative_dirs[]);
#endif
// VTK-HeaderTest-Exclude: vtkTclUtil.h
......@@ -26,3 +26,4 @@
#include <tk.h>
#endif
// VTK-HeaderTest-Exclude: vtkTk.h
......@@ -52,4 +52,4 @@ struct vtkTkImageViewerWidget
};
#endif
// VTK-HeaderTest-Exclude: vtkTkImageViewerWidget.h
......@@ -18,9 +18,6 @@
#include "vtkRenderingOpenGLConfigure.h" // for COCOA, X11, WIN32
#cmakedefine HAVE_LIMITS_H
#cmakedefine HAVE_UNISTD_H
// This widget requires access to structures that are normally
// not visible to Tcl/Tk applications. For this reason you must
// have access to tkInt.h
......
......@@ -59,3 +59,4 @@ struct vtkTkRenderWidget
};
#endif
// VTK-HeaderTest-Exclude: vtkTkRenderWidget.h
......@@ -10,7 +10,7 @@ def vtkLoadPythonTkWidgets(interp):
"""
X = vtkVersion.GetVTKMajorVersion()
Y = vtkVersion.GetVTKMinorVersion()
modname = 'vtkRenderingPythonTkWidgets'
modname = 'vtkRenderingTk'
name = '%s-%d.%d' % (modname,X,Y)
pkgname = modname.lower().capitalize()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment