/usr/lib/cmake/paraview/ParaViewModuleTop.cmake is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | #------------------------------------------------------------------------------
# This file is based on vtkModuleTop.cmake. The role of this is to kick start
# the processing of all modules.
#
# When using internal-VTK, this simply adds the VTK subdir and lets VTK do it's
# thing after having ensured that VTK can find and detect the additional modules
# ParaView adds.
#
# When using external-VTK, this behaves a lot like vtkModuleTop.cmake,
# processing the modules that ParaView adds, ensuring we use modules from
# external VTK as applicable.
#------------------------------------------------------------------------------
# Figure out which languages are being wrapped, and add them to the list.
if(BUILD_TESTING)
set(_test_languages "Cxx")
if(PARAVIEW_ENABLE_PYTHON)
list(APPEND _test_languages "Python")
endif()
if(VTK_WRAP_JAVA)
list(APPEND _test_languages "Java")
endif()
else()
set(_test_languages "")
endif()
#----------------------------------------------------------------------
# Load the module DAG.
# Assess modules, and tests in the repository.
foreach (source_dir IN LISTS PARAVIEW_MODULE_ROOTS)
file(GLOB_RECURSE files RELATIVE
"${CMAKE_CURRENT_SOURCE_DIR}" "${source_dir}/module.cmake")
foreach (module_cmake IN LISTS files)
get_filename_component(base "${module_cmake}" PATH)
if (PARAVIEW_USING_EXTERNAL_VTK)
vtk_add_module(
"${CMAKE_CURRENT_SOURCE_DIR}/${base}"
module.cmake
"${CMAKE_CURRENT_BINARY_DIR}/${base}"
${_test_languages})
else()
# Simply add to module-search paths for VTK and let VTK deal with it.
vtk_add_to_module_search_path(
"${CMAKE_CURRENT_SOURCE_DIR}/${base}"
"${CMAKE_CURRENT_BINARY_DIR}/${base}")
endif()
endforeach()
endforeach()
if (NOT PARAVIEW_USING_EXTERNAL_VTK)
# include VTK
set (old_build_examples ${BUILD_EXAMPLES})
set (BUILD_EXAMPLES FALSE CACHE BOOL "" FORCE)
add_subdirectory(VTK)
set (BUILD_EXAMPLES ${old_build_examples} CACHE BOOL "" FORCE)
include(${ParaView_BINARY_DIR}/VTK/VTKConfig.cmake)
return()
endif()
include(vtkGroups)
# Validate the module DAG.
macro(vtk_module_check vtk-module _needed_by stack)
list(FIND VTK_MODULES_ENABLED ${vtk-module} _found)
if (_found EQUAL -1)
if(NOT ${vtk-module}_DECLARED)
# Check if the module has been imported.
#message(FATAL_ERROR "No such module \"${vtk-module}\" needed by \"${_needed_by}\"")
set(check_finished_${vtk-module} 1)
endif()
if(check_started_${vtk-module} AND NOT check_finished_${vtk-module})
# We reached a module while traversing its own dependencies recursively.
set(msg "")
foreach(entry ${stack})
set(msg " ${entry} =>${msg}")
if("${entry}" STREQUAL "${vtk-module}")
break()
endif()
endforeach()
message(FATAL_ERROR "Module dependency cycle detected:\n ${msg} ${vtk-module}")
elseif(NOT check_started_${vtk-module})
# Traverse dependencies of this module. Mark the start and finish.
set(check_started_${vtk-module} 1)
foreach(dep IN LISTS ${vtk-module}_DEPENDS)
vtk_module_check(${dep} ${vtk-module} "${vtk-module};${stack}")
endforeach()
set(check_finished_${vtk-module} 1)
endif()
endif()
endmacro()
foreach(vtk-module ${VTK_MODULES_ALL})
vtk_module_check("${vtk-module}" "" "")
endforeach()
#----------------------------------------------------------------------
# Provide an option for each module.
foreach(vtk-module ${VTK_MODULES_ALL})
if(NOT ${vtk-module}_IS_TEST)
option(Module_${vtk-module} "Request building ${vtk-module}"
${${vtk-module}_DEFAULT})
mark_as_advanced(Module_${vtk-module})
if(${vtk-module}_EXCLUDE_FROM_ALL)
set(${vtk-module}_IN_ALL 0)
else()
set(${vtk-module}_IN_ALL ${VTK_BUILD_ALL_MODULES})
endif()
endif()
endforeach()
# Follow dependencies.
macro(vtk_module_enable vtk-module _needed_by)
if(NOT Module_${vtk-module})
list(APPEND ${vtk-module}_NEEDED_BY ${_needed_by})
endif()
if(NOT ${vtk-module}_ENABLED)
set(${vtk-module}_ENABLED 1)
foreach(dep IN LISTS ${vtk-module}_DEPENDS)
vtk_module_enable(${dep} ${vtk-module})
endforeach()
# If VTK_BUILD_ALL_MODULES_FOR_TESTS is true, then and then
# alone do we include the test modules in building build the dependency
# graph for enabled modules (BUG #13297).
if (VTK_BUILD_ALL_MODULES_FOR_TESTS)
foreach(test IN LISTS ${vtk-module}_TESTED_BY)
vtk_module_enable(${test} "")
endforeach()
elseif (BUILD_TESTING)
# identify vtkTesting<> dependencies on the test module and enable them.
# this ensures that core testing modules such as vtkTestingCore,
# vtkTestingRendering which many test modules depend on, are automatically
# enabled.
foreach(test IN LISTS ${vtk-module}_TESTED_BY)
foreach(test-depends IN LISTS ${test}_DEPENDS)
if (test-depends MATCHES "^vtkTesting.*")
vtk_module_enable(${test-depends} "")
endif()
endforeach()
endforeach()
endif()
endif()
endmacro()
foreach(vtk-module ${VTK_MODULES_ALL})
if(Module_${vtk-module} OR ${vtk-module}_IN_ALL)
vtk_module_enable("${vtk-module}" "")
elseif(${vtk-module}_REQUEST_BY)
vtk_module_enable("${vtk-module}" "${${vtk-module}_REQUEST_BY}")
endif()
endforeach()
foreach(vtk-module ${VTK_MODULES_ALL})
# Exclude modules that exist only to test this module
# from the report of modules that need this one. They
# are enabled exactly because this module is enabled.
if(${vtk-module}_NEEDED_BY AND ${vtk-module}_TESTED_BY)
list(REMOVE_ITEM ${vtk-module}_NEEDED_BY "${${vtk-module}_TESTED_BY}")
endif()
endforeach()
# Build final list of enabled modules.
set(PV_MODULES_ENABLED "")
set(PV_MODULES_DISABLED "")
foreach(vtk-module ${VTK_MODULES_ALL})
if(${vtk-module}_ENABLED)
list(APPEND PV_MODULES_ENABLED ${vtk-module})
else()
list(APPEND PV_MODULES_DISABLED ${vtk-module})
endif()
endforeach()
if (NOT PV_MODULES_ENABLED)
message(WARNING "No modules enabled!")
return()
endif()
list(SORT PV_MODULES_ENABLED) # Deterministic order.
list(SORT PV_MODULES_DISABLED) # Deterministic order.
# Order list to satisfy dependencies.
include(TopologicalSort)
topological_sort(PV_MODULES_ENABLED "" _DEPENDS)
# topological_sort() ends up bringing in VTK modules that were imported, so we
# explicitly remove them before proceeding further.
if (VTK_MODULES_ENABLED)
list(REMOVE_ITEM PV_MODULES_ENABLED ${VTK_MODULES_ENABLED})
list(REMOVE_ITEM PV_MODULES_DISABLED ${VTK_MODULES_ENABLED})
endif()
# Report what will be built.
set(_modules_enabled_alpha "${PV_MODULES_ENABLED}")
list(SORT _modules_enabled_alpha)
list(REMOVE_ITEM _modules_enabled_alpha vtkWrappingJava vtkWrappingPythonCore)
list(LENGTH _modules_enabled_alpha _length)
message(STATUS "Enabled ${_length} modules:")
foreach(vtk-module ${_modules_enabled_alpha})
if(NOT ${vtk-module}_IS_TEST)
if(Module_${vtk-module})
set(_reason ", requested by Module_${vtk-module}.")
elseif(${vtk-module}_IN_ALL)
set(_reason ", requested by VTK_BUILD_ALL_MODULES.")
else()
set(_needed_by "${${vtk-module}_NEEDED_BY}")
list(SORT _needed_by)
list(LENGTH _needed_by _length)
if(_length GREATER "1")
set(_reason ", needed by ${_length} modules:")
foreach(dep ${_needed_by})
set(_reason "${_reason}\n ${dep}")
endforeach()
else()
set(_reason ", needed by ${_needed_by}.")
endif()
endif()
message(STATUS " * ${vtk-module}${_reason}")
endif()
endforeach()
# Hide options for modules that will build anyway.
foreach(vtk-module ${VTK_MODULES_ALL})
if(NOT ${vtk-module}_IS_TEST)
if(${vtk-module}_IN_ALL OR ${vtk-module}_NEEDED_BY)
set_property(CACHE Module_${vtk-module} PROPERTY TYPE INTERNAL)
else()
set_property(CACHE Module_${vtk-module} PROPERTY TYPE BOOL)
endif()
endif()
endforeach()
if(NOT PV_MODULES_ENABLED)
message(WARNING "No modules enabled!")
return()
endif()
macro(verify_vtk_module_is_set)
if("" STREQUAL "${vtk-module}")
message(FATAL_ERROR "CMake variable vtk-module is not set")
endif()
endmacro()
macro(init_module_vars)
verify_vtk_module_is_set()
# set(${vtk-module}-targets VTKTargets)
# set(${vtk-module}-targets-install "${VTK_INSTALL_PACKAGE_DIR}/VTKTargets.cmake")
# set(${vtk-module}-targets-build "${VTK_BINARY_DIR}/VTKTargets.cmake")
endmacro()
# VTK_WRAP_PYTHON_MODULES can be used to explicitly control which modules
# get Python wrapped (no automatic dependency support is provided at this
# time). If it has been set mark the modules in the list as such.
# Note any wrap exclude entries in the module.cmake will take precedence
# If entry has not been set default to PV_MODULES_ENABLED.
if(VTK_WRAP_PYTHON)
if(NOT VTK_WRAP_PYTHON_MODULES)
set(VTK_WRAP_PYTHON_MODULES ${PV_MODULES_ENABLED})
endif()
foreach(_wrap_module ${VTK_WRAP_PYTHON_MODULES})
if(NOT ${_wrap_module}_EXCLUDE_FROM_WRAPPING)
set(${_wrap_module}_WRAP_PYTHON ON)
endif()
endforeach()
endif()
# Build all modules.
set (VTK_MODULES_ENABLED ${VTK_MODULES_ENABLED} ${PV_MODULES_ENABLED})
foreach(vtk-module ${PV_MODULES_ENABLED})
set(_module ${vtk-module})
if(NOT ${_module}_IS_TEST)
init_module_vars()
else()
set(vtk-module ${${_module}_TESTS_FOR})
endif()
#message("vtk-module = ${vtk-module}")
include("${${_module}_SOURCE_DIR}/vtk-module-init.cmake" OPTIONAL)
add_subdirectory("${${_module}_SOURCE_DIR}" "${${_module}_BINARY_DIR}")
endforeach()
vtk_module_config(VTK ${VTK_MODULES_ENABLED})
|