Commit 8dcb00ed authored by David Gobbi's avatar David Gobbi Committed by Marcus D. Hanwell
Browse files

ENH: Move core python support classes to Wrapping/Python

Organizationally, it makes more sense for the python utility classes
to be placed in Wrapping/Python than in Common.  This means adding a
new library called vtkPythonCore that represents the core python
support for VTK, as compared to VTK classes for individual kits like
Common/vtkPythonCommand.cxx and Rendering/vtkTkRenderWidgetPython.cxx.
parent 29a32227
......@@ -5,7 +5,8 @@ VTK_WRAP_PYTHON3(vtk${KIT}Python KitPython_SRCS "${Kit_SRCS}")
# can link to this but it is not directly loaded dynamically as a
# module.
ADD_LIBRARY(vtk${KIT}PythonD ${KitPython_SRCS} ${Kit_PYTHON_EXTRA_SRCS})
TARGET_LINK_LIBRARIES(vtk${KIT}PythonD vtk${KIT} ${KIT_PYTHON_LIBS})
TARGET_LINK_LIBRARIES(
vtk${KIT}PythonD vtk${KIT} vtkPythonCore ${KIT_PYTHON_LIBS})
IF(NOT VTK_INSTALL_NO_LIBRARIES)
INSTALL(TARGETS vtk${KIT}PythonD
RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
......@@ -22,9 +23,9 @@ SET(KIT_LIBRARY_TARGETS ${KIT_LIBRARY_TARGETS} vtk${KIT}PythonD)
# shared libraries that are linked or loaded. On Windows and OSX we
# want to link to the python libray to resolve its symbols
# immediately.
IF(WIN32 OR APPLE)
TARGET_LINK_LIBRARIES (vtk${KIT}PythonD ${VTK_PYTHON_LIBRARIES})
ENDIF(WIN32 OR APPLE)
#IF(WIN32 OR APPLE)
# TARGET_LINK_LIBRARIES (vtk${KIT}PythonD ${VTK_PYTHON_LIBRARIES})
#ENDIF(WIN32 OR APPLE)
# Add dependencies that may have been generated by VTK_WRAP_PYTHON3 to
# the python wrapper library. This is needed for the
......
......@@ -445,9 +445,7 @@ ENDIF(VTK_USE_N_WAY_ARRAYS)
SET(Kit_EXTRA_SRCS)
SET(Kit_EXTRA_CMDS)
SET(Kit_TCL_EXTRA_SRCS vtkTclUtil.cxx)
SET(Kit_PYTHON_EXTRA_SRCS
vtkPythonUtil.cxx vtkPythonCommand.cxx
PyVTKClass.cxx PyVTKObject.cxx PyVTKSpecialObject.cxx)
SET(Kit_PYTHON_EXTRA_SRCS vtkPythonCommand.cxx)
SET(Kit_JAVA_EXTRA_SRCS vtkJavaUtil.cxx)
SET(KIT_TCL_DEPS)
SET(KIT_PYTHON_DEPS)
......@@ -528,11 +526,7 @@ IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_PYTHON)
SET(__inst_files ${__inst_files}
PyVTKClass.h
PyVTKObject.h
PyVTKSpecialObject.h
vtkPythonUtil.h
vtkPython.h
vtkPythonCommand.h
)
IF (TK_FOUND)
IF(VTK_USE_TK)
......
......@@ -74,8 +74,7 @@ IF(PYTHON_EXECUTABLE)
vtkPlaneCollection.h
vtkProcessStatistics.h
vtkPropCollection.h
vtkPython.h
vtkPythonUtil.h
vtkPythonCommand.h
vtkRayCastStructures.h
vtkRungeKutta2.h
vtkSetGet.h
......
......@@ -20,7 +20,7 @@
#include "vtkCommand.h"
// To allow Python to use the vtkCommand features
class vtkPythonCommand : public vtkCommand
class VTK_COMMON_PYTHON_EXPORT vtkPythonCommand : public vtkCommand
{
public:
static vtkPythonCommand *New() { return new vtkPythonCommand; };
......
# this file is used directly from VTK/CMakeLists.txt, not from VTK/Wrapping/CMakeLists.txt
#-----------------------
# for libvtkPythonCore.so, the core classes and utilities for VTK-Python
SET(VTK_PYTHON_CORE_SRCS
vtkPythonUtil.cxx
PyVTKClass.cxx
PyVTKObject.cxx
PyVTKSpecialObject.cxx
)
ADD_LIBRARY(vtkPythonCore ${VTK_PYTHON_CORE_SRCS})
TARGET_LINK_LIBRARIES(vtkPythonCore vtkCommon)
IF(NOT VTK_INSTALL_NO_LIBRARIES)
INSTALL(TARGETS vtkPythonCore
RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
SET(__inst_files
vtkPython.h
vtkPythonUtil.h
PyVTKClass.h
PyVTKObject.h
PyVTKSpecialObject.h
)
INSTALL(FILES ${__inst_files}
DESTINATION ${VTK_INSTALL_INCLUDE_DIR_CM24}
COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
# Underlinking on purpose. The following library will not compile
# with LDFLAGS=-Wl,--no-undefined by design:
# On some UNIX platforms the python library is static and therefore
# should not be linked into the shared library. Instead the symbols
# are exported from the python executable so that they can be used by
# shared libraries that are linked or loaded. On Windows and OSX we
# want to link to the python libray to resolve its symbols
# immediately.
IF(WIN32 OR APPLE)
TARGET_LINK_LIBRARIES (vtkPythonCore ${VTK_PYTHON_LIBRARIES})
ENDIF(WIN32 OR APPLE)
# Apply user-defined properties to the library targets.
IF(VTK_LIBRARY_PROPERTIES)
SET_TARGET_PROPERTIES(vtkPythonCore PROPERTIES
${VTK_LIBRARY_PROPERTIES}
)
ENDIF(VTK_LIBRARY_PROPERTIES)
#-----------------------
# for the vtkpython executable
IF(VTK_USE_CARBON)
FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools)
ENDIF(VTK_USE_CARBON)
......
......@@ -23,13 +23,19 @@
#include "vtkABI.h"
#if defined(WIN32)
# if defined(vtkCommonPythonD_EXPORTS)
# if defined(vtkPythonCore_EXPORTS)
# define VTK_PYTHON_EXPORT VTK_ABI_EXPORT
# else
# define VTK_PYTHON_EXPORT VTK_ABI_IMPORT
# endif
# if defined(vtkCommonPythonD_EXPORTS)
# define VTK_COMMON_PYTHON_EXPORT VTK_ABI_EXPORT
# else
# define VTK_COMMON_PYTHON_EXPORT VTK_ABI_IMPORT
# endif
#else
# define VTK_PYTHON_EXPORT
# define VTK_COMMON_PYTHON_EXPORT
#endif
/*
......
......@@ -47,7 +47,7 @@ ENDIF(VTK_INCLUDE_NEED_TCL)
IF(VTK_WRAP_PYTHON)
# Python include directory.
SET(VTK_INCLUDE_DIRS_SYSTEM ${VTK_INCLUDE_DIRS_SYSTEM}
${PYTHON_INCLUDE_PATH})
${VTK_SOURCE_DIR}/Wrapping/Python ${PYTHON_INCLUDE_PATH})
ENDIF(VTK_WRAP_PYTHON)
# VTK_INCLUDE_NEED_TK is set in toplevel CMakeLists.txt file.
......
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