4 ParaView uses XML files to describe filters available in its user interface.
5 Modules may add filters to the UI by providing XML files.
7 TODO: Document the ServerManager XML format.
11 cmake_policy(SET CMP0057 NEW)
14 ## Adding XMLs to modules 16 Modules may have associated XML files. They can be added to the module
target 25 cmake_parse_arguments(_paraview_add_sm
31 if (_paraview_add_sm_UNPARSED_ARGUMENTS)
33 "Unparsed arguments for paraview_add_server_manager_xmls: " 34 "${_paraview_add_sm_UNPARSED_ARGUMENTS}")
37 if (NOT _paraview_add_sm_XMLS)
39 "The `XMLS` argument is required.")
42 if (NOT DEFINED _paraview_add_sm_MODULE)
43 set(_paraview_add_sm_MODULE
"${_vtk_build_module}")
46 foreach (_paraview_add_sm_xml IN LISTS _paraview_add_sm_XMLS)
47 if (NOT IS_ABSOLUTE
"${_paraview_add_sm_xml}")
48 string(PREPEND _paraview_add_sm_xml
"${CMAKE_CURRENT_SOURCE_DIR}/")
51 _vtk_module_set_module_property(
"${_paraview_add_sm_MODULE}" APPEND
52 PROPERTY
"paraview_server_manager_xml" 53 VALUE
"${_paraview_add_sm_xml}")
60 There are two functions offered to build server manager XML files. The first
67 [INSTALL_EXPORT <export>]
69 [XML_FILES <variable>]
70 [TRANSLATIONS_DIRECTORY <directory>]
71 [TRANSLATIONS_TARGET <target>])
74 The `MODULES` argument contains the modules to include in the server manager
75 target. The
function gathers the XML files declared
using 78 files are required, they may be passed via `FILES`.
80 If `XML_FILES` is given, the list of process XML files are
set on the given
83 If `INSTALL_EXPORT` is given, the
interface target will be added to the given
87 cmake_parse_arguments(_paraview_sm_process
89 "TARGET;XML_FILES;INSTALL_EXPORT;TRANSLATIONS_DIRECTORY;TRANSLATIONS_TARGET" 93 if (_paraview_sm_process_UNPARSED_ARGUMENTS)
95 "Unparsed arguments for paraview_server_manager_process: " 96 "${_paraview_sm_process_UNPARSED_ARGUMENTS}")
99 if (NOT _paraview_sm_process_MODULES)
101 "The `MODULES` argument is required.")
104 if (NOT DEFINED _paraview_sm_process_TARGET)
106 "The `TARGET` argument is required.")
109 # Topologically sort modules so that XML definitions that depend on each 110 # other are loaded in the right order. 111 set(_paraview_sm_process_sorted_modules ${_paraview_sm_process_MODULES})
112 set(_paraview_sm_process_module_stack ${_paraview_sm_process_MODULES})
113 set(_paraview_sm_process_module_seen)
114 while (_paraview_sm_process_module_stack)
115 list(GET _paraview_sm_process_module_stack 0 _paraview_sm_process_module)
116 list(REMOVE_AT _paraview_sm_process_module_stack 0)
117 if (_paraview_sm_process_module IN_LIST _paraview_sm_process_module_seen)
120 list(APPEND _paraview_sm_process_module_seen
121 "${_paraview_sm_process_module}")
123 get_property(_paraview_sm_process_module_is_imported
124 TARGET
"${_paraview_sm_process_module}" 126 if (_paraview_sm_process_module_is_imported)
127 _vtk_module_get_module_property(
"${_paraview_sm_process_module}" 129 VARIABLE
"_paraview_sm_process_depends")
130 _vtk_module_get_module_property(
"${_paraview_sm_process_module}" 131 PROPERTY
"private_depends" 132 VARIABLE
"_paraview_sm_process_private_depends")
133 _vtk_module_get_module_property(
"${_paraview_sm_process_module}" 134 PROPERTY
"optional_depends" 135 VARIABLE
"_paraview_sm_process_optional_depends")
137 get_property(
"_paraview_sm_process_depends" GLOBAL
138 PROPERTY
"_vtk_module_${_paraview_sm_process_module}_depends")
139 get_property(
"_paraview_sm_process_private_depends" GLOBAL
140 PROPERTY
"_vtk_module_${_paraview_sm_process_module}_private_depends")
141 get_property(
"_paraview_sm_process_optional_depends" GLOBAL
142 PROPERTY
"_vtk_module_${_paraview_sm_process_module}_optional_depends")
145 # Prune optional dependencies that do not exist. 146 set(_paraview_sm_process_optional_depends_exists)
147 foreach (_paraview_sm_process_optional_depend IN LISTS _paraview_sm_process_optional_depends)
148 if (TARGET
"${_paraview_sm_process_optional_depend}")
149 list(APPEND _paraview_sm_process_optional_depends_exists
150 "${_paraview_sm_process_optional_depend}")
154 # Put all of the dependencies into a single variable. 155 set(
"_paraview_sm_process_${_paraview_sm_process_module}_all_depends" 156 ${_paraview_sm_process_depends}
157 ${_paraview_sm_process_private_depends}
158 ${_paraview_sm_process_optional_depends_exists})
159 list(APPEND _paraview_sm_process_module_stack
160 ${_paraview_sm_process_depends}
161 ${_paraview_sm_process_private_depends}
162 ${_paraview_sm_process_optional_depends_exists})
165 # Topologically sort according to dependencies. 166 vtk_topological_sort(_paraview_sm_process_sorted_modules
"_paraview_sm_process_" "_all_depends")
168 # Limit the sorted modules to those that are actually in the pass module list. 169 set(_paraview_sm_process_modules)
170 foreach (_paraview_sm_process_sorted_module IN LISTS _paraview_sm_process_sorted_modules)
171 if (_paraview_sm_process_sorted_module IN_LIST _paraview_sm_process_MODULES)
172 list(APPEND _paraview_sm_process_modules
173 "${_paraview_sm_process_sorted_module}")
177 set(_paraview_sm_process_files)
178 foreach (_paraview_sm_process_module IN LISTS _paraview_sm_process_modules)
179 _vtk_module_get_module_property(
"${_paraview_sm_process_module}" 180 PROPERTY
"paraview_server_manager_xml" 181 VARIABLE _paraview_sm_process_module_files)
182 list(APPEND _paraview_sm_process_files
183 ${_paraview_sm_process_module_files})
186 list(APPEND _paraview_sm_process_files
187 ${_paraview_sm_process_FILES})
189 set(_paraview_sm_process_export_args)
190 if (DEFINED _paraview_sm_process_INSTALL_EXPORT)
191 list(APPEND _paraview_sm_process_export_args
192 INSTALL_EXPORT
"${_paraview_sm_process_INSTALL_EXPORT}")
196 TARGET ${_paraview_sm_process_TARGET}
197 FILES ${_paraview_sm_process_files}
198 ${_paraview_sm_process_export_args})
200 if (DEFINED _paraview_sm_process_XML_FILES)
201 set(
"${_paraview_sm_process_XML_FILES}" 202 "${_paraview_sm_process_files}" 206 if (NOT DEFINED _paraview_sm_process_TRANSLATIONS_DIRECTORY)
207 set(_paraview_sm_process_TRANSLATIONS_DIRECTORY
208 "${CMAKE_CURRENT_BINARY_DIR}/Translations")
210 get_property(_header_name TARGET
"${_paraview_sm_process_TARGET}" PROPERTY
"NAME")
211 if (DEFINED _paraview_sm_process_TRANSLATIONS_TARGET)
212 set(xml_header
"${CMAKE_CURRENT_BINARY_DIR}/translationSources${_header_name}.h")
214 TARGET
"${_paraview_sm_process_TRANSLATIONS_TARGET}Header" 215 INPUT_FILES ${_paraview_sm_process_files}
216 RESULT_FILE
"${xml_header}")
218 TARGET
"${_paraview_sm_process_TRANSLATIONS_TARGET}" 219 FILES
"${xml_header}" 220 OUTPUT_TS
"${_paraview_sm_process_TRANSLATIONS_DIRECTORY}/${_paraview_sm_process_TRANSLATIONS_TARGET}")
221 add_dependencies(
"${_paraview_sm_process_TRANSLATIONS_TARGET}" 222 "${_paraview_sm_process_TRANSLATIONS_TARGET}Header")
227 The second way to process XML files directly.
233 [INSTALL_EXPORT <export>])
236 The files passed to the `FILES` argument will be processed in to functions
237 which are then consumed by ParaView applications.
239 The
name of the
target is given to the `TARGET` argument. By
default, the
240 filename is `<TARGET>.h` and it contains a
function named
241 `<TARGET>_initialize`. They may be changed
using the `FILE_NAME` and
242 `FUNCTION_NAME` arguments. The
target has an
interface usage requirement that
243 will allow the generated header to be included.
245 If `INSTALL_EXPORT` is given, the interface target will be added to the given
249 cmake_parse_arguments(_paraview_sm_process_files
251 "TARGET;INSTALL_EXPORT" 255 if (_paraview_sm_process_files_UNPARSED_ARGUMENTS)
257 "Unparsed arguments for paraview_server_manager_process_files: " 258 "${_paraview_sm_process_files_UNPARSED_ARGUMENTS}")
261 if (NOT DEFINED _paraview_sm_process_files_TARGET)
263 "The `TARGET` argument is required.")
266 set(_paraview_sm_process_files_output_dir
267 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_sm_process_files_TARGET}")
268 set(_paraview_sm_process_files_output
269 "${_paraview_sm_process_files_output_dir}/${_paraview_sm_process_files_TARGET}_data.h")
270 set(_paraview_sm_process_files_response_file
271 "${_paraview_sm_process_files_output_dir}/${_paraview_sm_process_files_TARGET}.args")
273 string(REPLACE
";" "\n" _paraview_sm_process_files_input_file_content
274 "${_paraview_sm_process_files_FILES}")
276 OUTPUT
"${_paraview_sm_process_files_response_file}" 277 CONTENT
"${_paraview_sm_process_files_input_file_content}")
279 set(_paraview_sm_process_files_depends_args)
280 if (CMAKE_VERSION VERSION_GREATER_EQUAL
"3.27")
281 list(APPEND _paraview_sm_process_files_depends_args
282 DEPENDS_EXPLICIT_ONLY)
286 OUTPUT
"${_paraview_sm_process_files_output}" 287 DEPENDS ${_paraview_sm_process_files_FILES}
288 "$<TARGET_FILE:ParaView::ProcessXML>" 289 "${_paraview_sm_process_files_response_file}" 290 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}
291 "$<TARGET_FILE:ParaView::ProcessXML>" 292 "${_paraview_sm_process_files_output}" 293 "${_paraview_sm_process_files_TARGET}" 296 "@${_paraview_sm_process_files_response_file}" 297 COMMENT
"Generating server manager headers for ${_paraview_sm_process_files_TARGET}." 298 ${_paraview_sm_process_files_depends_args})
299 add_custom_target(
"${_paraview_sm_process_files_TARGET}_xml_content" 301 "${_paraview_sm_process_files_output}")
303 set(_paraview_sm_process_files_init_content
304 "#ifndef ${_paraview_sm_process_files_TARGET}_h 305 #define ${_paraview_sm_process_files_TARGET}_h 307 #include \"${_paraview_sm_process_files_TARGET}_data.h\" 311 inline void ${_paraview_sm_process_files_TARGET}_initialize(std::vector<std::string>& xmls) 313 foreach (_paraview_sm_process_files_file IN LISTS _paraview_sm_process_files_FILES)
314 get_filename_component(_paraview_sm_process_files_name
"${_paraview_sm_process_files_file}" NAME_WE)
315 string(APPEND _paraview_sm_process_files_init_content
317 char *init_string = ${_paraview_sm_process_files_TARGET}${_paraview_sm_process_files_name}GetInterfaces(); 318 xmls.emplace_back(init_string); 319 delete [] init_string; 322 string(APPEND _paraview_sm_process_files_init_content
328 OUTPUT
"${_paraview_sm_process_files_output_dir}/${_paraview_sm_process_files_TARGET}.h" 329 CONTENT
"${_paraview_sm_process_files_init_content}")
331 add_library(
"${_paraview_sm_process_files_TARGET}" INTERFACE)
332 add_dependencies(
"${_paraview_sm_process_files_TARGET}" 333 "${_paraview_sm_process_files_TARGET}_xml_content")
334 target_include_directories(
"${_paraview_sm_process_files_TARGET}" 336 "$<BUILD_INTERFACE:${_paraview_sm_process_files_output_dir}>")
337 _vtk_module_apply_properties(
"${_paraview_sm_process_files_TARGET}")
338 if (DEFINED _paraview_sm_process_files_INSTALL_EXPORT)
339 set(_vtk_build_INSTALL_EXPORT
340 "${_paraview_sm_process_files_INSTALL_EXPORT}")
342 _vtk_module_install(
"${_paraview_sm_process_files_TARGET}")
function paraview_create_translation()
Generate a Qt translation source file from the given source files.
boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
function paraview_generate_translation_header()
Generate a C++ header with input XML labels and UI strings that can be parsed by Qt Linguist tools...
function paraview_server_manager_process_files()
.md The second way to process XML files directly.
function paraview_server_manager_process()
.md Building XML files
function paraview_add_server_manager_xmls()
.md Server Manager XMLs