Commit 524f23d4 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell

As discussed in review - rename CLASS->HEADER in modules

This (hopefully final commit to this topic) renames the variables to
HEADER/HEADERS rather than CLASS/CLASSES. The function is also renamed
from vtk_module_classes_load to vtk_module_headers_load but performs
essentially the same functions. Updated the documentation to reflect
these changes.

Change-Id: I6f44971a865c6788c16c6311f6704f21612a083b
parent 9c9c3ebd
......@@ -57,17 +57,17 @@ macro(vtk_module_dep_includes mod)
endif()
endmacro()
# vtk_module_classes_load(<module>)
# vtk_module_headers_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)
# <module>_HEADERS_LOADED = True if the module header info has been loaded
# <module>_HEADERS = List of headers
# <module>_HEADER_<header>_EXISTS
# <module>_HEADER_<header>_ABSTRACT
# <module>_HEADER_<header>_WRAP_EXCLUDE
# <module>_HEADER_<header>_WRAP_SPECIAL
macro(vtk_module_headers_load mod)
if(NOT ${mod}_HEADERS_LOADED)
include("${VTK_MODULES_DIR}/${mod}-Headers.cmake"
OPTIONAL RESULT_VARIABLE _found)
if (NOT _found)
......@@ -76,7 +76,7 @@ macro(vtk_module_classes_load mod)
# CMAKE_MODULE_PATH
include(${mod}-Headers OPTIONAL)
endif()
if(NOT ${mod}_CLASSES_LOADED)
if(NOT ${mod}_HEADERS_LOADED)
message(FATAL_ERROR "No such module: \"${mod}\"")
endif()
endif()
......
set(@vtk-module@_CLASSES_LOADED 1)
set(@vtk-module@_CLASSES "@vtk-module-CLASSES@")
set(@vtk-module@_HEADERS_LOADED 1)
set(@vtk-module@_HEADERS "@vtk-module-HEADERS@")
foreach(class ${@vtk-module@_CLASSES})
set(@vtk-module@_CLASS_${class}_EXISTS 1)
foreach(header ${@vtk-module@_HEADERS})
set(@vtk-module@_HEADER_${header}_EXISTS 1)
endforeach()
@vtk-module-ABSTRACT@
......
......@@ -184,11 +184,11 @@ macro(vtk_module_export_info)
endif()
endmacro()
# Export data from a module such as name, include directory and class level
# Export data from a module such as name, include directory and header level
# information useful for wrapping.
function(vtk_module_export sources)
vtk_module_export_info()
# Now iterate through the classes in the module to get class level information.
# Now iterate through the headers in the module to get header level information.
foreach(arg ${sources})
get_filename_component(src "${arg}" ABSOLUTE)
......@@ -201,34 +201,29 @@ function(vtk_module_export sources)
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)
get_source_file_property(_wrap_header ${src} WRAP_HEADER)
if(_wrap_special OR NOT _wrap_exclude)
list(APPEND vtk-module-CLASSES ${_cls})
list(APPEND vtk-module-HEADERS ${_cls})
if(_abstract)
set(vtk-module-ABSTRACT
"${vtk-module-ABSTRACT}set(${vtk-module}_CLASS_${_cls}_ABSTRACT 1)\n")
"${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}_CLASS_${_cls}_WRAP_EXCLUDE 1)\n")
"${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}_CLASS_${_cls}_WRAP_SPECIAL 1)\n")
endif()
if(_wrap_header)
set(vtk-module-WRAP_SPECIAL
"${vtk-module-WRAP_SPECIAL}set(${vtk-module}_CLASS_${_cls}_WRAP_HEADER 1)\n")
"${vtk-module-WRAP_SPECIAL}set(${vtk-module}_HEADER_${_cls}_WRAP_SPECIAL 1)\n")
endif()
endif()
endif()
endif()
endforeach()
# Configure wrapping information for external wrapping of classes.
# Configure wrapping information for external wrapping of headers.
configure_file(${_VTKModuleMacros_DIR}/vtkModuleHeaders.cmake.in
${VTK_MODULES_DIR}/${vtk-module}-Headers.cmake @ONLY)
endfunction()
......@@ -410,7 +405,7 @@ function(vtk_module_library name)
set(${vtk-module}_LIBRARIES ${vtk-module})
vtk_module_impl()
set(vtk-module-CLASSES)
set(vtk-module-HEADERS)
set(vtk-module-ABSTRACT)
set(vtk-module-WRAP_SPECIAL)
......
......@@ -280,43 +280,43 @@ macro(vtk_wrap_python TARGET SRC_LIST_NAME module)
configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in
${_args_file} @ONLY)
# Decide what to do for each class.
foreach(class ${${module}_CLASSES})
# Everything in this block is for classes that will be wrapped.
if(${module}_CLASSES_${class}_WRAP_SPECIAL OR
NOT ${module}_CLASSES_${class}_WRAP_EXCLUDE)
# 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)
# Find the full path to the header file to be wrapped.
vtk_find_header(${class}.h "${${module}_INCLUDE_DIRS}" class_header_path)
vtk_find_header(${header}.h "${${module}_INCLUDE_DIRS}" class_header_path)
if(NOT class_header_path)
message(FATAL_ERROR "Could not find header for ${class}.")
message(FATAL_ERROR "Could not find the ${header} header file.")
endif()
# add the info to the init file
set(VTK_WRAPPER_INIT_DATA
"${VTK_WRAPPER_INIT_DATA}\n${class}")
"${VTK_WRAPPER_INIT_DATA}\n${header}")
# new source file is namePython.cxx, add to resulting list
set(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} ${class}Python.cxx)
set(${SRC_LIST_NAME} ${${SRC_LIST_NAME}} ${header}Python.cxx)
# add custom command to output
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${class}Python.cxx
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${header}Python.cxx
DEPENDS ${VTK_WRAP_PYTHON_EXE} ${VTK_WRAP_HINTS} ${class_header_path}
${_args_file} ${KIT_HIERARCHY_FILE}
COMMAND ${VTK_WRAP_PYTHON_EXE}
ARGS
"${quote}@${_args_file}${quote}"
"-o" "${quote}${CMAKE_CURRENT_BINARY_DIR}/${class}Python.cxx${quote}"
"-o" "${quote}${CMAKE_CURRENT_BINARY_DIR}/${header}Python.cxx${quote}"
"${quote}${class_header_path}${quote}"
COMMENT "Python Wrapping - generating ${class}Python.cxx"
COMMENT "Python Wrapping - generating ${header}Python.cxx"
${verbatim}
)
# Add this output to a custom target if needed.
if(VTK_WRAP_PYTHON_NEED_CUSTOM_TARGETS)
set(VTK_WRAP_PYTHON_CUSTOM_LIST ${VTK_WRAP_PYTHON_CUSTOM_LIST}
${CMAKE_CURRENT_BINARY_DIR}/${class}Python.cxx)
${CMAKE_CURRENT_BINARY_DIR}/${header}Python.cxx)
set(VTK_WRAP_PYTHON_CUSTOM_COUNT ${VTK_WRAP_PYTHON_CUSTOM_COUNT}x)
if(VTK_WRAP_PYTHON_CUSTOM_COUNT MATCHES "^${VTK_WRAP_PYTHON_CUSTOM_LIMIT}$")
set(VTK_WRAP_PYTHON_CUSTOM_NAME ${VTK_WRAP_PYTHON_CUSTOM_NAME}Hack)
......@@ -328,7 +328,7 @@ macro(vtk_wrap_python TARGET SRC_LIST_NAME module)
endif()
endif()
else()
message("${class} will not be wrapped.")
message("${header} will not be wrapped.")
endif()
endforeach()
......
......@@ -12,7 +12,7 @@ endmacro()
# Loop through all modules that should be wrapped, and wrap them.
foreach(module ${VTK_PYTHON_MODULES})
vtk_module_load(${module})
vtk_module_classes_load(${module})
vtk_module_headers_load(${module})
vtk_include_recurse(${module})
vtk_add_python_wrapping(${module})
endforeach()
......
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