ParaViewPlugin.cmake
Go to the documentation of this file.
1 set(_ParaViewPlugin_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
2 
3 #[==[.md
4 # ParaView Plugin CMake API
5 
6 # TODO
7 
8 #]==]
9 
10 #[==[.md
11 ## Finding plugins
12 
13 Similar to VTK modules, plugins first have to be discovered. The
14 `paraview_plugin_find_plugins` function does this. The output variable is the
15 list of discovered `paraview.plugin` files.
16 
17 ```
18 paraview_plugin_find_plugins(<output> [<directory>...])
19 ```
20 #]==]
22  set(_paraview_find_plugins_all)
23  foreach (_paraview_find_plugins_directory IN LISTS ARGN)
24  file(GLOB_RECURSE _paraview_find_plugins_plugins
25  "${_paraview_find_plugins_directory}/paraview.plugin")
26  list(APPEND _paraview_find_plugins_all
27  ${_paraview_find_plugins_plugins})
28  endforeach ()
29  set("${output}" ${_paraview_find_plugins_all} PARENT_SCOPE)
30 endfunction ()
31 
32 #[==[.md
33 ## Plugin files
34 
35 The `paraview.plugin` file is parsed and used as arguments to a CMake function.
36 
37 Example:
38 
39 ```
40 NAME
41  AdiosReaderPixie
42 CONDITION
43  PARAVIEW_USE_MPI
44 DESCRIPTION
45  Pixie file reader using ADIOS
46 REQUIRES_MODULES
47  VTK:CommonCore
48 ```
49 
50 The supported arguments are:
51 
52  * `NAME`: (Required) The name of the plugin.
53  * `DESCRIPTION`: (Recommended) Short text describing what the plugin does.
54  * `CONDITION`: Arguments to CMake's `if` command which may be used to hide
55  the plugin for certain platforms or other reasons. If the expression is
56  false, the module is completely ignored.
57  * `REQUIRES_MODULES`: If the plugin is enabled, these modules will be listed
58  as those required to build the enabled plugins.
59 #]==]
60 macro (_paraview_plugin_parse_args name_output)
61  cmake_parse_arguments("_name"
62  ""
63  "NAME"
64  ""
65  ${ARGN})
66 
67  if (NOT _name_NAME)
68  message(FATAL_ERROR
69  "A ParaView plugin requires a name (from ${_paraview_scan_plugin_file}).")
70  endif ()
71  set("${name_output}" "${_name_NAME}")
72 
73  cmake_parse_arguments("${_name_NAME}"
74  ""
75  "NAME"
76  "DESCRIPTION;REQUIRES_MODULES;CONDITION"
77  ${ARGN})
78 
79  if (${_name_NAME}_UNPARSED_ARGUMENTS)
80  message(FATAL_ERROR
81  "Unparsed arguments for ${_name_NAME}: "
82  "${${_name_NAME}_UNPARSED_ARGUMENTS}")
83  endif ()
84 
85  if (NOT ${_name_NAME}_DESCRIPTION)
86  message(WARNING "The ${_name_NAME} module should have a description")
87  endif ()
88  string(REPLACE ";" " " "${_name_NAME}_DESCRIPTION" "${${_name_NAME}_DESCRIPTION}")
89 endmacro ()
90 
91 #[==[.md
92 ## Scanning plugins
93 
94 Once the `paraview.plugin` files have been found, they need to be scanned to
95 determine which should be built. Generally, plugins should be scanned first in
96 order to use the `REQUIRES_MODULES` list to enable them during the scan for
97 their required modules.
98 
99 ```
100 paraview_plugin_scan(
101  PLUGIN_FILES <file>...
102  PROVIDES_PLUGINS <variable>
103  [ENABLE_BY_DEFAULT <ON|OFF>]
104  [HIDE_PLUGINS_FROM_CACHE <ON|OFF>]
105  [REQUIRES_MODULES <module>...])
106 ```
107 
108  * `PLUGIN_FILES`: (Required) The list of plugin files to scan.
109  * `PROVIDES_PLUGINS`: (Required) This variable contains a list of the plugins
110  to be built.
111  * `ENABLE_BY_DEFAULT`: (Defaults to `OFF`) Whether to enable plugins by
112  default or not.
113  * `HIDE_PLUGINS_FROM_CACHE`: (Defaults to `OFF`) Whether to display options
114  to enable and disable plugins in the cache or not.
115  * `REQUIRES_MODULES`: The list of modules required by the enabled plugins.
116 #]==]
117 
118 function (paraview_plugin_scan)
119  cmake_parse_arguments(_paraview_scan
120  ""
121  "ENABLE_BY_DEFAULT;HIDE_PLUGINS_FROM_CACHE;REQUIRES_MODULES;PROVIDES_PLUGINS"
122  "PLUGIN_FILES"
123  ${ARGN})
124 
125  if (_paraview_scan_UNPARSED_ARGUMENTS)
126  message(FATAL_ERROR
127  "Unparsed arguments for paraview_plugin_scan: "
128  "${_paraview_scan_UNPARSED_ARGUMENTS}")
129  endif ()
130 
131  if (NOT DEFINED _paraview_scan_ENABLE_BY_DEFAULT)
132  set(_paraview_scan_ENABLE_BY_DEFAULT OFF)
133  endif ()
134 
135  if (NOT DEFINED _paraview_scan_HIDE_PLUGINS_FROM_CACHE)
136  set(_paraview_scan_HIDE_PLUGINS_FROM_CACHE OFF)
137  endif ()
138 
139  if (NOT DEFINED _paraview_scan_PROVIDES_PLUGINS)
140  message(FATAL_ERROR
141  "The `PROVIDES_PLUGINS` argument is required.")
142  endif ()
143 
144  if (NOT _paraview_scan_PLUGIN_FILES)
145  message(FATAL_ERROR
146  "No plugin files given to scan.")
147  endif ()
148 
149  set(_paraview_scan_option_default_type BOOL)
150  if (_paraview_scan_HIDE_PLUGINS_FROM_CACHE)
151  set(_paraview_scan_option_default_type INTERNAL)
152  endif ()
153 
154  set(_paraview_scan_provided_plugins)
155  set(_paraview_scan_required_modules)
156 
157  foreach (_paraview_scan_plugin_file IN LISTS _paraview_scan_PLUGIN_FILES)
158  if (NOT IS_ABSOLUTE "${_paraview_scan_plugin_file}")
159  set(_paraview_scan_plugin_file
160  "${CMAKE_CURRENT_SOURCE_DIR}/${_paraview_scan_plugin_file}")
161  endif ()
162 
163  set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND
164  PROPERTY
165  CMAKE_CONFIGURE_DEPENDS "${_paraview_scan_plugin_file}")
166 
167  file(READ "${_paraview_scan_plugin_file}" _paraview_scan_plugin_args)
168  # Replace comments.
169  string(REGEX REPLACE "#[^\n]*\n" "\n" _paraview_scan_plugin_args "${_paraview_scan_plugin_args}")
170  # Use argument splitting.
171  string(REGEX REPLACE "( |\n)+" ";" _paraview_scan_plugin_args "${_paraview_scan_plugin_args}")
172  _paraview_plugin_parse_args(_paraview_scan_plugin_name ${_paraview_scan_plugin_args})
173 
174  list(APPEND _paraview_scan_all_plugins
175  "${_paraview_scan_plugin_name}")
176 
177  set(_paraview_scan_plugin_default "${_paraview_scan_ENABLE_BY_DEFAULT}")
178  if (DEFINED "_paraview_plugin_default_${_paraview_scan_plugin_name}")
179  set(_paraview_scan_plugin_default "${_paraview_plugin_default_${_paraview_scan_plugin_name}}")
180  endif ()
181  option("PARAVIEW_PLUGIN_ENABLE_${_paraview_scan_plugin_name}"
182  "Enable the ${_paraview_scan_plugin_name} plugin. ${${_paraview_scan_plugin_name}_DESCRIPTION}"
183  "${_paraview_scan_plugin_default}")
184  set("_paraview_scan_enable_${_paraview_scan_plugin_name}"
185  "${PARAVIEW_PLUGIN_ENABLE_${_paraview_scan_plugin_name}}")
186 
187  set_property(CACHE "PARAVIEW_PLUGIN_ENABLE_${_paraview_scan_plugin_name}"
188  PROPERTY
189  TYPE "${_paraview_scan_option_default_type}")
190 
191  if (DEFINED ${_paraview_scan_plugin_name}_CONDITION)
192  if (NOT (${${_paraview_scan_plugin_name}_CONDITION}))
193  if (DEFINED "PARAVIEW_PLUGIN_ENABLE_${_paraview_scan_plugin_name}")
194  set_property(CACHE "PARAVIEW_PLUGIN_ENABLE_${_paraview_scan_plugin_name}"
195  PROPERTY
196  TYPE INTERNAL)
197  endif ()
198  continue ()
199  endif ()
200  endif ()
201 
202  if (_paraview_scan_enable_${_paraview_scan_plugin_name})
203  list(APPEND _paraview_scan_provided_plugins
204  "${_paraview_scan_plugin_name}")
205  list(APPEND _paraview_scan_required_modules
206  ${${_paraview_scan_plugin_name}_REQUIRES_MODULES})
207  endif ()
208 
209  set_property(GLOBAL
210  PROPERTY
211  "_paraview_plugin_${_paraview_scan_plugin_name}_file" "${_paraview_scan_plugin_file}")
212  set_property(GLOBAL
213  PROPERTY
214  "_paraview_plugin_${_paraview_scan_plugin_name}_description" "${${_paraview_scan_plugin_name}_DESCRIPTION}")
215  set_property(GLOBAL
216  PROPERTY
217  "_paraview_plugin_${_paraview_scan_plugin_name}_required_modules" "${${_paraview_scan_plugin_name}_REQUIRES_MODULES}")
218  endforeach ()
219 
220  if (DEFINED _paraview_scan_REQUIRES_MODULES)
221  set("${_paraview_scan_REQUIRES_MODULES}"
222  ${_paraview_scan_required_modules}
223  PARENT_SCOPE)
224  endif ()
225 
226  set("${_paraview_scan_PROVIDES_PLUGINS}"
227  ${_paraview_scan_provided_plugins}
228  PARENT_SCOPE)
229 endfunction ()
230 
231 function (_paraview_plugin_check_destdir variable)
232  if (NOT DEFINED "${variable}")
233  message(FATAL_ERROR
234  "It appears as though ${variable} is not defined, but is needed to "
235  "default a destination directory for build artifacts. Usually this is "
236  "resolved by `include(GNUInstallDirs)` at the top of the project.")
237  endif ()
238 endfunction ()
239 
240 #[==[.md
241 ## Building plugins
242 
243 Once all plugins have been scanned, they need to be built.
244 
245 ```
246 paraview_plugin_build(
247  PLUGINS <plugin>...
248  [AUTOLOAD <plugin>...]
249  [PLUGINS_COMPONENT <component>]
250 
251  [TARGET <target>]
252  [INSTALL_EXPORT <export>]
253  [CMAKE_DESTINATION <destination>]
254  [TARGET_COMPONENT <component>]
255  [INSTALL_HEADERS <ON|OFF>]
256 
257  [HEADERS_DESTINATION <destination>]
258  [RUNTIME_DESTINATION <destination>]
259  [LIBRARY_DESTINATION <destination>]
260  [LIBRARY_SUBDIRECTORY <subdirectory>]
261  [ADD_INSTALL_RPATHS <ON|OFF>]
262 
263  [PLUGINS_FILE_NAME <filename>])
264 ```
265 
266  * `PLUGINS`: (Required) The list of plugins to build. May be empty.
267  * `AUTOLOAD`: A list of plugins to mark for autoloading.
268  * `PLUGINS_COMPONENT`: (Defaults to `paraview_plugins`) The installation
269  component to use for installed plugins.
270  * `TARGET`: (Recommended) The name of an interface target to generate. This
271  provides. an initialization function `<TARGET>_initialize` which
272  initializes static plugins. The function is provided, but is a no-op for
273  shared plugin builds.
274  * `INSTALL_EXPORT`: If provided, the generated target will be added to the
275  named export set.
276  * `CMAKE_DESTINATION`: If provided, the plugin target's properties will be
277  written to a file named `<TARGET>-paraview-plugin-properties.cmake` in the
278  specified destination.
279  * `TARGET_COMPONENT`: (Defaults to `development`) The component to use for
280  `<TARGET>`.
281  * `INSTALL_HEADERS`: (Defaults to `ON`) Whether to install headers or not.
282  * `HEADERS_DESTINATION`: (Defaults to `${CMAKE_INSTALL_INCLUDEDIR}`) Where to
283  install include files.
284  * `RUNTIME_DESTINATION`: (Defaults to `${CMAKE_INSTALL_BINDIR}`) Where to
285  install runtime files.
286  * `LIBRARY_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) Where to
287  install modules built by plugins.
288  * `LIBRARY_SUBDIRECTORY`: (Defaults to `""`) Where to install the plugins
289  themselves. Each plugin lives in a directory of its name in
290  `<RUNTIME_DESTINATION>/<LIBRARY_SUBDIRECTORY>` (for Windows) or
291  `<LIBRARY_DESTINATION>/<LIBRARY_SUBDIRECTORY>` for other platforms.
292  * `ADD_INSTALL_RPATHS`: (Defaults to `ON`) If specified, an RPATH to load
293  dependent libraries from the `LIBRARY_DESTINATION` from the plugins will be
294  added.
295  * `PLUGINS_FILE_NAME`: The name of the XML plugin file to generate for the
296  built plugins. This file will be placed under
297  `<LIBRARY_DESTINATION>/<LIBRARY_SUBDIRECTORY>`. It will be installed with
298  the `plugin` component.
299 #]==]
301  cmake_parse_arguments(_paraview_build
302  ""
303  "HEADERS_DESTINATION;RUNTIME_DESTINATION;LIBRARY_DESTINATION;LIBRARY_SUBDIRECTORY;TARGET;PLUGINS_FILE_NAME;INSTALL_EXPORT;CMAKE_DESTINATION;PLUGINS_COMPONENT;TARGET_COMPONENT;ADD_INSTALL_RPATHS;INSTALL_HEADERS"
304  "PLUGINS;AUTOLOAD"
305  ${ARGN})
306 
307  if (_paraview_build_UNPARSED_ARGUMENTS)
308  message(FATAL_ERROR
309  "Unparsed arguments for paraview_plugin_build: "
310  "${_paraview_build_UNPARSED_ARGUMENTS}")
311  endif ()
312 
313  if (NOT DEFINED _paraview_build_HEADERS_DESTINATION)
314  _paraview_plugin_check_destdir(CMAKE_INSTALL_INCLUDEDIR)
315  set(_paraview_build_HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
316  endif ()
317 
318  if (NOT DEFINED _paraview_build_RUNTIME_DESTINATION)
319  _paraview_plugin_check_destdir(CMAKE_INSTALL_BINDIR)
320  set(_paraview_build_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}")
321  endif ()
322 
323  if (NOT DEFINED _paraview_build_LIBRARY_DESTINATION)
324  _paraview_plugin_check_destdir(CMAKE_INSTALL_LIBDIR)
325  set(_paraview_build_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
326  endif ()
327 
328  if (NOT DEFINED _paraview_build_LIBRARY_SUBDIRECTORY)
329  set(_paraview_build_LIBRARY_SUBDIRECTORY "")
330  endif ()
331 
332  if (NOT DEFINED _paraview_build_INSTALL_HEADERS)
333  set(_paraview_build_INSTALL_HEADERS ON)
334  endif ()
335 
336  if (NOT DEFINED _paraview_build_ADD_INSTALL_RPATHS)
337  set(_paraview_build_ADD_INSTALL_RPATHS ON)
338  endif ()
339  if (_paraview_build_ADD_INSTALL_RPATHS)
340  if (NOT _paraview_build_LIBRARY_SUBDIRECTORY STREQUAL "")
341  file(RELATIVE_PATH _paraview_build_relpath
342  "/prefix/${_paraview_build_LIBRARY_DESTINATION}/${_paraview_build_LIBRARY_SUBDIRECTORY}/plugin"
343  "/prefix/${_paraview_build_LIBRARY_DESTINATION}")
344  else ()
345  file(RELATIVE_PATH _paraview_build_relpath
346  "/prefix/${_paraview_build_LIBRARY_DESTINATION}/plugin"
347  "/prefix/${_paraview_build_LIBRARY_DESTINATION}")
348  endif ()
349  if (APPLE)
350  list(APPEND CMAKE_INSTALL_RPATH
351  "@loader_path/${_paraview_build_relpath}")
352  elseif (UNIX)
353  list(APPEND CMAKE_INSTALL_RPATH
354  "$ORIGIN/${_paraview_build_relpath}")
355  endif ()
356  endif ()
357 
358  if (DEFINED _paraview_build_INSTALL_EXPORT
359  AND NOT DEFINED _paraview_build_TARGET)
360  message(FATAL_ERROR
361  "The `INSTALL_EXPORT` argument requires the `TARGET` argument.")
362  endif ()
363 
364  if (DEFINED _paraview_build_INSTALL_EXPORT
365  AND NOT DEFINED _paraview_build_CMAKE_DESTINATION)
366  message(FATAL_ERROR
367  "The `INSTALL_EXPORT` argument requires the `CMAKE_DESTINATION` argument.")
368  endif ()
369 
370  set(_paraview_build_extra_destinations)
371  if (DEFINED _paraview_build_CMAKE_DESTINATION)
372  list(APPEND _paraview_build_extra_destinations
373  CMAKE_DESTINATION)
374  if (NOT DEFINED _paraview_build_TARGET)
375  message(FATAL_ERROR
376  "The `CMAKE_DESTINATION` argument requires the `TARGET` argument.")
377  endif ()
378  endif ()
379 
380  if (DEFINED _paraview_build_TARGET)
381  _vtk_module_split_module_name("${_paraview_build_TARGET}" _paraview_build)
382  string(REPLACE "::" "_" _paraview_build_target_safe "${_paraview_build_TARGET}")
383  endif ()
384 
385  _vtk_module_check_destinations(_paraview_build_
386  HEADERS_DESTINATION
387  RUNTIME_DESTINATION
388  LIBRARY_DESTINATION
389  LIBRARY_SUBDIRECTORY
390  ${_paraview_build_extra_destinations})
391 
392  if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
393  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_build_RUNTIME_DESTINATION}")
394  endif ()
395  if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
396  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_build_LIBRARY_DESTINATION}")
397  endif ()
398  if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
399  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_build_LIBRARY_DESTINATION}")
400  endif ()
401 
402  if (WIN32)
403  set(_paraview_build_plugin_destination "${_paraview_build_RUNTIME_DESTINATION}")
404  else ()
405  set(_paraview_build_plugin_destination "${_paraview_build_LIBRARY_DESTINATION}")
406  endif ()
407  if (NOT _paraview_build_LIBRARY_SUBDIRECTORY STREQUAL "")
408  string(APPEND _paraview_build_plugin_destination "/${_paraview_build_LIBRARY_SUBDIRECTORY}")
409  endif ()
410 
411  foreach (_paraview_build_plugin IN LISTS _paraview_build_PLUGINS)
412  get_property(_paraview_build_plugin_file GLOBAL
413  PROPERTY "_paraview_plugin_${_paraview_build_plugin}_file")
414  if (NOT _paraview_build_plugin_file)
415  message(FATAL_ERROR
416  "The requested ${_paraview_build_plugin} plugin is not a ParaView plugin.")
417  endif ()
418 
419  # TODO: Support external plugins?
420  get_filename_component(_paraview_build_plugin_dir "${_paraview_build_plugin_file}" DIRECTORY)
421  file(RELATIVE_PATH _paraview_build_plugin_subdir "${CMAKE_SOURCE_DIR}" "${_paraview_build_plugin_dir}")
422  add_subdirectory(
423  "${CMAKE_SOURCE_DIR}/${_paraview_build_plugin_subdir}"
424  "${CMAKE_BINARY_DIR}/${_paraview_build_plugin_subdir}")
425  endforeach ()
426 
427  if (DEFINED _paraview_build_TARGET)
428  add_library("${_paraview_build_TARGET_NAME}" INTERFACE)
429  if (_paraview_build_NAMESPACE)
430  add_library("${_paraview_build_TARGET}" ALIAS "${_paraview_build_TARGET_NAME}")
431  endif ()
432  target_include_directories("${_paraview_build_TARGET_NAME}"
433  INTERFACE
434  "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_build_target_safe}>"
435  "$<INSTALL_INTERFACE:${_paraview_build_HEADERS_DESTINATION}>")
436  set(_paraview_build_include_file
437  "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_build_target_safe}/${_paraview_build_target_safe}.h")
438 
439  set(_paraview_static_plugins)
440  foreach (_paraview_build_plugin IN LISTS _paraview_build_PLUGINS)
441  get_property(_paraview_build_plugin_type
442  TARGET "${_paraview_build_plugin}"
443  PROPERTY TYPE)
444  if (_paraview_build_plugin_type STREQUAL "STATIC_LIBRARY")
445  list(APPEND _paraview_static_plugins
446  "${_paraview_build_plugin}")
447  endif ()
448  endforeach ()
449 
450  if (_paraview_static_plugins)
451  target_link_libraries("${_paraview_build_TARGET_NAME}"
452  INTERFACE
453  ParaView::RemotingCore
454  ${_paraview_static_plugins})
455 
456  set(_paraview_build_declarations)
457  set(_paraview_build_calls)
458  set(_paraview_build_names)
459  foreach (_paraview_build_plugin IN LISTS _paraview_static_plugins)
460  string(APPEND _paraview_build_declarations
461  "PV_PLUGIN_IMPORT_INIT(${_paraview_build_plugin});\n")
462  string(APPEND _paraview_build_calls
463  " if (sname == \"${_paraview_build_plugin}\")
464  {
465  if (load)
466  {
467  static bool loaded = false;
468  if (!loaded)
469  {
470  loaded = PV_PLUGIN_IMPORT(${_paraview_build_plugin});
471  }
472  }
473  return true;
474  }\n\n")
475  string(APPEND _paraview_build_names
476  " names.push_back(\"${_paraview_build_plugin}\");\n")
477  endforeach ()
478 
479  set(_paraview_build_include_content
480  "#ifndef ${_paraview_build_target_safe}_h
481 #define ${_paraview_build_target_safe}_h
482 
483 #define PARAVIEW_BUILDING_PLUGIN
484 #define PARAVIEW_PLUGIN_BUILT_SHARED 0
485 #include \"vtkPVPlugin.h\"
486 #include \"vtkPVPluginLoader.h\"
487 #include \"vtkPVPluginTracker.h\"
488 #include <string>
489 
490 ${_paraview_build_declarations}
491 static bool ${_paraview_build_target_safe}_static_plugins_load(const char* name);
492 static bool ${_paraview_build_target_safe}_static_plugins_search(const char* name);
493 static void ${_paraview_build_target_safe}_static_plugins_list(const char* appname, std::vector<std::string>& names);
494 
495 static void ${_paraview_build_target_safe}_initialize()
496 {
497  vtkPVPluginLoader::RegisterLoadPluginCallback(${_paraview_build_target_safe}_static_plugins_load);
498  vtkPVPluginTracker::RegisterStaticPluginSearchFunction(${_paraview_build_target_safe}_static_plugins_search);
499  vtkPVPluginTracker::RegisterStaticPluginListFunction(${_paraview_build_target_safe}_static_plugins_list);
500 }
501 
502 static bool ${_paraview_build_target_safe}_static_plugins_func(const char* name, bool load);
503 
504 static bool ${_paraview_build_target_safe}_static_plugins_load(const char* name)
505 {
506  return ${_paraview_build_target_safe}_static_plugins_func(name, true);
507 }
508 
509 static bool ${_paraview_build_target_safe}_static_plugins_search(const char* name)
510 {
511  return ${_paraview_build_target_safe}_static_plugins_func(name, false);
512 }
513 
514 static void ${_paraview_build_target_safe}_static_plugins_list(const char* appname, std::vector<std::string>& names)
515 {
516 ${_paraview_build_names}
517  (void) appname;
518  (void) names;
519 }
520 
521 static bool ${_paraview_build_target_safe}_static_plugins_func(const char* name, bool load)
522 {
523  std::string const sname = name;
524 
525 ${_paraview_build_calls}
526  return false;
527 }
528 
529 #endif\n")
530  else ()
531  set(_paraview_build_include_content
532  "#ifndef ${_paraview_build_target_safe}_h
533 #define ${_paraview_build_target_safe}_h
534 
535 void ${_paraview_build_target_safe}_initialize()
536 {
537 }
538 
539 #endif\n")
540  endif ()
541 
542  file(GENERATE
543  OUTPUT "${_paraview_build_include_file}"
544  CONTENT "${_paraview_build_include_content}")
545  if (_paraview_build_INSTALL_HEADERS)
546  install(
547  FILES "${_paraview_build_include_file}"
548  DESTINATION "${_paraview_build_HEADERS_DESTINATION}"
549  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
550  endif ()
551 
552  if (DEFINED _paraview_build_INSTALL_EXPORT)
553  install(
554  TARGETS "${_paraview_build_TARGET_NAME}"
555  EXPORT "${_paraview_build_INSTALL_EXPORT}"
556  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
557 
558  set(_paraview_build_required_exports_include_file_name "${_paraview_build_INSTALL_EXPORT}-${_paraview_build_TARGET_NAME}-targets-depends.cmake")
559  set(_paraview_build_required_exports_include_build_file
560  "${CMAKE_BINARY_DIR}/${_paraview_build_CMAKE_DESTINATION}/${_paraview_build_required_exports_include_file_name}")
561  set(_paraview_build_required_exports_include_contents "")
562  get_property(_paraview_build_required_exports GLOBAL
563  PROPERTY "paraview_plugin_${_paraview_build_TARGET}_required_exports")
564  if (_paraview_build_required_exports)
565  foreach (_paraview_build_required_export IN LISTS _paraview_build_required_exports)
566  string(APPEND _paraview_build_required_exports_include_contents
567  "include(\"\${CMAKE_CURRENT_LIST_DIR}/${_paraview_build_required_export}-targets.cmake\")\n"
568  "include(\"\${CMAKE_CURRENT_LIST_DIR}/${_paraview_build_required_export}-vtk-module-properties.cmake\")\n"
569  "\n")
570 
571  get_property(_paraview_build_modules GLOBAL
572  PROPERTY "paraview_plugin_${_paraview_build_required_export}_modules")
573  if (_paraview_build_modules)
575  CMAKE_DESTINATION "${_paraview_build_CMAKE_DESTINATION}"
576  FILE_NAME "${_paraview_build_required_export}-vtk-module-find-packages.cmake"
577  MODULES ${_paraview_build_modules})
578 
579  # TODO: The list of modules should be checked for their `_FOUND`
580  # variables being false and propagate it up through the parent
581  # project's `_FOUND` variable.
582  string(APPEND _paraview_build_required_exports_include_contents
583  "set(CMAKE_FIND_PACKAGE_NAME_save \"\${CMAKE_FIND_PACKAGE_NAME}\")\n"
584  "set(${_paraview_build_required_export}_FIND_QUIETLY \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY}\")\n"
585  "set(${_paraview_build_required_export}_FIND_COMPONENTS)\n"
586  "set(CMAKE_FIND_PACKAGE_NAME \"${_paraview_build_required_export}\")\n"
587  "include(\"\${CMAKE_CURRENT_LIST_DIR}/${_paraview_build_required_export}-vtk-module-find-packages.cmake\")\n"
588  "set(CMAKE_FIND_PACKAGE_NAME \"\${CMAKE_FIND_PACKAGE_NAME_save}\")\n"
589  "unset(${_paraview_build_required_export}_FIND_QUIETLY)\n"
590  "unset(${_paraview_build_required_export}_FIND_COMPONENTS)\n"
591  "unset(CMAKE_FIND_PACKAGE_NAME_save)\n"
592  "\n"
593  "\n")
594  endif ()
595  endforeach ()
596  endif ()
597  file(GENERATE
598  OUTPUT "${_paraview_build_required_exports_include_build_file}"
599  CONTENT "${_paraview_build_required_exports_include_contents}")
600  if (_paraview_build_INSTALL_HEADERS)
601  install(
602  FILES "${_paraview_build_required_exports_include_build_file}"
603  DESTINATION "${_paraview_build_CMAKE_DESTINATION}"
604  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
605  endif ()
606 
607  set(_paraview_build_namespace_args)
608  if (_paraview_build_NAMESPACE)
609  list(APPEND _paraview_build_namespace_args
610  NAMESPACE "${_paraview_build_NAMESPACE}::")
611  endif ()
612 
613  if (_paraview_build_INSTALL_HEADERS)
614  export(
615  EXPORT "${_paraview_build_INSTALL_EXPORT}"
616  ${_paraview_build_namespace_args}
617  FILE "${CMAKE_BINARY_DIR}/${_paraview_build_CMAKE_DESTINATION}/${_paraview_build_INSTALL_EXPORT}-targets.cmake")
618  install(
619  EXPORT "${_paraview_build_INSTALL_EXPORT}"
620  DESTINATION "${_paraview_build_CMAKE_DESTINATION}"
621  ${_paraview_build_namespace_args}
622  FILE "${_paraview_build_INSTALL_EXPORT}-targets.cmake"
623  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
624  endif ()
625  endif ()
626  endif ()
627 
628  if (DEFINED _paraview_build_PLUGINS_FILE_NAME)
629  set(_paraview_build_xml_file
630  "${CMAKE_BINARY_DIR}/${_paraview_build_plugin_destination}/${_paraview_build_PLUGINS_FILE_NAME}")
631  set(_paraview_build_xml_content
632  "<?xml version=\"1.0\"?>\n<Plugins>\n")
633  foreach (_paraview_build_plugin IN LISTS _paraview_build_PLUGINS)
634  set(_paraview_build_autoload 0)
635  if (_paraview_build_plugin IN_LIST _paraview_build_AUTOLOAD)
636  set(_paraview_build_autoload 1)
637  endif ()
638  string(APPEND _paraview_build_xml_content
639  " <Plugin name=\"${_paraview_build_plugin}\" auto_load=\"${_paraview_build_autoload}\"/>\n")
640  endforeach ()
641  string(APPEND _paraview_build_xml_content
642  "</Plugins>\n")
643 
644  file(GENERATE
645  OUTPUT "${_paraview_build_xml_file}"
646  CONTENT "${_paraview_build_xml_content}")
647  install(
648  FILES "${_paraview_build_xml_file}"
649  DESTINATION "${_paraview_build_plugin_destination}"
650  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
651 
652  if (DEFINED _paraview_build_INSTALL_EXPORT)
653  set_property(TARGET "${_paraview_build_TARGET_NAME}"
654  PROPERTY
655  "INTERFACE_paraview_plugin_plugins_file" "${_paraview_build_xml_file}")
656 
657  if (DEFINED _paraview_build_RUNTIME_DESTINATION)
658  set_property(TARGET "${_paraview_build_TARGET_NAME}"
659  PROPERTY
660  "INTERFACE_paraview_plugin_plugins_file_install" "${_paraview_build_plugin_destination}/${_paraview_build_PLUGINS_FILE_NAME}")
661  endif ()
662 
663  if (DEFINED _paraview_build_CMAKE_DESTINATION)
664  set(_paraview_build_properties_filename "${_paraview_build_INSTALL_EXPORT}-paraview-plugin-properties.cmake")
665  set(_paraview_build_properties_build_file
666  "${CMAKE_BINARY_DIR}/${_paraview_build_CMAKE_DESTINATION}/${_paraview_build_properties_filename}")
667  set(_paraview_build_properties_install_file
668  "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_build_properties_filename}.install")
669 
670  file(WRITE "${_paraview_build_properties_build_file}")
671  file(WRITE "${_paraview_build_properties_install_file}")
672 
673  _vtk_module_write_import_prefix(
674  "${_paraview_build_properties_install_file}"
675  "${_paraview_build_CMAKE_DESTINATION}")
676 
677  file(APPEND "${_paraview_build_properties_build_file}"
678  "set_property(TARGET \"${_paraview_build_TARGET}\"
679  PROPERTY
680  INTERFACE_paraview_plugin_plugins_file \"${_paraview_build_xml_file}\")\n")
681  file(APPEND "${_paraview_build_properties_install_file}"
682  "set_property(TARGET \"${_paraview_build_TARGET}\"
683  PROPERTY
684  INTERFACE_paraview_plugin_plugins_file \"\${_vtk_module_import_prefix}/${_paraview_build_plugin_destination}/${_paraview_build_PLUGINS_FILE_NAME}\")
685 unset(_vtk_module_import_prefix)\n")
686 
687  if (_paraview_build_INSTALL_HEADERS)
688  install(
689  FILES "${_paraview_build_properties_install_file}"
690  DESTINATION "${_paraview_build_CMAKE_DESTINATION}"
691  RENAME "${_paraview_build_properties_filename}"
692  COMPONENT "${_paraview_build_TARGET_COMPONENT}")
693  endif ()
694  endif ()
695  endif ()
696  endif ()
697 endfunction ()
698 
699 #[==[.md
700 ## Plugin configuration files
701 
702 Applications will want to consume plugin targets by discovering their locations
703 at runtime. In order to facilitate this, ParaView supports loading a `conf`
704 file which contains the locations of plugin targets' XML files. The plugins
705 specified in that file is then
706 
707 ```
709  NAME <name>
710  PLUGINS_TARGETS <target>...
711  BUILD_DESTINATION <destination>
712 
713  [INSTALL_DESTINATION <destination>]
714  [COMPONENT <component>])
715 ```
716 
717  * `NAME`: (Required) The base name of the configuration file.
718  * `PLUGINS_TARGETS`: (Required) The list of plugin targets to add to the
719  configuration file.
720  * `BUILD_DESTINATION`: (Required) Where to place the configuration file in
721  the build tree.
722  * `INSTALL_DESTINATION`: Where to install the configuration file in the
723  install tree. If not provided, the configuration file will not be
724  installed.
725  * `COMPONENT`: (Defaults to `runtime`) The component to use when installing
726  the configuration file.
727 #]==]
729  cmake_parse_arguments(_paraview_plugin_conf
730  ""
731  "NAME;BUILD_DESTINATION;INSTALL_DESTINATION;COMPONENT"
732  "PLUGINS_TARGETS"
733  ${ARGN})
734 
735  if (_paraview_plugin_conf_UNPARSED_ARGUMENTS)
736  message(FATAL_ERROR
737  "Unparsed arguments for paraview_plugin_write_conf: "
738  "${_paraview_plugin_conf_UNPARSED_ARGUMENTS}")
739  endif ()
740 
741  if (NOT _paraview_plugin_conf_NAME)
742  message(FATAL_ERROR
743  "The `NAME` must not be empty.")
744  endif ()
745 
746  if (NOT DEFINED _paraview_plugin_conf_BUILD_DESTINATION)
747  message(FATAL_ERROR
748  "The `BUILD_DESTINATION` argument is required.")
749  endif ()
750 
751  if (NOT DEFINED _paraview_plugin_conf_PLUGINS_TARGETS)
752  message(FATAL_ERROR
753  "The `PLUGINS_TARGETS` argument is required.")
754  endif ()
755 
756  if (NOT DEFINED _paraview_plugin_conf_COMPONENT)
757  set(_paraview_plugin_conf_COMPONENT "runtime")
758  endif ()
759 
760  set(_paraview_plugin_conf_file_name
761  "${_paraview_plugin_conf_NAME}.conf")
762  set(_paraview_plugin_conf_build_file
763  "${CMAKE_BINARY_DIR}/${_paraview_plugin_conf_BUILD_DESTINATION}/${_paraview_plugin_conf_file_name}")
764  set(_paraview_plugin_conf_install_file
765  "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_plugin_conf_file_name}.install")
766  set(_paraview_plugin_conf_build_contents)
767  set(_paraview_plugin_conf_install_contents)
768  foreach (_paraview_plugin_conf_target IN LISTS _paraview_plugin_conf_PLUGINS_TARGETS)
769  get_property(_paraview_plugin_conf_plugins_target_is_imported
770  TARGET "${_paraview_plugin_conf_target}"
771  PROPERTY IMPORTED)
772  if (_paraview_plugin_conf_plugins_target_is_imported)
773  get_property(_paraview_plugin_conf_plugins_target_xml_build
774  TARGET "${_paraview_plugin_conf_target}"
775  PROPERTY "INTERFACE_paraview_plugin_plugins_file")
776  set(_paraview_plugin_conf_plugins_target_xml_install
777  "${_paraview_plugin_conf_plugins_target_xml_build}")
778 
779  file(RELATIVE_PATH _paraview_plugin_conf_rel_path
780  "/prefix/${CMAKE_INSTALL_PREFIX}"
781  "/prefix/${_paraview_plugin_conf_plugins_target_xml_install}")
782  # If the external plugins XML file is under our installation destination,
783  # use a relative path to it, otherwise keep the absolute path.
784  if (NOT _paraview_plugin_conf_rel_path MATCHES "^\.\./")
785  file(RELATIVE_PATH _paraview_plugin_conf_plugins_target_xml_install
786  "/prefix/${CMAKE_INSTALL_PREFIX}/${_paraview_plugin_conf_INSTALL_DESTINATION}"
787  "/prefix/${_paraview_plugin_conf_plugins_target_xml_install}")
788  endif ()
789  else ()
790  get_property(_paraview_plugin_conf_plugins_target_is_alias
791  TARGET "${_paraview_plugin_conf_target}"
792  PROPERTY ALIASED_TARGET
793  SET)
794  if (_paraview_plugin_conf_plugins_target_is_alias)
795  get_property(_paraview_plugin_conf_target
796  TARGET "${_paraview_plugin_conf_target}"
797  PROPERTY ALIASED_TARGET)
798  endif ()
799  get_property(_paraview_plugin_conf_plugins_target_xml_build
800  TARGET "${_paraview_plugin_conf_target}"
801  PROPERTY "INTERFACE_paraview_plugin_plugins_file")
802  get_property(_paraview_plugin_conf_plugins_target_xml_install
803  TARGET "${_paraview_plugin_conf_target}"
804  PROPERTY "INTERFACE_paraview_plugin_plugins_file_install")
805 
806  if (_paraview_plugin_conf_plugins_target_xml_install)
807  # Compute the relative path within the install tree.
808  file(RELATIVE_PATH _paraview_plugin_conf_plugins_target_xml_install
809  "/prefix/${_paraview_plugin_conf_INSTALL_DESTINATION}"
810  "/prefix/${_paraview_plugin_conf_plugins_target_xml_install}")
811  endif ()
812  endif ()
813 
814  # TODO: Write out in JSON instead.
815  if (_paraview_plugin_conf_plugins_target_xml_build)
816  string(APPEND _paraview_plugin_conf_build_contents
817  "${_paraview_plugin_conf_plugins_target_xml_build}\n")
818  endif ()
819  if (_paraview_plugin_conf_plugins_target_xml_install)
820  string(APPEND _paraview_plugin_conf_install_contents
821  "${_paraview_plugin_conf_plugins_target_xml_install}\n")
822  endif ()
823  endforeach ()
824 
825  file(GENERATE
826  OUTPUT "${_paraview_plugin_conf_build_file}"
827  CONTENT "${_paraview_plugin_conf_build_contents}")
828 
829  if (_paraview_plugin_conf_INSTALL_DESTINATION)
830  file(GENERATE
831  OUTPUT "${_paraview_plugin_conf_install_file}"
832  CONTENT "${_paraview_plugin_conf_install_contents}")
833  install(
834  FILES "${_paraview_plugin_conf_install_file}"
835  DESTINATION "${_paraview_plugin_conf_INSTALL_DESTINATION}"
836  RENAME "${_paraview_plugin_conf_file_name}"
837  COMPONENT "${_paraview_plugin_conf_COMPONENT}")
838  endif ()
839 endfunction ()
840 
841 set(_paraview_plugin_source_dir "${CMAKE_CURRENT_LIST_DIR}")
842 
843 #[==[.md
844 ## Adding a plugin
845 
846 TODO: Describe.
847 
848 ```
850  [REQUIRED_ON_SERVER] [REQUIRED_ON_CLIENT]
851  VERSION <version>
852 
853  [MODULE_FILES <vtk.module>...]
854  [MODULE_ARGS <arg>...]
855  [MODULES <module>...]
856  [SOURCES <source>...]
857  [SERVER_MANAGER_XML <xml>...]
858  [MODULE_INSTALL_EXPORT <export>]
859 
860  [UI_INTERFACES <interface>...]
861  [UI_RESOURCES <resource>...]
862  [UI_FILES <file>...]
863 
864  [PYTHON_MODULES <module>...]
865 
866  [REQUIRED_PLUGINS <plugin>...]
867 
868  [EULA <eula>]
869  [XML_DOCUMENTATION <ON|OFF>]
870  [DOCUMENTATION_DIR <directory>]
871 
872  [FORCE_STATIC <ON|OFF>])
873 ```
874 
875  * `REQUIRED_ON_SERVER`: The plugin is required to be loaded on the server for
876  proper functionality.
877  * `REQUIRED_ON_CLIENT`: The plugin is required to be loaded on the client for
878  proper functionality.
879  * `VERSION`: (Required) The version number of the plugin.
880  * `MODULE_FILES`: Paths to `vtk.module` files describing modules to include
881  in the plugin.
882  * `MODULE_ARGS`: Arguments to pass to `vtk_module_build` for included modules.
883  * `MODULES`: Modules to include in the plugin. These modules will be wrapped
884  using client server and have their server manager XML files processed.
885  * `SOURCES`: Source files for the plugin.
886  * `SERVER_MANAGER_XML`: Server manager XML files for the plugin.
887  * `UI_INTERFACES`: Interfaces to initialize, in the given order. See the
888  plugin interfaces section for more details.
889  * `MODULE_INSTALL_EXPORT`: (Defaults to `<name>`) If provided, any modules
890  will be added to the given export set.
891  * `UI_RESOURCES`: Qt resource files to include with the plugin.
892  * `UI_FILES`: Qt `.ui` files to include with the plugin.
893  * `PYTHON_MODULES`: Python modules to embed into the plugin.
894  * `REQUIRED_PLUGINS`: Plugins which must be loaded for this plugin to
895  function. These plugins do not need to be available at build time and are
896  therefore their existence is not checked here.
897  * `EULA`: A file with content to display as an end-user license agreement
898  before the plugin is initialized at runtime.
899  * `XML_DOCUMENTATION`: (Defaults to `ON`) If set, documentation will be
900  generated for the associated XML files.
901  * `DOCUMENTATION_DIR`: If specified, `*.html`, `*.css`, `*.png`, and `*.jpg`
902  files in this directory will be copied and made available to the
904  * `EXPORT`: (Deprecated) Use `paraview_plugin_build(INSTALL_EXPORT)` instead.
905  * `FORCE_STATIC`: (Defaults to `OFF`) If set, the plugin will be built
906  statically so that it can be embedded into an application.
907 #]==]
909  if (NOT name STREQUAL _paraview_build_plugin)
910  message(FATAL_ERROR
911  "The ${_paraview_build_plugin}'s CMakeLists.txt may not add the ${name} "
912  "plugin.")
913  endif ()
914 
915  cmake_parse_arguments(_paraview_add_plugin
916  "REQUIRED_ON_SERVER;REQUIRED_ON_CLIENT"
917  "VERSION;EULA;EXPORT;MODULE_INSTALL_EXPORT;XML_DOCUMENTATION;DOCUMENTATION_DIR;FORCE_STATIC"
918  "REQUIRED_PLUGINS;SERVER_MANAGER_XML;SOURCES;MODULES;UI_INTERFACES;UI_RESOURCES;UI_FILES;PYTHON_MODULES;MODULE_FILES;MODULE_ARGS"
919  ${ARGN})
920 
921  if (_paraview_add_plugin_UNPARSED_ARGUMENTS)
922  message(FATAL_ERROR
923  "Unparsed arguments for paraview_add_plugin: "
924  "${_paraview_add_plugin_UNPARSED_ARGUMENTS}")
925  endif ()
926 
927  if (NOT DEFINED _paraview_add_plugin_VERSION)
928  message(FATAL_ERROR
929  "The `VERSION` argument is required.")
930  endif ()
931 
932  if (NOT DEFINED _paraview_add_plugin_XML_DOCUMENTATION)
933  set(_paraview_add_plugin_XML_DOCUMENTATION ON)
934  endif ()
935 
936  if (NOT DEFINED _paraview_add_plugin_FORCE_STATIC)
937  set(_paraview_add_plugin_FORCE_STATIC OFF)
938  endif ()
939 
940  if (DEFINED _paraview_add_plugin_DOCUMENTATION_DIR AND
941  NOT _paraview_add_plugin_XML_DOCUMENTATION)
942  message(FATAL_ERROR
943  "Specifying `DOCUMENTATION_DIR` and turning off `XML_DOCUMENTATION` "
944  "makes no sense.")
945  endif ()
946 
947  if (DEFINED _paraview_add_plugin_EXPORT)
948  message(FATAL_ERROR
949  "The `paraview_add_plugin(EXPORT)` argument is ignored in favor of "
950  "`paraview_plugin_build(INSTALL_EXPORT)`.")
951  endif ()
952 
953  if (_paraview_add_plugin_MODULE_ARGS)
954  if (NOT _paraview_add_plugin_MODULE_FILES OR
955  NOT _paraview_add_plugin_MODULES)
956  message(FATAL_ERROR
957  "The `MODULE_ARGS` argument requires `MODULE_FILES` and `MODULES` to be provided.")
958  endif ()
959  endif ()
960 
961  if (DEFINED _paraview_build_INSTALL_EXPORT AND
962  NOT DEFINED _paraview_add_plugin_MODULE_INSTALL_EXPORT)
963  set(_paraview_add_plugin_MODULE_INSTALL_EXPORT
964  "${name}")
965  endif ()
966 
967  if (_paraview_add_plugin_MODULE_FILES)
968  if (NOT _paraview_add_plugin_MODULES)
969  message(FATAL_ERROR
970  "The `MODULE_FILES` argument requires `MODULES` to be provided.")
971  endif ()
972 
973  if (_paraview_build_ADD_INSTALL_RPATHS)
974  if (APPLE)
975  list(INSERT CMAKE_INSTALL_RPATH 0
976  "@loader_path")
977  elseif (UNIX)
978  list(INSERT CMAKE_INSTALL_RPATH 0
979  "$ORIGIN")
980  endif ()
981  endif ()
982 
983  set(_paraview_add_plugin_module_install_export_args)
984  if (DEFINED _paraview_add_plugin_MODULE_INSTALL_EXPORT)
985  list(APPEND _paraview_add_plugin_module_install_export_args
986  INSTALL_EXPORT "${_paraview_add_plugin_MODULE_INSTALL_EXPORT}")
987  if (DEFINED _paraview_build_TARGET)
988  set_property(GLOBAL APPEND
989  PROPERTY
990  "paraview_plugin_${_paraview_build_TARGET}_required_exports" "${_paraview_add_plugin_MODULE_INSTALL_EXPORT}")
991  endif ()
992  endif ()
993 
995  MODULE_FILES ${_paraview_add_plugin_MODULE_FILES}
996  REQUEST_MODULES ${_paraview_add_plugin_MODULES}
997  PROVIDES_MODULES plugin_modules
998  REQUIRES_MODULES required_modules
999  HIDE_MODULES_FROM_CACHE ON)
1000 
1001  if (required_modules)
1002  foreach (required_module IN LISTS required_modules)
1003  if (NOT TARGET "${required_module}")
1004  message(FATAL_ERROR
1005  "Failed to find the required module ${required_module}.")
1006  endif ()
1007  endforeach ()
1008  endif ()
1009 
1010  if (WIN32)
1011  set(_paraview_plugin_subdir "${_paraview_build_RUNTIME_DESTINATION}")
1012  else ()
1013  set(_paraview_plugin_subdir "${_paraview_build_LIBRARY_DESTINATION}")
1014  endif ()
1015  if (NOT _paraview_build_LIBRARY_SUBDIRECTORY STREQUAL "")
1016  string(APPEND _paraview_plugin_subdir "/${_paraview_build_LIBRARY_SUBDIRECTORY}")
1017  endif ()
1018  string(APPEND _paraview_plugin_subdir "/${_paraview_build_plugin}")
1019  set(_paraview_plugin_CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
1020  set(_paraview_plugin_CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
1021  set(_paraview_plugin_CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
1022  set(_paraview_plugin_CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_NAME_DIR}")
1023  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_plugin_subdir}")
1024  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_plugin_subdir}")
1025  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_paraview_plugin_subdir}")
1026  set(CMAKE_INSTALL_NAME_DIR "@loader_path")
1027 
1029  MODULES ${plugin_modules}
1030  PACKAGE "${_paraview_build_plugin}"
1031  ${_paraview_add_plugin_module_install_export_args}
1032  INSTALL_HEADERS "${_paraview_build_INSTALL_HEADERS}"
1033  TARGETS_COMPONENT "${_paraview_build_PLUGINS_COMPONENT}"
1034  HEADERS_DESTINATION "${_paraview_build_HEADERS_DESTINATION}/${_paraview_build_target_safe}"
1035  ARCHIVE_DESTINATION "${_paraview_plugin_subdir}"
1036  LIBRARY_DESTINATION "${_paraview_plugin_subdir}"
1037  RUNTIME_DESTINATION "${_paraview_plugin_subdir}"
1038  CMAKE_DESTINATION "${_paraview_build_CMAKE_DESTINATION}"
1039  ${_paraview_add_plugin_MODULE_ARGS})
1040 
1041  set_property(GLOBAL APPEND
1042  PROPERTY
1043  "paraview_plugin_${_paraview_add_plugin_MODULE_INSTALL_EXPORT}_modules" "${plugin_modules}")
1044 
1045  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${_paraview_plugin_CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
1046  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${_paraview_plugin_CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
1047  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${_paraview_plugin_CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
1048  set(CMAKE_INSTALL_NAME_DIR "${_paraview_plugin_CMAKE_INSTALL_NAME_DIR}")
1049  unset(_paraview_plugin_CMAKE_RUNTIME_OUTPUT_DIRECTORY)
1050  unset(_paraview_plugin_CMAKE_LIBRARY_OUTPUT_DIRECTORY)
1051  unset(_paraview_plugin_CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
1052  unset(_paraview_plugin_CMAKE_INSTALL_NAME_DIR)
1053  endif ()
1054 
1055  # TODO: resource initialization for static builds
1056 
1057  if (_paraview_add_plugin_REQUIRED_ON_SERVER)
1058  set(_paraview_add_plugin_required_on_server "true")
1059  else ()
1060  set(_paraview_add_plugin_required_on_server "false")
1061  endif ()
1062 
1063  if (_paraview_add_plugin_REQUIRED_ON_CLIENT)
1064  set(_paraview_add_plugin_required_on_client "true")
1065  else ()
1066  set(_paraview_add_plugin_required_on_client "false")
1067  endif ()
1068 
1069  set(_paraview_add_plugin_export_args)
1070  set(_paraview_add_plugin_install_export_args)
1071  if (DEFINED _paraview_build_INSTALL_EXPORT)
1072  list(APPEND _paraview_add_plugin_export_args
1073  EXPORT "${_paraview_build_INSTALL_EXPORT}")
1074  list(APPEND _paraview_add_plugin_install_export_args
1075  INSTALL_EXPORT "${_paraview_build_INSTALL_EXPORT}")
1076  endif ()
1077 
1078  set(_paraview_add_plugin_includes)
1079  set(_paraview_add_plugin_required_libraries)
1080 
1081  set(_paraview_add_plugin_module_xmls)
1082  set(_paraview_add_plugin_with_xml 0)
1083  if (_paraview_add_plugin_MODULES)
1084  set(_paraview_add_plugin_with_xml 1)
1085 
1086  list(APPEND _paraview_add_plugin_required_libraries
1087  ${_paraview_add_plugin_MODULES})
1088 
1090  MODULES ${_paraview_add_plugin_MODULES}
1091  TARGET "${_paraview_build_plugin}_client_server"
1092  ${_paraview_add_plugin_install_export_args})
1094  MODULES ${_paraview_add_plugin_MODULES}
1095  TARGET "${_paraview_build_plugin}_server_manager_modules"
1096  ${_paraview_add_plugin_install_export_args}
1097  XML_FILES _paraview_add_plugin_module_xmls)
1098 
1099  list(APPEND _paraview_add_plugin_required_libraries
1100  "${_paraview_build_plugin}_client_server"
1101  "${_paraview_build_plugin}_server_manager_modules")
1102  endif ()
1103 
1104  set(_paraview_add_plugin_binary_resources "")
1105  set(_paraview_add_plugin_binary_headers)
1106  if (_paraview_add_plugin_SERVER_MANAGER_XML)
1107  set(_paraview_add_plugin_with_xml 1)
1108 
1109  set(_paraview_add_plugin_xmls)
1110  foreach (_paraview_add_plugin_xml IN LISTS _paraview_add_plugin_SERVER_MANAGER_XML)
1111  if (NOT IS_ABSOLUTE "${_paraview_add_plugin_xml}")
1112  set(_paraview_add_plugin_xml "${CMAKE_CURRENT_SOURCE_DIR}/${_paraview_add_plugin_xml}")
1113  endif ()
1114 
1115  list(APPEND _paraview_add_plugin_xmls
1116  "${_paraview_add_plugin_xml}")
1117  endforeach ()
1118 
1120  TARGET "${_paraview_build_plugin}_server_manager"
1121  ${_paraview_add_plugin_install_export_args}
1122  FILES ${_paraview_add_plugin_xmls})
1123  list(APPEND _paraview_add_plugin_required_libraries
1124  "${_paraview_build_plugin}_server_manager")
1125  endif ()
1126 
1127  if ((_paraview_add_plugin_module_xmls OR _paraview_add_plugin_xmls) AND
1128  PARAVIEW_USE_QT AND _paraview_add_plugin_XML_DOCUMENTATION)
1129  set(_paraview_build_plugin_docdir
1130  "${CMAKE_CURRENT_BINARY_DIR}/paraview_help")
1131 
1133  TARGET "${_paraview_build_plugin}_doc"
1134  OUTPUT_DIR "${_paraview_build_plugin_docdir}"
1135  XMLS ${_paraview_add_plugin_module_xmls}
1136  ${_paraview_add_plugin_xmls})
1137 
1138  set(_paraview_build_plugin_doc_source_args)
1139  if (DEFINED _paraview_add_plugin_DOCUMENTATION_DIR)
1140  list(APPEND _paraview_build_plugin_doc_source_args
1141  SOURCE_DIR "${_paraview_add_plugin_DOCUMENTATION_DIR}")
1142  endif ()
1143 
1145  NAME "${_paraview_build_plugin}"
1146  OUTPUT_PATH _paraview_build_plugin_qch_path
1147  OUTPUT_DIR "${_paraview_build_plugin_docdir}"
1148  TARGET "${_paraview_build_plugin}_qch"
1149  ${_paraview_build_plugin_doc_source_args}
1150  DEPENDS "${_paraview_build_plugin}_doc"
1151  PATTERNS "*.html" "*.css" "*.png" "*.jpg")
1152 
1153  list(APPEND _paraview_add_plugin_extra_include_dirs
1154  "${CMAKE_CURRENT_BINARY_DIR}")
1155  set(_paraview_add_plugin_qch_output
1156  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_build_plugin}_qch.h")
1157  list(APPEND _paraview_add_plugin_binary_headers
1158  "${_paraview_add_plugin_qch_output}")
1159  add_custom_command(
1160  OUTPUT "${_paraview_add_plugin_qch_output}"
1161  COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}
1162  $<TARGET_FILE:ParaView::ProcessXML>
1163  -base64
1164  "${_paraview_add_plugin_qch_output}"
1165  \"\"
1166  "_qch"
1167  "_qch"
1168  "${_paraview_build_plugin_qch_path}"
1169  DEPENDS "${_paraview_build_plugin_qch_path}"
1170  "${_paraview_build_plugin}_qch"
1171  "$<TARGET_FILE:ParaView::ProcessXML>"
1172  COMMENT "Generating header for ${_paraview_build_plugin} documentation")
1173  set_property(SOURCE "${_paraview_add_plugin_qch_output}"
1174  PROPERTY
1175  SKIP_AUTOMOC 1)
1176 
1177  string(APPEND _paraview_add_plugin_includes
1178  "#include \"${_paraview_build_plugin}_qch.h\"\n")
1179  string(APPEND _paraview_add_plugin_binary_resources
1180  " {
1181  const char *text = ${_paraview_build_plugin}_qch();
1182  resources.emplace_back(text);
1183  delete [] text;
1184  }\n")
1185  endif ()
1186 
1187  set(_paraview_add_plugin_eula_sources)
1188  if (_paraview_add_plugin_EULA)
1190  INPUT "${_paraview_add_plugin_EULA}"
1191  NAME "${_paraview_build_plugin}_EULA"
1192  HEADER_OUTPUT _paraview_add_plugin_eula_header
1193  SOURCE_OUTPUT _paraview_add_plugin_eula_source)
1194  list(APPEND _paraview_add_plugin_eula_sources
1195  "${_paraview_add_plugin_eula_header}"
1196  "${_paraview_add_plugin_eula_source}")
1197  endif ()
1198 
1199  set(_paraview_add_plugin_with_ui 0)
1200  set(_paraview_add_plugin_ui_sources)
1201  if (_paraview_add_plugin_UI_INTERFACES)
1202  set(_paraview_add_plugin_with_ui 1)
1203  set(CMAKE_AUTOMOC 1)
1204  set(_paraview_add_plugin_push_back_interfaces
1205  "#define PARAVIEW_ADD_INTERFACES(arg) \\\n")
1206  set(_paraview_add_plugin_include_interfaces "")
1207 
1208  foreach (_paraview_add_plugin_ui_interface IN LISTS _paraview_add_plugin_UI_INTERFACES)
1209  string(APPEND _paraview_add_plugin_push_back_interfaces
1210  " (arg).push_back(new ${_paraview_add_plugin_ui_interface}(this)); \\\n")
1211  string(APPEND _paraview_add_plugin_include_interfaces
1212  "#include \"${_paraview_add_plugin_ui_interface}.h\"\n")
1213  endforeach ()
1214  list(APPEND _paraview_add_plugin_required_libraries
1215  ParaView::pqComponents)
1216  endif ()
1217 
1218  set(_paraview_add_plugin_with_resources 0)
1219  set(_paraview_add_plugin_resources_init)
1220  if (_paraview_add_plugin_UI_RESOURCES)
1221  set(_paraview_add_plugin_with_resources 1)
1222  set(CMAKE_AUTORCC 1)
1223  if (NOT BUILD_SHARED_LIBS OR _paraview_add_plugin_FORCE_STATIC)
1224  foreach (_paraview_add_plugin_ui_resource IN LISTS _paraview_add_plugin_UI_RESOURCES)
1225  get_filename_component(_paraview_add_plugin_ui_resource_base "${_paraview_add_plugin_ui_resource}" NAME_WE)
1226  string(APPEND _paraview_add_plugin_resources_init
1227  " Q_INIT_RESOURCE(${_paraview_add_plugin_ui_resource_base});\n")
1228  endforeach ()
1229  endif ()
1230  list(APPEND _paraview_add_plugin_ui_sources
1231  ${_paraview_add_plugin_UI_RESOURCES})
1232  endif ()
1233 
1234  set(_paraview_add_plugin_qt_extra_components)
1235  if (_paraview_add_plugin_UI_FILES)
1236  set(_paraview_add_plugin_with_ui 1)
1237  set(CMAKE_AUTOUIC 1)
1238  list(APPEND _paraview_add_plugin_qt_extra_components
1239  Widgets)
1240  list(APPEND _paraview_add_plugin_required_libraries
1241  Qt5::Widgets)
1242  list(APPEND _paraview_add_plugin_ui_sources
1243  ${_paraview_add_plugin_UI_FILES})
1244  endif ()
1245 
1246  if (_paraview_add_plugin_with_ui OR _paraview_add_plugin_with_resources)
1247  include("${_ParaViewPlugin_cmake_dir}/paraview-find-package-helpers.cmake" OPTIONAL)
1248  find_package(Qt5 QUIET REQUIRED COMPONENTS Core ${_paraview_add_plugin_qt_extra_components})
1249  list(APPEND _paraview_add_plugin_required_libraries
1250  Qt5::Core)
1251  if (_paraview_add_plugin_with_ui)
1252  list(APPEND _paraview_add_plugin_required_libraries
1253  ParaView::pqCore)
1254  endif ()
1255 
1256  # CMake 3.13 started using Qt5's version variables to detect what version
1257  # of Qt's tools to run for automoc, autouic, and autorcc. However, they are
1258  # looked up using the target's directory scope, but these are here in a
1259  # local scope and unset when AutoGen gets around to asking about the
1260  # variables at generate time.
1261 
1262  # Fix for 3.13.0–3.13.3. Does not work if `paraview_add_plugin` is called
1263  # from another function.
1264  set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE)
1265  set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE)
1266  # Fix for 3.13.4+.
1267  set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
1268  PROPERTY
1269  Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}")
1270  set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
1271  PROPERTY
1272  Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MAJOR}")
1273  endif ()
1274 
1275  set(_paraview_add_plugin_with_python 0)
1276  set(_paraview_add_plugin_python_sources)
1277  set(_paraview_add_plugin_python_includes)
1278  set(_paraview_add_plugin_python_modules)
1279  set(_paraview_add_plugin_python_module_sources)
1280  set(_paraview_add_plugin_python_package_flags)
1281  if (_paraview_add_plugin_PYTHON_MODULES)
1282  set(_paraview_add_plugin_with_python 1)
1283  foreach (_paraview_add_plugin_python_module IN LISTS _paraview_add_plugin_PYTHON_MODULES)
1284  set(_paraview_add_plugin_python_path
1285  "${CMAKE_CURRENT_SOURCE_DIR}/${_paraview_add_plugin_python_module}")
1286  get_filename_component(_paraview_add_plugin_python_package "${_paraview_add_plugin_python_module}" PATH)
1287  get_filename_component(_paraview_add_plugin_python_name "${_paraview_add_plugin_python_module}" NAME_WE)
1288  if (_paraview_add_plugin_python_package)
1289  set(_paraview_add_plugin_python_full_name
1290  "${_paraview_add_plugin_python_package}.${_paraview_add_plugin_python_name}")
1291  else ()
1292  set(_paraview_add_plugin_python_full_name
1293  "${_paraview_add_plugin_python_name}")
1294  endif ()
1295  string(REPLACE "." "_" _paraview_add_plugin_python_module_mangled "${_paraview_add_plugin_python_full_name}")
1296  set(_paraview_add_plugin_python_is_package 0)
1297  set(_paraview_add_plugin_python_import
1298  "${_paraview_add_plugin_python_full_name}")
1299  if (_paraview_add_plugin_python_name STREQUAL "__init__")
1300  set(_paraview_add_plugin_python_is_package 1)
1301  set(_paraview_add_plugin_python_import
1302  "${_paraview_add_plugin_python_package}")
1303  endif ()
1304  set(_paraview_add_plugin_python_header_name
1305  "WrappedPython_${_paraview_build_plugin}_${_paraview_add_plugin_python_module_mangled}.h")
1306  set(_paraview_add_plugin_python_header
1307  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_add_plugin_python_header_name}")
1308  add_custom_command(
1309  OUTPUT "${_paraview_add_plugin_python_header}"
1310  COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}
1311  $<TARGET_FILE:ParaView::ProcessXML>
1312  "${_paraview_add_plugin_python_header}"
1313  "module_${_paraview_add_plugin_python_module_mangled}_"
1314  "_string"
1315  "_source"
1316  "${_paraview_add_plugin_python_path}"
1317  DEPENDS "${_paraview_add_plugin_python_path}"
1318  "$<TARGET_FILE:ParaView::ProcessXML>"
1319  COMMENT "Convert Python module ${_paraview_add_plugin_python_module_name} for ${_paraview_build_plugin}")
1320 
1321  list(APPEND _paraview_add_plugin_python_sources
1322  "${_paraview_add_plugin_python_header}")
1323  string(APPEND _paraview_add_plugin_python_includes
1324  "#include \"${_paraview_add_plugin_python_header_name}\"\n")
1325  string(APPEND _paraview_add_plugin_python_modules
1326  " \"${_paraview_add_plugin_python_import}\",\n")
1327  string(APPEND _paraview_add_plugin_python_module_sources
1328  " module_${_paraview_add_plugin_python_module_mangled}_${_paraview_add_plugin_python_name}_source(),\n")
1329  string(APPEND _paraview_add_plugin_python_package_flags
1330  " ${_paraview_add_plugin_python_is_package},\n")
1331  endforeach ()
1332 
1333  # Add terminators to the list.
1334  string(APPEND _paraview_add_plugin_python_modules
1335  " nullptr")
1336  string(APPEND _paraview_add_plugin_python_module_sources
1337  " nullptr")
1338  string(APPEND _paraview_add_plugin_python_package_flags
1339  " -1")
1340  endif ()
1341 
1342  set(_paraview_add_plugin_header
1343  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_build_plugin}Plugin.h")
1344  set(_paraview_add_plugin_source
1345  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_build_plugin}Plugin.cxx")
1346 
1347  get_property(_paraview_add_plugin_description GLOBAL
1348  PROPERTY "_paraview_plugin_${_paraview_build_plugin}_description")
1349 
1350  set(_paraview_build_plugin_type MODULE)
1351  set(_paraview_add_plugin_built_shared 1)
1352  if (NOT BUILD_SHARED_LIBS OR _paraview_add_plugin_FORCE_STATIC)
1353  set(_paraview_build_plugin_type STATIC)
1354  set(_paraview_add_plugin_built_shared 0)
1355  endif ()
1356 
1357  configure_file(
1358  "${_paraview_plugin_source_dir}/paraview_plugin.h.in"
1359  "${_paraview_add_plugin_header}")
1360  configure_file(
1361  "${_paraview_plugin_source_dir}/paraview_plugin.cxx.in"
1362  "${_paraview_add_plugin_source}")
1363 
1364  if (WIN32)
1365  # On Windows, we want `MODULE` libraries to go to the runtime directory,
1366  # but CMake always uses `CMAKE_LIBRARY_OUTPUT_DIRECTORY`.
1367  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
1368  endif ()
1369  if (NOT _paraview_build_LIBRARY_SUBDIRECTORY STREQUAL "")
1370  string(APPEND CMAKE_LIBRARY_OUTPUT_DIRECTORY "/${_paraview_build_LIBRARY_SUBDIRECTORY}")
1371  endif ()
1372  string(APPEND CMAKE_LIBRARY_OUTPUT_DIRECTORY "/${_paraview_build_plugin}")
1373 
1374  # Place static plugins in the same place they would be if they were shared.
1375  if (NOT _paraview_build_LIBRARY_SUBDIRECTORY STREQUAL "")
1376  string(APPEND CMAKE_ARCHIVE_OUTPUT_DIRECTORY "/${_paraview_build_LIBRARY_SUBDIRECTORY}")
1377  endif ()
1378  string(APPEND CMAKE_ARCHIVE_OUTPUT_DIRECTORY "/${_paraview_build_plugin}")
1379 
1380  add_library("${_paraview_build_plugin}" "${_paraview_build_plugin_type}"
1381  ${_paraview_add_plugin_header}
1382  ${_paraview_add_plugin_source}
1383  ${_paraview_add_plugin_eula_sources}
1384  ${_paraview_add_plugin_binary_headers}
1385  ${_paraview_add_plugin_ui_sources}
1386  ${_paraview_add_plugin_python_sources}
1387  ${_paraview_add_plugin_SOURCES})
1388  if (NOT BUILD_SHARED_LIBS OR _paraview_add_plugin_FORCE_STATIC)
1389  target_compile_definitions("${_paraview_build_plugin}"
1390  PRIVATE
1391  QT_STATICPLUGIN)
1392  endif ()
1393  target_link_libraries("${_paraview_build_plugin}"
1394  PRIVATE
1395  ParaView::RemotingCore
1396  ${_paraview_add_plugin_required_libraries})
1397  target_include_directories("${_paraview_build_plugin}"
1398  PRIVATE
1399  "${CMAKE_CURRENT_SOURCE_DIR}"
1400  ${_paraview_add_plugin_extra_include_dirs})
1401  set_property(TARGET "${_paraview_build_plugin}"
1402  PROPERTY
1403  PREFIX "")
1404 
1405  set(_paraview_add_plugin_destination
1406  "${_paraview_build_plugin_destination}/${_paraview_build_plugin}")
1407  install(
1408  TARGETS "${_paraview_build_plugin}"
1409  ${_paraview_add_plugin_export_args}
1410  COMPONENT "${_paraview_build_PLUGINS_COMPONENT}"
1411  ARCHIVE DESTINATION "${_paraview_add_plugin_destination}"
1412  LIBRARY DESTINATION "${_paraview_add_plugin_destination}")
1413 endfunction ()
1414 
1415 #[==[.md
1416 ## Plugin interfaces
1417 
1418 ParaView plugins may satisfy a number of interfaces. These functions all take a
1419 `INTERFACES` argument which takes the name of a variable to set with the name
1420 of the interface generated. This variable's should be passed to
1421 `paraview_add_plugin`'s `UI_INTERFACES` argument.
1422 #]==]
1423 
1424 #[==[.md
1425 ### Property widget
1426 
1427 TODO: What is a property widget?
1428 
1429 ```
1431  KIND <WIDGET|GROUP_WIDGET|WIDGET_DECORATOR>
1432  TYPE <type>
1433  CLASS_NAME <name>
1434  INTERFACES <variable>
1435  SOURCES <variable>)
1436 ```
1437 
1438  * `KIND`: The kind of widget represented.
1439  * `TYPE`: The name of the property type.
1440  * `CLASS_NAME`: The name of the property widget class.
1441  * `INTERFACES`: The name of the generated interface.
1442  * `SOURCES`: The source files generated by the interface.
1443 #]==]
1445  cmake_parse_arguments(_paraview_property_widget
1446  ""
1447  "KIND;TYPE;CLASS_NAME;INTERFACES;SOURCES"
1448  ""
1449  ${ARGN})
1450 
1451  if (_paraview_property_widget_UNPARSED_ARGUMENTS)
1452  message(FATAL_ERROR
1453  "Unparsed arguments for paraview_plugin_add_property_widget: "
1454  "${_paraview_property_widget_UNPARSED_ARGUMENTS}")
1455  endif ()
1456 
1457  set(_paraview_property_widget_kind_widget 0)
1458  set(_paraview_property_widget_kind_group_widget 0)
1459  set(_paraview_property_widget_kind_widget_decorator 0)
1460  if (_paraview_property_widget_KIND STREQUAL "WIDGET")
1461  set(_paraview_property_widget_kind_widget 1)
1462  elseif (_paraview_property_widget_KIND STREQUAL "GROUP_WIDGET")
1463  set(_paraview_property_widget_kind_group_widget 1)
1464  elseif (_paraview_property_widget_KIND STREQUAL "WIDGET_DECORATOR")
1465  set(_paraview_property_widget_kind_widget_decorator 1)
1466  else ()
1467  message(FATAL_ERROR
1468  "The `KIND` argument must be one of `WIDGET`, `GROUP_WIDGET`, or "
1469  "`WIDGET_DECORATOR`.")
1470  endif ()
1471 
1472  if (NOT DEFINED _paraview_property_widget_TYPE)
1473  message(FATAL_ERROR
1474  "The `TYPE` argument is required.")
1475  endif ()
1476 
1477  if (NOT DEFINED _paraview_property_widget_CLASS_NAME)
1478  message(FATAL_ERROR
1479  "The `CLASS_NAME` argument is required.")
1480  endif ()
1481 
1482  if (NOT DEFINED _paraview_property_widget_INTERFACES)
1483  message(FATAL_ERROR
1484  "The `INTERFACES` argument is required.")
1485  endif ()
1486 
1487  if (NOT DEFINED _paraview_property_widget_SOURCES)
1488  message(FATAL_ERROR
1489  "The `SOURCES` argument is required.")
1490  endif ()
1491 
1492  configure_file(
1493  "${_ParaViewPlugin_cmake_dir}/pqPropertyWidgetInterface.h.in"
1494  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_property_widget_CLASS_NAME}PWIImplementation.h"
1495  @ONLY)
1496  configure_file(
1497  "${_ParaViewPlugin_cmake_dir}/pqPropertyWidgetInterface.cxx.in"
1498  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_property_widget_CLASS_NAME}PWIImplementation.cxx"
1499  @ONLY)
1500 
1501  set("${_paraview_property_widget_INTERFACES}"
1502  "${_paraview_property_widget_CLASS_NAME}PWIImplementation"
1503  PARENT_SCOPE)
1504 
1505  set("${_paraview_property_widget_SOURCES}"
1506  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_property_widget_CLASS_NAME}PWIImplementation.cxx"
1507  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_property_widget_CLASS_NAME}PWIImplementation.h"
1508  PARENT_SCOPE)
1509 endfunction ()
1510 
1511 #[==[.md
1512 ### Dock window
1513 
1514 TODO: What is a dock window?
1515 
1516 ```
1518  CLASS_NAME <name>
1519  [DOCK_AREA <Right|Left|Top|Bottom>]
1520  INTERFACES <variable>
1521  SOURCES <variable>)
1522 ```
1523 
1524  * `CLASS_NAME`: The name of the dock window class.
1525  * `DOCK_AREA`: (Default `Left`) Where to dock the window within the
1526  application.
1527  * `INTERFACES`: The name of the generated interface.
1528  * `SOURCES`: The source files generated by the interface.
1529 #]==]
1531  cmake_parse_arguments(_paraview_dock_window
1532  ""
1533  "DOCK_AREA;CLASS_NAME;INTERFACES;SOURCES"
1534  ""
1535  ${ARGN})
1536 
1537  if (_paraview_dock_window_UNPARSED_ARGUMENTS)
1538  message(FATAL_ERROR
1539  "Unparsed arguments for paraview_plugin_add_dock_window: "
1540  "${_paraview_dock_window_UNPARSED_ARGUMENTS}")
1541  endif ()
1542 
1543  if (NOT DEFINED _paraview_dock_window_CLASS_NAME)
1544  message(FATAL_ERROR
1545  "The `CLASS_NAME` argument is required.")
1546  endif ()
1547 
1548  if (NOT DEFINED _paraview_dock_window_INTERFACES)
1549  message(FATAL_ERROR
1550  "The `INTERFACES` argument is required.")
1551  endif ()
1552 
1553  if (NOT DEFINED _paraview_dock_window_SOURCES)
1554  message(FATAL_ERROR
1555  "The `SOURCES` argument is required.")
1556  endif ()
1557 
1558  if (NOT DEFINED _paraview_dock_window_DOCK_AREA)
1559  set(_paraview_dock_window_DOCK_AREA "Left")
1560  endif ()
1561 
1562  if (NOT _paraview_dock_window_DOCK_AREA STREQUAL "Left" AND
1563  NOT _paraview_dock_window_DOCK_AREA STREQUAL "Right" AND
1564  NOT _paraview_dock_window_DOCK_AREA STREQUAL "Top" AND
1565  NOT _paraview_dock_window_DOCK_AREA STREQUAL "Bottom")
1566  message(FATAL_ERROR
1567  "`DOCK_AREA` must be one of `Left`, `Right`, `Top`, or `Bottom`. Got "
1568  "`${_paraview_dock_window_DOCK_AREA}`.")
1569  endif ()
1570 
1571  configure_file(
1572  "${_ParaViewPlugin_cmake_dir}/pqDockWindowImplementation.h.in"
1573  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_dock_window_CLASS_NAME}Implementation.h"
1574  @ONLY)
1575  configure_file(
1576  "${_ParaViewPlugin_cmake_dir}/pqDockWindowImplementation.cxx.in"
1577  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_dock_window_CLASS_NAME}Implementation.cxx"
1578  @ONLY)
1579 
1580  set("${_paraview_dock_window_INTERFACES}"
1581  "${_paraview_dock_window_CLASS_NAME}Implementation"
1582  PARENT_SCOPE)
1583 
1584  set("${_paraview_dock_window_SOURCES}"
1585  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_dock_window_CLASS_NAME}Implementation.cxx"
1586  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_dock_window_CLASS_NAME}Implementation.h"
1587  PARENT_SCOPE)
1588 endfunction ()
1589 
1590 #[==[.md
1591 ### Action group
1592 
1593 TODO: What is an action group?
1594 
1595 ```
1597  CLASS_NAME <name>
1598  GROUP_NAME <name>
1599  INTERFACES <variable>
1600  SOURCES <variable>)
1601 ```
1602 
1603  * `CLASS_NAME`: The name of the action group class.
1604  * `GROUP_NAME`: The name of the action group.
1605  * `INTERFACES`: The name of the generated interface.
1606  * `SOURCES`: The source files generated by the interface.
1607 #]==]
1609  cmake_parse_arguments(_paraview_action_group
1610  ""
1611  "CLASS_NAME;GROUP_NAME;INTERFACES;SOURCES"
1612  ""
1613  ${ARGN})
1614 
1615  if (_paraview_action_group_UNPARSED_ARGUMENTS)
1616  message(FATAL_ERROR
1617  "Unparsed arguments for paraview_plugin_add_action_group: "
1618  "${_paraview_action_group_UNPARSED_ARGUMENTS}")
1619  endif ()
1620 
1621  if (NOT DEFINED _paraview_action_group_CLASS_NAME)
1622  message(FATAL_ERROR
1623  "The `CLASS_NAME` argument is required.")
1624  endif ()
1625 
1626  if (NOT DEFINED _paraview_action_group_GROUP_NAME)
1627  message(FATAL_ERROR
1628  "The `GROUP_NAME` argument is required.")
1629  endif ()
1630 
1631  if (NOT DEFINED _paraview_action_group_INTERFACES)
1632  message(FATAL_ERROR
1633  "The `INTERFACES` argument is required.")
1634  endif ()
1635 
1636  if (NOT DEFINED _paraview_action_group_SOURCES)
1637  message(FATAL_ERROR
1638  "The `SOURCES` argument is required.")
1639  endif ()
1640 
1641  configure_file(
1642  "${_ParaViewPlugin_cmake_dir}/pqActionGroupImplementation.h.in"
1643  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_action_group_CLASS_NAME}Implementation.h"
1644  @ONLY)
1645  configure_file(
1646  "${_ParaViewPlugin_cmake_dir}/pqActionGroupImplementation.cxx.in"
1647  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_action_group_CLASS_NAME}Implementation.cxx"
1648  @ONLY)
1649 
1650  set("${_paraview_action_group_INTERFACES}"
1651  "${_paraview_action_group_CLASS_NAME}Implementation"
1652  PARENT_SCOPE)
1653 
1654  set("${_paraview_action_group_SOURCES}"
1655  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_action_group_CLASS_NAME}Implementation.cxx"
1656  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_action_group_CLASS_NAME}Implementation.h"
1657  PARENT_SCOPE)
1658 endfunction ()
1659 
1660 #[==[.md
1661 ### Toolbar
1662 
1663 TODO: What is a toolbar?
1664 
1665 ```
1667  CLASS_NAME <name>
1668  INTERFACES <variable>
1669  SOURCES <variable>)
1670 ```
1671 
1672  * `CLASS_NAME`: The name of the toolbar class.
1673  * `INTERFACES`: The name of the generated interface.
1674  * `SOURCES`: The source files generated by the interface.
1675 #]==]
1677  cmake_parse_arguments(_paraview_toolbar
1678  ""
1679  "CLASS_NAME;INTERFACES;SOURCES"
1680  ""
1681  ${ARGN})
1682 
1683  if (_paraview_toolbar_UNPARSED_ARGUMENTS)
1684  message(FATAL_ERROR
1685  "Unparsed arguments for paraview_plugin_add_toolbar: "
1686  "${_paraview_toolbar_UNPARSED_ARGUMENTS}")
1687  endif ()
1688 
1689  if (NOT DEFINED _paraview_toolbar_CLASS_NAME)
1690  message(FATAL_ERROR
1691  "The `CLASS_NAME` argument is required.")
1692  endif ()
1693 
1694  if (NOT DEFINED _paraview_toolbar_INTERFACES)
1695  message(FATAL_ERROR
1696  "The `INTERFACES` argument is required.")
1697  endif ()
1698 
1699  if (NOT DEFINED _paraview_toolbar_SOURCES)
1700  message(FATAL_ERROR
1701  "The `SOURCES` argument is required.")
1702  endif ()
1703 
1704  configure_file(
1705  "${_ParaViewPlugin_cmake_dir}/pqToolBarImplementation.h.in"
1706  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_toolbar_CLASS_NAME}Implementation.h"
1707  @ONLY)
1708  configure_file(
1709  "${_ParaViewPlugin_cmake_dir}/pqToolBarImplementation.cxx.in"
1710  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_toolbar_CLASS_NAME}Implementation.cxx"
1711  @ONLY)
1712 
1713  set("${_paraview_toolbar_INTERFACES}"
1714  "${_paraview_toolbar_CLASS_NAME}Implementation"
1715  PARENT_SCOPE)
1716 
1717  set("${_paraview_toolbar_SOURCES}"
1718  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_toolbar_CLASS_NAME}Implementation.cxx"
1719  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_toolbar_CLASS_NAME}Implementation.h"
1720  PARENT_SCOPE)
1721 endfunction ()
1722 
1723 #[==[.md
1724 ### View frame action group
1725 
1726 TODO: What is a view frame action group?
1727 
1728 ```
1730  CLASS_NAME <name>
1731  INTERFACES <variable>
1732  SOURCES <variable>)
1733 ```
1734 
1735  * `CLASS_NAME`: The name of the view frame action group class.
1736  * `INTERFACES`: The name of the generated interface.
1737  * `SOURCES`: The source files generated by the interface.
1738 #]==]
1740  cmake_parse_arguments(_paraview_view_frame_action_group
1741  ""
1742  "CLASS_NAME;INTERFACES;SOURCES"
1743  ""
1744  ${ARGN})
1745 
1746  if (_paraview_view_frame_action_group_UNPARSED_ARGUMENTS)
1747  message(FATAL_ERROR
1748  "Unparsed arguments for paraview_plugin_add_view_frame_action_group: "
1749  "${_paraview_view_frame_action_group_UNPARSED_ARGUMENTS}")
1750  endif ()
1751 
1752  if (NOT DEFINED _paraview_view_frame_action_group_CLASS_NAME)
1753  message(FATAL_ERROR
1754  "The `CLASS_NAME` argument is required.")
1755  endif ()
1756 
1757  if (NOT DEFINED _paraview_view_frame_action_group_INTERFACES)
1758  message(FATAL_ERROR
1759  "The `INTERFACES` argument is required.")
1760  endif ()
1761 
1762  if (NOT DEFINED _paraview_view_frame_action_group_SOURCES)
1763  message(FATAL_ERROR
1764  "The `SOURCES` argument is required.")
1765  endif ()
1766 
1767  configure_file(
1768  "${_ParaViewPlugin_cmake_dir}/pqViewFrameActionGroupImplementation.h.in"
1769  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_view_frame_action_group_CLASS_NAME}Implementation.h"
1770  @ONLY)
1771  configure_file(
1772  "${_ParaViewPlugin_cmake_dir}/pqViewFrameActionGroupImplementation.cxx.in"
1773  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_view_frame_action_group_CLASS_NAME}Implementation.cxx"
1774  @ONLY)
1775 
1776  set("${_paraview_view_frame_action_group_INTERFACES}"
1777  "${_paraview_view_frame_action_group_CLASS_NAME}Implementation"
1778  PARENT_SCOPE)
1779 
1780  set("${_paraview_view_frame_action_group_SOURCES}"
1781  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_view_frame_action_group_CLASS_NAME}Implementation.cxx"
1782  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_view_frame_action_group_CLASS_NAME}Implementation.h"
1783  PARENT_SCOPE)
1784 endfunction ()
1785 
1786 #[==[.md
1787 ### Auto start
1788 
1789 TODO: What is an auto start?
1790 
1791 ```
1793  CLASS_NAME <name>
1794  [STARTUP <function>]
1795  [SHUTDOWN <function>]
1796  INTERFACES <variable>
1797  SOURCES <variable>)
1798 ```
1799 
1800  * `CLASS_NAME`: The name of the auto start class.
1801  * `STARTUP`: (Defaults to `startup`) The name of the method to call on
1802  startup.
1803  * `SHUTDOWN`: (Defaults to `shutdown`) The name of the method to call on
1804  shutdown.
1805  * `INTERFACES`: The name of the generated interface.
1806  * `SOURCES`: The source files generated by the interface.
1807 #]==]
1809  cmake_parse_arguments(_paraview_auto_start
1810  ""
1811  "CLASS_NAME;INTERFACES;SOURCES;STARTUP;SHUTDOWN"
1812  ""
1813  ${ARGN})
1814 
1815  if (_paraview_auto_start_UNPARSED_ARGUMENTS)
1816  message(FATAL_ERROR
1817  "Unparsed arguments for paraview_plugin_add_auto_start: "
1818  "${_paraview_auto_start_UNPARSED_ARGUMENTS}")
1819  endif ()
1820 
1821  if (NOT DEFINED _paraview_auto_start_CLASS_NAME)
1822  message(FATAL_ERROR
1823  "The `CLASS_NAME` argument is required.")
1824  endif ()
1825 
1826  if (NOT DEFINED _paraview_auto_start_INTERFACES)
1827  message(FATAL_ERROR
1828  "The `INTERFACES` argument is required.")
1829  endif ()
1830 
1831  if (NOT DEFINED _paraview_auto_start_SOURCES)
1832  message(FATAL_ERROR
1833  "The `SOURCES` argument is required.")
1834  endif ()
1835 
1836  if (NOT DEFINED _paraview_auto_start_STARTUP)
1837  set(_paraview_auto_start_STARTUP "startup")
1838  endif ()
1839 
1840  if (NOT DEFINED _paraview_auto_start_SHUTDOWN)
1841  set(_paraview_auto_start_SHUTDOWN "shutdown")
1842  endif ()
1843 
1844  configure_file(
1845  "${_ParaViewPlugin_cmake_dir}/pqAutoStartImplementation.h.in"
1846  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_auto_start_CLASS_NAME}Implementation.h"
1847  @ONLY)
1848  configure_file(
1849  "${_ParaViewPlugin_cmake_dir}/pqAutoStartImplementation.cxx.in"
1850  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_auto_start_CLASS_NAME}Implementation.cxx"
1851  @ONLY)
1852 
1853  set("${_paraview_auto_start_INTERFACES}"
1854  "${_paraview_auto_start_CLASS_NAME}Implementation"
1855  PARENT_SCOPE)
1856 
1857  set("${_paraview_auto_start_SOURCES}"
1858  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_auto_start_CLASS_NAME}Implementation.cxx"
1859  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_auto_start_CLASS_NAME}Implementation.h"
1860  PARENT_SCOPE)
1861 endfunction ()
1862 
1863 #[==[.md
1864 ### Tree layout strategy
1865 
1866 TODO: What is a tree layout strategy?
1867 
1868 ```
1870  STRATEGY_TYPE <type>
1871  STRATEGY_LABEL <label>
1872  INTERFACES <variable>
1873  SOURCES <variable>)
1874 ```
1875 
1876  * `STRATEGY_TYPE`: The name of the tree layout strategy class.
1877  * `STRATEGY_LABEL`: The label to use for the strategy.
1878  * `INTERFACES`: The name of the generated interface.
1879  * `SOURCES`: The source files generated by the interface.
1880 #]==]
1882  cmake_parse_arguments(_paraview_tree_layout_strategy
1883  ""
1884  "INTERFACES;SOURCES;STRATEGY_TYPE;STRATEGY_LABEL"
1885  ""
1886  ${ARGN})
1887 
1888  if (_paraview_tree_layout_strategy_UNPARSED_ARGUMENTS)
1889  message(FATAL_ERROR
1890  "Unparsed arguments for paraview_plugin_add_tree_layout_strategy: "
1891  "${_paraview_tree_layout_strategy_UNPARSED_ARGUMENTS}")
1892  endif ()
1893 
1894  if (NOT DEFINED _paraview_tree_layout_strategy_STRATEGY_TYPE)
1895  message(FATAL_ERROR
1896  "The `STRATEGY_TYPE` argument is required.")
1897  endif ()
1898 
1899  if (NOT DEFINED _paraview_tree_layout_strategy_STRATEGY_LABEL)
1900  message(FATAL_ERROR
1901  "The `STRATEGY_LABEL` argument is required.")
1902  endif ()
1903 
1904  if (NOT DEFINED _paraview_tree_layout_strategy_INTERFACES)
1905  message(FATAL_ERROR
1906  "The `INTERFACES` argument is required.")
1907  endif ()
1908 
1909  if (NOT DEFINED _paraview_tree_layout_strategy_SOURCES)
1910  message(FATAL_ERROR
1911  "The `SOURCES` argument is required.")
1912  endif ()
1913 
1914  configure_file(
1915  "${_ParaViewPlugin_cmake_dir}/pqTreeLayoutStrategyImplementation.h.in"
1916  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_tree_layout_strategy_STRATEGY_TYPE}Implementation.h"
1917  @ONLY)
1918  configure_file(
1919  "${_ParaViewPlugin_cmake_dir}/pqTreeLayoutStrategyImplementation.cxx.in"
1920  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_tree_layout_strategy_STRATEGY_TYPE}Implementation.cxx"
1921  @ONLY)
1922 
1923  set("${_paraview_tree_layout_strategy_INTERFACES}"
1924  "${_paraview_tree_layout_strategy_STRATEGY_TYPE}Implementation"
1925  PARENT_SCOPE)
1926 
1927  set("${_paraview_tree_layout_strategy_SOURCES}"
1928  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_tree_layout_strategy_STRATEGY_TYPE}Implementation.cxx"
1929  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_tree_layout_strategy_STRATEGY_TYPE}Implementation.h"
1930  PARENT_SCOPE)
1931 endfunction ()
1932 
1933 #[==[.md
1934 ### Proxy
1935 
1936 TODO: What is a proxy?
1937 
1938 ```
1940  NAME <name>
1941  INTERFACES <variable>
1942  SOURCES <variable>
1943  [PROXY_TYPE <type>
1944  [CLASS_NAME <class>]
1945  XML_GROUP <group>
1946  <XML_NAME|XML_NAME_REGEX> <name>]...)
1947 ```
1948 
1949  * `NAME`: The name of the proxy.
1950  * `INTERFACES`: The name of the generated interface.
1951  * `SOURCES`: The source files generated by the interface.
1952 
1953 At least one `PROXY_TYPE` must be specified. Each proxy type must be given an
1954 `XML_GROUP` and either an `XML_NAME` or `XML_NAME_REGEX`. If `CLASS_NAME` is
1955 not given, the `PROXY_TYPE` name is used instead.
1956 #]==]
1958  cmake_parse_arguments(_paraview_proxy
1959  ""
1960  "INTERFACES;SOURCES;NAME"
1961  ""
1962  ${ARGN})
1963 
1964  if (NOT DEFINED _paraview_proxy_INTERFACES)
1965  message(FATAL_ERROR
1966  "The `INTERFACES` argument is required.")
1967  endif ()
1968 
1969  if (NOT DEFINED _paraview_proxy_SOURCES)
1970  message(FATAL_ERROR
1971  "The `SOURCES` argument is required.")
1972  endif ()
1973 
1974  if (NOT DEFINED _paraview_proxy_NAME)
1975  message(FATAL_ERROR
1976  "The `NAME` argument is required.")
1977  endif ()
1978 
1979  set(_paraview_proxy_parse "")
1980  set(_paraview_proxy_type)
1981  set(_paraview_proxy_types)
1982  foreach (_paraview_proxy_arg IN LISTS _paraview_proxy_UNPARSED_ARGUMENTS)
1983  if (_paraview_proxy_parse STREQUAL "")
1984  set(_paraview_proxy_parse "${_paraview_proxy_arg}")
1985  elseif (_paraview_proxy_parse STREQUAL "PROXY_TYPE")
1986  set(_paraview_proxy_type "${_paraview_proxy_arg}")
1987  list(APPEND _paraview_proxy_types "${_paraview_proxy_type}")
1988  set(_paraview_proxy_parse "")
1989  elseif (_paraview_proxy_parse STREQUAL "CLASS_NAME")
1990  if (NOT _paraview_proxy_type)
1991  message(FATAL_ERROR
1992  "Missing `PROXY_TYPE` for `CLASS_NAME`")
1993  endif ()
1994  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_class_name")
1995  message(FATAL_ERROR
1996  "Duplicate `CLASS_NAME` for `${_paraview_proxy_type}`")
1997  endif ()
1998  set("_paraview_proxy_type_${_paraview_proxy_type}_class_name"
1999  "${_paraview_proxy_arg}")
2000  set(_paraview_proxy_parse "")
2001  elseif (_paraview_proxy_parse STREQUAL "XML_GROUP")
2002  if (NOT _paraview_proxy_type)
2003  message(FATAL_ERROR
2004  "Missing `PROXY_TYPE` for `XML_GROUP`")
2005  endif ()
2006  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_group")
2007  message(FATAL_ERROR
2008  "Duplicate `XML_GROUP` for `${_paraview_proxy_type}`")
2009  endif ()
2010  set("_paraview_proxy_type_${_paraview_proxy_type}_xml_group"
2011  "${_paraview_proxy_arg}")
2012  set(_paraview_proxy_parse "")
2013  elseif (_paraview_proxy_parse STREQUAL "XML_NAME")
2014  if (NOT _paraview_proxy_type)
2015  message(FATAL_ERROR
2016  "Missing `PROXY_TYPE` for `XML_NAME`")
2017  endif ()
2018  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name" OR
2019  DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name_regex")
2020  message(FATAL_ERROR
2021  "Duplicate `XML_NAME` or `XML_NAME_REGEX` for `${_paraview_proxy_type}`")
2022  endif ()
2023  set("_paraview_proxy_type_${_paraview_proxy_type}_xml_name"
2024  "${_paraview_proxy_arg}")
2025  set(_paraview_proxy_parse "")
2026  elseif (_paraview_proxy_parse STREQUAL "XML_NAME_REGEX")
2027  if (NOT _paraview_proxy_type)
2028  message(FATAL_ERROR
2029  "Missing `PROXY_TYPE` for `XML_NAME_REGEX`")
2030  endif ()
2031  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name" OR
2032  DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name_regex")
2033  message(FATAL_ERROR
2034  "Duplicate `XML_NAME` or `XML_NAME_REGEX` for `${_paraview_proxy_type}`")
2035  endif ()
2036  set("_paraview_proxy_type_${_paraview_proxy_type}_xml_name_regex"
2037  "${_paraview_proxy_arg}")
2038  set(_paraview_proxy_parse "")
2039  else ()
2040  message(FATAL_ERROR
2041  "Unknown argument `${_paraview_proxy_parse}`")
2042  endif ()
2043  endforeach ()
2044 
2045  if (_paraview_proxy_parse)
2046  message(FATAL_ERROR
2047  "Missing argument for `${_paraview_proxy_parse}`")
2048  endif ()
2049 
2050  if (NOT _paraview_proxy_types)
2051  message(FATAL_ERROR
2052  "No `PROXY_TYPE` arguments given")
2053  endif ()
2054 
2055  set(_paraview_proxy_includes)
2056  set(_paraview_proxy_body)
2057  foreach (_paraview_proxy_type IN LISTS _paraview_proxy_types)
2058  if (NOT DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_group")
2059  message(FATAL_ERROR
2060  "Missing `XML_GROUP` for `${_paraview_proxy_type}`")
2061  endif ()
2062  if (NOT DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name" AND
2063  NOT DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name_regex")
2064  message(FATAL_ERROR
2065  "Missing `XML_NAME` or `XML_NAME_REGEX` for `${_paraview_proxy_type}`")
2066  endif ()
2067  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_class_name")
2068  set(_paraview_proxy_class
2069  "${_paraview_proxy_type_${_paraview_proxy_type}_class_name}")
2070  else ()
2071  set(_paraview_proxy_class
2072  "${_paraview_proxy_type}")
2073  endif ()
2074 
2075  set(_paraview_proxy_group "${_paraview_proxy_type_${_paraview_proxy_type}_xml_group}")
2076  if (DEFINED "_paraview_proxy_type_${_paraview_proxy_type}_xml_name")
2077  set(_paraview_proxy_name "${_paraview_proxy_type_${_paraview_proxy_type}_xml_name}")
2078  set(_paraview_proxy_name_type "QString")
2079  set(_paraview_proxy_cmp "name == proxy->GetXMLName()")
2080  else ()
2081  set(_paraview_proxy_name "${_paraview_proxy_type_${_paraview_proxy_type}_xml_name_regex}")
2082  set(_paraview_proxy_name_type "QRegularExpression")
2083  set(_paraview_proxy_cmp "QString(proxy->GetXMLName()).contains(name)")
2084  endif ()
2085 
2086  if (NOT DEFINED "_paraview_proxy_included_${_paraview_proxy_class}")
2087  string(APPEND _paraview_proxy_includes
2088  "#include \"${_paraview_proxy_class}.h\"\n")
2089  set("_paraview_proxy_included_${_paraview_proxy_class}" 1)
2090  endif ()
2091  string(APPEND _paraview_proxy_body
2092  " {
2093  static const QString group(\"${_paraview_proxy_group}\");
2094  static const ${_paraview_proxy_name_type} name(\"${_paraview_proxy_name}\");
2095  if (group == proxy->GetXMLGroup() && ${_paraview_proxy_cmp})
2096  {
2097  return new ${_paraview_proxy_class}(regGroup, regName, proxy, server, nullptr);
2098  }
2099  }\n")
2100  endforeach ()
2101 
2102  configure_file(
2103  "${_ParaViewPlugin_cmake_dir}/pqServerManagerModelImplementation.h.in"
2104  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_proxy_NAME}ServerManagerModelImplementation.h"
2105  @ONLY)
2106  configure_file(
2107  "${_ParaViewPlugin_cmake_dir}/pqServerManagerModelImplementation.cxx.in"
2108  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_proxy_NAME}ServerManagerModelImplementation.cxx"
2109  @ONLY)
2110 
2111  set("${_paraview_proxy_INTERFACES}"
2112  "${_paraview_proxy_NAME}ServerManagerModelImplementation"
2113  PARENT_SCOPE)
2114 
2115  set("${_paraview_proxy_SOURCES}"
2116  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_proxy_NAME}ServerManagerModelImplementation.cxx"
2117  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_proxy_NAME}ServerManagerModelImplementation.h"
2118  PARENT_SCOPE)
2119 endfunction ()
function paraview_plugin_add_dock_window()
.md Dock window
component
content
order
function _vtk_module_check_destinations(prefix)
Check that destinations are valid.
type
function paraview_plugin_add_action_group()
.md Action group
on
function _paraview_plugin_check_destdir(variable)
version
function paraview_client_documentation()
.md Documentation from XML files
EXPORT
function vtk_module_export_find_packages()
Export find_package calls for dependencies.
function paraview_add_plugin(name)
.md Adding a plugin
string
load
function vtk_module_scan()
Scan modules and kits.
function paraview_plugin_add_proxy()
.md Proxy
function vtk_module_build()
Build modules and kits.
name
function
function paraview_plugin_add_toolbar()
.md Toolbar
time
function paraview_plugin_write_conf()
.md Plugin configuration files
#define VERSION
Definition: jconfigint.h:17
function vtk_encode_string()
Encode a file as a C string at build time.
#define BUILD_SHARED_LIBS
Definition: config.h:45
source
function paraview_client_generate_help()
.md Generating help documentation
#define PACKAGE
Definition: expat_config.h:64
function paraview_plugin_add_property_widget()
.md Plugin interfaces
function paraview_plugin_find_plugins(output)
.md ParaView Plugin CMake API
documentation
function paraview_plugin_add_view_frame_action_group()
.md View frame action group
function paraview_plugin_build()
.md Building plugins
function vtk_module_wrap_client_server()
.md Wrapping a set of VTK modules for ClientServer
function _vtk_module_split_module_name(name, prefix)
Split a module name into a namespace and target component.
function paraview_plugin_add_auto_start()
.md Auto start
function paraview_plugin_add_tree_layout_strategy()
.md Tree layout strategy
function paraview_server_manager_process()
.md Building XML files
function paraview_server_manager_process_files()
.md The second way to process XML files directly.