Wrapper hierarchy file

Hello @ben.boeckel,

I have heard that you are familiar with the wrapper “engine” of VTK and you can help me with a problem of my library. I don’t know how to fix this error:

[ 66%] Python Wrapping - generating vtkboolPythonInit.cxx
make[2]: *** No rule to make target '../vtkboolHierarchy', needed by 'vtkPolyDataBooleanFilterPython.cxx'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:154: CMakeFiles/vtkboolPythonD.dir/all] Error 2
make: *** [Makefile:95: all] Error

It only happens with VTK8. There is an older documentation (https://vtk.org/Wiki/VTK/WrapHierarchy) about it, but that doesn’t help me. I don’t know what is missing.

Here is the link to my project: https://github.com/zippy84/vtkbool

Thanks in advance

I’m not as familiar with the VTK 8.x wrapping CMake APIs (@dgobbi may have better information here). I think you need to call vtk_wrap_hierarchy(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR} vtkPolyDataBooleanFilter.cxx). Though scoping and expected directories may not be correct there.

Hi Ronald,

For VTK 8, something like this is needed at the top of the VTK_WRAP_PYTHON section:

if(${VTK_MAJOR_VERSION} GREATER 7)
  set(MODULE_HIERARCHY_NAME ${PROJECT_NAME}Hierarchy)
  include(vtkWrapHierarchy)
  vtk_wrap_hierarchy(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR} vtkPolyDataBooleanFilter.h)
  set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.txt)
  set(LIB_HIERARCHY_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.stamp.txt)
endif()

@mwestphal told me that.

@dgobbi Thanks, I will try it when I’m home.

@dgobbi It works except for one thing:

21/21 Testing: Test_Py
21/21 Test: Test_Py
Command: "/usr/bin/python3.6" "/home/zippy/vtkbool/testing/test_py_module.py" "/home/zippy/VTK8/lib64/python3.6/site-packages" "/home/zippy/vtkbool/build" "Release"
Directory: /home/zippy/vtkbool/build
"Test_Py" start time: Aug 12 19:49 CEST
Output:
----------------------------------------------------------
Traceback (most recent call last):
  File "/home/zippy/vtkbool/testing/test_py_module.py", line 28, in <module>
    vtkboolPython.vtkPolyDataBooleanFilter()
TypeError: this class cannot be instantiated

The generated vtkboolHierarchy.txt is:

HolesType = std::vector<IdsType> ; vtkPolyDataBooleanFilter.h ; vtkbool
InvolvedType = std::set<int> ; vtkPolyDataBooleanFilter.h ; vtkbool
MergePt ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
PStrips ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
PolyStripsType = std::map<int, PStrips> ; vtkPolyDataBooleanFilter.h ; vtkbool
RefsType = std::vector<std::reference_wrapper<StripPtR> > ; vtkPolyDataBooleanFilter.h ; vtkbool
Rel : enum ; vtkPolyDataBooleanFilter.h ; vtkbool
RelationsType = std::map<int, Rel> ; vtkPolyDataBooleanFilter.h ; vtkbool
StripPt ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
StripPtL ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
StripPtL2 ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
StripPtL3 ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
StripPtR ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
StripPtsType = std::map<int, StripPt> ; vtkPolyDataBooleanFilter.h ; vtkbool
StripType = std::deque<StripPtR> ; vtkPolyDataBooleanFilter.h ; vtkbool
StripsType = std::vector<StripType> ; vtkPolyDataBooleanFilter.h ; vtkbool
_Wrapper ; vtkPolyDataBooleanFilter.h ; vtkbool ; WRAP_EXCLUDE_PYTHON
vtkPolyDataBooleanFilter : vtkPolyDataAlgorithm ; vtkPolyDataBooleanFilter.h ; vtkbool
vtkPolyDataBooleanFilter::Superclass = vtkPolyDataAlgorithm ; vtkPolyDataBooleanFilter.h ; vtkbool

What could be wrong?

Here is the changed CMakeLists.txt: https://github.com/zippy84/vtkbool/blob/hierarchy/CMakeLists.txt

Oops, I missed setting the “WRAP_DEPENDS” variable that vtkWrapHierarchy needs. Try this:

if(${VTK_MAJOR_VERSION} GREATER 7)
  set(MODULE_HIERARCHY_NAME ${PROJECT_NAME}Hierarchy)
  set(${PROJECT_NAME}_WRAP_DEPENDS vtkCommonExecutionModel)
  include(vtkWrapHierarchy)
  vtk_wrap_hierarchy(${PROJECT_NAME} ${CMAKE_CURRENT_BINARY_DIR} vtkPolyDataBooleanFilter.h)
  set(KIT_HIERARCHY_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.txt)
  set(LIB_HIERARCHY_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_HIERARCHY_NAME}.stamp.txt)
endif()

@dgobbi It works :slight_smile:

Will there ever be a good documentation about it?

Maybe. If there was good documentation, where would you go to find it? I’m not sure where people look for VTK info these days, other than here and the doxygen pages.