Commit e6f75b9a authored by David Gobbi's avatar David Gobbi
Browse files

Wrap many more classes with python.

This makes the python wrappers ignore WRAP_EXCLUDE, and instead use
the new property WRAP_EXCLUDE_PYTHON that excludes fewer classes.
The WRAP_SPECIAL flag, which used to act as a whitelist for python,
has been removed.

Because this change causes classes to be wrapped in python by default,
some third-party VTK packages might break until they modify their own
CMakeLists.txt files to add WRAP_EXCLUDE_PYTHON where necessary.
parent 77f7a0dd
......@@ -101,7 +101,9 @@ set_source_files_properties(
${headers}
${cpu_accelerator_srcs}
${CMAKE_CURRENT_BINARY_DIR}/vtkAcceleratorsDaxObjectFactory.cxx
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
# Now for the object factory.
......
......@@ -45,7 +45,9 @@ cuda_compile(Module_CUDA_C_SRCS ${Module_CUDA_SRCS} ${GPGPU_BUILD_TYPE})
set_source_files_properties(
${Module_CUDA_C_SRCS}
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
list(APPEND Module_SRCS ${Module_CUDA_C_SRCS})
......
......@@ -75,7 +75,7 @@ endmacro()
# <module>_HEADER_<header>_EXISTS
# <module>_HEADER_<header>_ABSTRACT
# <module>_HEADER_<header>_WRAP_EXCLUDE
# <module>_HEADER_<header>_WRAP_SPECIAL
# <module>_HEADER_<header>_WRAP_EXCLUDE_PYTHON
macro(vtk_module_headers_load mod)
if(NOT ${mod}_HEADERS_LOADED)
include("${VTK_MODULES_DIR}/${mod}-Headers.cmake"
......
......@@ -7,4 +7,4 @@ endforeach()
@vtk-module-ABSTRACT@
@vtk-module-WRAP_EXCLUDE@
@vtk-module-WRAP_SPECIAL@
@vtk-module-WRAP_EXCLUDE_PYTHON@
......@@ -322,31 +322,33 @@ function(vtk_module_export sources)
string(REGEX REPLACE "\\.(cxx|txx|mm)$" ".h" hdr "${src}")
if("${hdr}" MATCHES "\\.h$")
if(EXISTS "${hdr}")
get_filename_component(_filename "${hdr}" NAME)
get_filename_component(_filename "${hdr}" NAME)
# Make sure header is in one of the expected locations
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_filename}" OR
EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_filename}")
string(REGEX REPLACE "\\.h$" "" _cls "${_filename}")
get_source_file_property(_wrap_exclude ${src} WRAP_EXCLUDE)
get_source_file_property(_wrap_exclude_python ${src} WRAP_EXCLUDE_PYTHON)
get_source_file_property(_abstract ${src} ABSTRACT)
get_source_file_property(_wrap_special ${src} WRAP_SPECIAL)
if(_wrap_special OR NOT _wrap_exclude)
list(APPEND vtk-module-HEADERS ${_cls})
list(APPEND vtk-module-HEADERS ${_cls})
if(_abstract)
set(vtk-module-ABSTRACT
"${vtk-module-ABSTRACT}set(${vtk-module}_HEADER_${_cls}_ABSTRACT 1)\n")
endif()
if(_abstract)
set(vtk-module-ABSTRACT
"${vtk-module-ABSTRACT}set(${vtk-module}_HEADER_${_cls}_ABSTRACT 1)\n")
endif()
if(_wrap_exclude)
set(vtk-module-WRAP_EXCLUDE
"${vtk-module-WRAP_EXCLUDE}set(${vtk-module}_HEADER_${_cls}_WRAP_EXCLUDE 1)\n")
endif()
if(_wrap_exclude)
set(vtk-module-WRAP_EXCLUDE
"${vtk-module-WRAP_EXCLUDE}set(${vtk-module}_HEADER_${_cls}_WRAP_EXCLUDE 1)\n")
endif()
if(_wrap_special)
set(vtk-module-WRAP_SPECIAL
"${vtk-module-WRAP_SPECIAL}set(${vtk-module}_HEADER_${_cls}_WRAP_SPECIAL 1)\n")
endif()
if(_wrap_exclude_python)
set(vtk-module-WRAP_EXCLUDE_PYTHON
"${vtk-module-WRAP_EXCLUDE_PYTHON}set(${vtk-module}_HEADER_${_cls}_WRAP_EXCLUDE_PYTHON 1)\n")
endif()
endif()
endif()
......@@ -556,7 +558,6 @@ function(vtk_module_library name)
set(vtk-module-HEADERS)
set(vtk-module-ABSTRACT)
set(vtk-module-WRAP_SPECIAL)
# Collect header files matching sources.
set(_hdrs ${${vtk-module}_HDRS})
......
......@@ -42,8 +42,8 @@ macro(VTK_WRAP_HIERARCHY TARGET OUTPUT_DIR SOURCES)
# file properties to include in the hierarchy file
get_property(TMP_WRAP_EXCLUDE SOURCE ${FILE} PROPERTY WRAP_EXCLUDE)
get_source_file_property(TMP_WRAP_SPECIAL ${FILE} WRAP_SPECIAL)
get_source_file_property(TMP_ABSTRACT ${FILE} ABSTRACT)
get_source_file_property(TMP_EXCLUDE_PYTHON ${FILE} WRAP_EXCLUDE_PYTHON)
# what is the filename without the extension
get_filename_component(TMP_FILENAME ${FILE} NAME_WE)
......@@ -61,7 +61,7 @@ macro(VTK_WRAP_HIERARCHY TARGET OUTPUT_DIR SOURCES)
set(TMP_EXCLUDE_FROM_HIERARCHY OFF)
# ensure that header exists (assume it exists if it is marked as wrapped)
if(TMP_WRAP_EXCLUDE AND NOT TMP_WRAP_SPECIAL)
if(TMP_WRAP_EXCLUDE)
if(NOT EXISTS ${TMP_INPUT})
set(TMP_EXCLUDE_FROM_HIERARCHY ON)
endif()
......@@ -88,8 +88,8 @@ macro(VTK_WRAP_HIERARCHY TARGET OUTPUT_DIR SOURCES)
set(VTK_WRAPPER_INIT_DATA "${VTK_WRAPPER_INIT_DATA};WRAP_EXCLUDE")
endif()
if(TMP_WRAP_SPECIAL)
set(VTK_WRAPPER_INIT_DATA "${VTK_WRAPPER_INIT_DATA};WRAP_SPECIAL")
if(TMP_EXCLUDE_PYTHON)
set(VTK_WRAPPER_INIT_DATA "${VTK_WRAPPER_INIT_DATA};WRAP_EXCLUDE_PYTHON")
endif()
set(VTK_WRAPPER_INIT_DATA "${VTK_WRAPPER_INIT_DATA}\n")
......
......@@ -76,11 +76,10 @@ macro(VTK_WRAP_PYTHON3 TARGET SRC_LIST_NAME SOURCES)
# for each class
foreach(FILE ${SOURCES})
# should we wrap the file?
get_source_file_property(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE)
get_source_file_property(TMP_WRAP_SPECIAL ${FILE} WRAP_SPECIAL)
get_source_file_property(TMP_EXCLUDE_PYTHON ${FILE} WRAP_EXCLUDE_PYTHON)
# if we should wrap it
if(TMP_WRAP_SPECIAL OR NOT TMP_WRAP_EXCLUDE)
if(NOT TMP_EXCLUDE_PYTHON)
# what is the filename without the extension
get_filename_component(TMP_FILENAME ${FILE} NAME_WE)
......@@ -287,8 +286,7 @@ macro(vtk_wrap_python TARGET SRC_LIST_NAME module)
# Decide what to do for each header.
foreach(header ${${module}_HEADERS})
# Everything in this block is for headers that will be wrapped.
if(${module}_HEADER_${header}_WRAP_SPECIAL OR
NOT ${module}_HEADER_${header}_WRAP_EXCLUDE)
if(NOT ${module}_HEADER_${header}_WRAP_EXCLUDE_PYTHON)
# Find the full path to the header file to be wrapped.
vtk_find_header(${header}.h "${${module}_INCLUDE_DIRS}" class_header_path)
......@@ -332,7 +330,7 @@ macro(vtk_wrap_python TARGET SRC_LIST_NAME module)
endif()
endif()
else()
message("${header} will not be wrapped.")
# message("${header} will not be wrapped.")
endif()
endforeach()
......
......@@ -23,10 +23,9 @@ FUNCTION(VTK_WRAP_PYTHON_SIP KIT SRC_LIST_NAME SOURCES)
FOREACH(FILE ${SOURCES})
# should we wrap the file?
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_EXCLUDE ${FILE} WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(TMP_WRAP_SPECIAL ${FILE} WRAP_SPECIAL)
# if we should wrap it
IF (NOT TMP_WRAP_SPECIAL AND NOT TMP_WRAP_EXCLUDE)
IF (NOT TMP_WRAP_EXCLUDE)
# what is the filename without the extension
GET_FILENAME_COMPONENT(TMP_FILENAME ${FILE} NAME_WE)
......
......@@ -57,9 +57,4 @@ set_source_files_properties(
WRAP_EXCLUDE
)
set_source_files_properties(
vtkContextPolygon
PROPERTIES WRAP_SPECIAL 1
)
vtk_module_library(vtkChartsCore ${Module_SRCS})
......@@ -6,7 +6,6 @@ set(Module_SRCS
#set_source_files_properties(
# ABSTRACT
# WRAP_EXCLUDE
# PROPERTIES WRAP_SPECIAL 1
#)
vtk_module_library(vtkCommonColor ${Module_SRCS})
......@@ -603,6 +603,32 @@ set_source_files_properties(
WRAP_EXCLUDE
)
# python uses WRAP_EXCLUDE_PYTHON and ignores WRAP_EXCLUDE
set_source_files_properties(
vtkABI.h
vtkAtomic.h
vtkAutoInit.h
vtkDataArrayTemplate.txx
vtkDataArrayTemplateHelper.cxx
vtkDataArrayTemplateImplicit.txx
vtkIOStream.cxx
vtkIOStreamFwd.h
vtkLargeInteger.cxx
vtkOldStyleCallbackCommand.cxx
vtkOStreamWrapper.cxx
vtkOStrStreamWrapper.cxx
vtkNew.h
vtkSetGet.h
vtkSmartPointer.h
vtkSmartPointerBase.h
vtkStdString.cxx
vtkUnicodeString.cxx
vtkWeakPointer.h
vtkWeakPointerBase.cxx
vtkWin32Header.h
PROPERTIES WRAP_EXCLUDE_PYTHON 1
)
set_source_files_properties(
vtkDataArrayTemplate.h
vtkDenseArray.h
......@@ -612,27 +638,6 @@ set_source_files_properties(
HEADER_FILE_ONLY
)
set_source_files_properties(
vtkArrayCoordinates.cxx
vtkArrayExtents.cxx
vtkArrayExtentsList.cxx
vtkArrayRange.cxx
vtkArraySort.cxx
vtkArrayWeights.cxx
vtkTimeStamp.cxx
vtkVariant.cxx
vtkDenseArray.txx
vtkSparseArray.txx
vtkTypedArray.txx
vtkTypeTemplate.h
vtkSystemIncludes.h
vtkType.h
vtkConfigure.h
vtkMathConfigure.h
vtkVersionMacros.h
PROPERTIES WRAP_SPECIAL 1
)
# Activate code in "vtkVariant.cxx". See the comment in the source.
set_source_files_properties(vtkVariant.cxx PROPERTIES
COMPILE_FLAGS -DVTK_VARIANT_IMPL)
......
......@@ -279,14 +279,8 @@ set_source_files_properties(
)
set_source_files_properties(
vtkAtom
vtkBond
vtkCellType.h
vtkBoundingBox.cxx
vtkColor.h
vtkRect.h
vtkVector.h
PROPERTIES WRAP_SPECIAL 1
vtkDispatcher_Private
PROPERTIES WRAP_EXCLUDE_PYTHON 1
)
vtk_module_library(vtkCommonDataModel ${Module_SRCS})
......@@ -21,12 +21,6 @@ set_source_files_properties(
WRAP_EXCLUDE
)
set_source_files_properties(
vtkQuaternion.h
vtkTuple.h
PROPERTIES WRAP_SPECIAL 1
)
set(
${vtk-module}_HDRS
vtkQuaternion.txx
......
......@@ -12,10 +12,4 @@ set_source_files_properties(
WRAP_EXCLUDE
)
set_source_files_properties(
vtkErrorCode.cxx
vtkPolygonBuilder.cxx
PROPERTIES WRAP_SPECIAL 1
)
vtk_module_library(vtkCommonMisc ${Module_SRCS})
......@@ -31,7 +31,11 @@ foreach(file ${shader_files})
vtkDomainsChemistryOpenGL2Module.h
)
list(APPEND Module_SRCS ${res})
set_source_files_properties(${file_we} WRAP_EXCLUDE)
set_source_files_properties(${file_we}
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
endforeach()
# Now for the object factory.
......@@ -46,7 +50,12 @@ vtk_object_factory_configure("${vtk_module_overrides}")
list(APPEND Module_SRCS
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
set_source_files_properties(${vtk-module}ObjectFactory.cxx WRAP_EXCLUDE)
set_source_files_properties(
${vtk-module}ObjectFactory.cxx
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
vtk_module_library(vtkDomainsChemistryOpenGL2 ${Module_SRCS})
include(vtkOpenGL)
......
......@@ -45,7 +45,9 @@ set_source_files_properties(
set_source_files_properties(
${vtk-module}ObjectFactory.cxx
vtkPOutlineFilterInternals.cxx
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
vtk_module_library(vtkFiltersParallel ${Module_SRCS})
......@@ -31,7 +31,9 @@ list(APPEND Module_SRCS
${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}ObjectFactory.cxx)
set_source_files_properties(
${vtk-module}ObjectFactory.cxx
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
vtk_module_library(vtkFiltersParallelFlowPaths ${Module_SRCS})
......@@ -29,7 +29,9 @@ set(${vtk-module}_EXPORT_CODE "#include \"vtkFiltersStatisticsGnuRConfigure.h\""
set_source_files_properties(
vtkRAdapter.cxx
${vtk-module}ObjectFactory
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
# Now to generate our object factory.
......
......@@ -19,7 +19,9 @@ set_source_files_properties(
set_source_files_properties(
vtkAMREnzoReaderInternal
vtkAMRFlashReaderInternal
WRAP_EXCLUDE
PROPERTIES
WRAP_EXCLUDE 1
WRAP_EXCLUDE_PYTHON 1
)
vtk_module_library(vtkIOAMR ${Module_SRCS})
......@@ -20,6 +20,12 @@ set_source_files_properties(
WRAP_EXCLUDE 1
)
set_source_files_properties(
vtkExodusIIReaderVariableCheck
PROPERTIES
WRAP_EXCLUDE_PYTHON 1
)
set_source_files_properties(
vtkExodusIIReaderVariableCheck
PROPERTIES
......
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