Commit f48aa25c authored by Chris Harris's avatar Chris Harris

Add code to module infrastruture to export module class information

External wrappers such a ParaView need information about classes
contain in a paricular module. This information was provided by
the vtk${Kit}.cmake files. This information needs to be written to
a new set of files in the VTK_MODULE_DIR along with the appropriate
new macro the load this information.

Change-Id: Iec18d3a03056feb2db5bd54d6c5380c0592c52cf
parent 57d0c321
......@@ -40,6 +40,24 @@ macro(vtk_module_load mod)
endif()
endmacro()
# vtk_module_classes_load(<module>)
#
# Loads variables describing the given module:
# <module>_CLASSES_LOADED = True if the module class info has been loaded
# <module>_CLASSES = List of classes
# <module>_CLASS_<class>_EXISTS
# <module>_CLASS_<class>_ABSTRACT
# <module>_CLASS_<class>_WRAP_EXCLUDE
# <module>_CLASS_<class>_WRAP_SPECIAL
macro(vtk_module_classes_load mod)
if(NOT ${mod}_CLASSES_LOADED)
include("${VTK_MODULES_DIR}/${mod}-Classes.cmake" OPTIONAL)
if(NOT ${mod}_CLASSES_LOADED)
message(FATAL_ERROR "No such module: \"${mod}\"")
endif()
endif()
endmacro()
# vtk_module_config(<namespace> [modules...])
#
# Configures variables describing the given modules and their dependencies:
......
set(@vtk-module@_CLASSES_LOADED 1)
set(@vtk-module@_CLASSES "@vtk-module-CLASSES@")
foreach(class ${@vtk-module@_CLASSES})
set(@vtk-module@_CLASS_${class}_EXISTS 1)
endforeach()
@vtk-module-ABSTRACT@
@vtk-module-WRAP_EXCLUDE@
@vtk-module-WRAP_SPECIAL@
......@@ -125,6 +125,9 @@ macro(vtk_module_impl)
foreach(opt ${${vtk-module}_EXPORT_OPTIONS})
set(_code "${_code}set(${opt} \"${${opt}}\")\n")
endforeach()
if(VTK_MODULE_${vtk-module}_EXCLUDE_FROM_WRAPPING)
set(_code "${_code}set(${vtk-module}_EXCLUDE_FROM_WRAPPING 1)\n")
endif()
if(VTK_MODULE_${vtk-module}_IMPLEMENTS)
set(_code "${_code}set(${vtk-module}_IMPLEMENTS \"${VTK_MODULE_${vtk-module}_IMPLEMENTS}\")\n")
endif()
......@@ -268,14 +271,38 @@ function(vtk_module_library name)
set(${vtk-module}_LIBRARIES ${vtk-module})
vtk_module_impl()
set(vtk-module-CLASSES)
set(vtk-module-ABSTRACT)
set(vtk-module-WRAP_SPECIAL)
# Collect header files matching sources.
set(_hdrs ${${vtk-module}_HDRS})
foreach(arg ${ARGN})
get_filename_component(src "${arg}" ABSOLUTE)
string(REGEX REPLACE "\\.(cxx|mm)$" ".h" hdr "${src}")
if("${hdr}" MATCHES "\\.h$")
if(EXISTS "${hdr}")
list(APPEND _hdrs "${hdr}")
get_filename_component(_filename "${hdr}" NAME)
string(REGEX REPLACE "\\.h$" "" _cls "${_filename}")
get_source_file_property(_wrap_exclude ${src} WRAP_EXCLUDE)
get_source_file_property(_abstract ${src} ABSTRACT)
get_source_file_property(_wrap_special ${src} WRAP_SPECIAL)
if(NOT _wrap_exclude)
list(APPEND vtk-module-CLASSES ${_cls})
endif()
if(_abstract)
set(vtk-module-ABSTRACT "${vtk-module-ABSTRACT}set(${vtk-module}_CLASS_${_cls}_ABSTRACT 1)\n")
endif()
if(_wrap_special)
set(vtk-module-WRAP_SPECIAL "${vtk-module-WRAP_SPECIAL}set(${vtk-module}_CLASS_${_cls}_WRAP_SPECIAL 1)\n")
endif()
endif()
elseif("${src}" MATCHES "\\.txx$")
list(APPEND _hdrs "${src}")
......@@ -284,6 +311,9 @@ function(vtk_module_library name)
list(APPEND _hdrs "${CMAKE_CURRENT_BINARY_DIR}/${vtk-module}Module.h")
list(REMOVE_DUPLICATES _hdrs)
# Configure wrapping information for external wrappers
configure_file(${_VTKModuleMacros_DIR}/vtkModuleClasses.cmake.in ${VTK_MODULES_DIR}/${vtk-module}-Classes.cmake @ONLY)
# The instantiators are off by default, and only work on wrapped modules.
if(VTK_MAKE_INSTANTIATORS AND NOT VTK_MODULE_${vtk-module}_EXCLUDE_FROM_WRAPPING)
string(TOUPPER "${vtk-module}_EXPORT" _export_macro)
......
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