Commit 98f45e95 authored by David Gobbi's avatar David Gobbi
Browse files

Make WRAP_DEPENDS from DEPENDS and PRIVATE_DEPENDS

In VTK 6.1 the PRIVATE_DEPENDS section was added to the module.cmake files,
in order to reduce linking.  This created a problem for the wrappers that
went unnoticed at the time: when a VTK interface method takes or return a
pointer to a VTK object, a simple forward declaration and private linkage
of the library defining that object is sufficient for C++.  But for the
wrappers, it is insufficient because the wrappers require the definitions
of any types that are used as method parameters, otherwise they cannot
know whether a forward-declared class is derived from vtkObject or not.

For VTK 7.1 the module.cmake files were cleaned up and many dependencies
were moved from DEPENDS to PRIVATE_DEPENDS.  This cleanup caused the
bug that was introduced in VTK 6.1 to become apparent, because suddenly
a whole bunch of methods were not longer wrapped in Java because the
wrappers could not reliably determine whether forward-declared types
were derived from vtkObject or not.  Tcl and Python continued to work
because they are less strict in their type checking.
parent 858c6ed5
......@@ -66,7 +66,7 @@ function(vtk_add_java_wrapping module_name module_srcs module_hdrs)
endif()
endif()
foreach(dep ${${module_name}_LINK_DEPENDS})
foreach(dep ${${module_name}_WRAP_DEPENDS})
if(NOT ${dep}_EXCLUDE_FROM_WRAPPING)
target_link_libraries(${module_name}Java LINK_PUBLIC ${dep}Java)
endif()
......
......@@ -130,6 +130,9 @@ macro(vtk_module _name)
endforeach()
list(SORT ${vtk-module}_DEPENDS) # Deterministic order.
set(${vtk-module}_LINK_DEPENDS "${${vtk-module}_DEPENDS}")
set(${vtk-module}_WRAP_DEPENDS
${${vtk-module}_DEPENDS}
${${vtk-module}_PRIVATE_DEPENDS})
list(APPEND ${vtk-module}_DEPENDS
${${vtk-module}_COMPILE_DEPENDS}
${${vtk-module}_PRIVATE_DEPENDS})
......
......@@ -89,7 +89,7 @@ function(vtk_add_python_wrapping_library module srcs)
# Figure out the dependent PythonXYD libraries for the module
set(extra_links)
foreach(dep IN LISTS ${module}_DEPENDS)
foreach(dep IN LISTS ${module}_WRAP_DEPENDS)
if(NOT "${module}" STREQUAL "${dep}" AND TARGET ${dep}PythonD)
list(APPEND extra_links ${dep}PythonD)
endif()
......
......@@ -43,7 +43,7 @@ function(vtk_add_tcl_wrapping module_name module_srcs module_hdrs)
endif()
# Figure out the dependent Tcl libraries for the module
foreach(dep ${${vtk-module}_LINK_DEPENDS})
foreach(dep ${${vtk-module}_WRAP_DEPENDS})
if(NOT "${vtk-module}" STREQUAL "${dep}")
if(NOT ${dep}_EXCLUDE_FROM_WRAPPING AND NOT "${${dep}_TCL_NAME}" STREQUAL "")
list(APPEND extra_links ${${dep}_TCL_NAME}TCL)
......
......@@ -126,9 +126,9 @@ $<$<BOOL:$<TARGET_PROPERTY:${module_name},INCLUDE_DIRECTORIES>>:
set(OTHER_HIERARCHY_FILES)
# Don't use ${module_name}_DEPENDS. That list also includes COMPILE_DEPENDS,
# which aren't library dependencies, merely dependencies for generators and
# such. The dependecies specified under "DEPENDS" in the vtk_module(..) macro
# call are located under _LINK_DEPENDS.
foreach(dep ${${module_name}_LINK_DEPENDS})
# such. Instead, use _WRAP_DEPENDS which includes the DEPENDS and the
# PRIVATE_DEPENDS from module.cmake, but not COMPILE_DEPENDS.
foreach(dep ${${module_name}_WRAP_DEPENDS})
if(NOT "${module_name}" STREQUAL "${dep}")
if(NOT ${dep}_EXCLUDE_FROM_WRAPPING)
list(APPEND OTHER_HIERARCHY_FILES "${${dep}_WRAP_HIERARCHY_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