1# Default code to handle VTK backends. The module.cmake files specify
2# which backend the modules are in. We can specify some more specific
3# documentation for backends in this file that will be displayed in
4# cmake-gui and ccmake.
5#
6# The OpenGL backend is the current default, and the OpenGL2 backend is
7# the new rendering code. This differs from groups in that only one backend
8# can be built/linked to at any given time. The backend modules should use a
9# naming convention where the backend name is the final word in the
10# module name, i.e. vtkRenderingOpenGL for OpenGL and vtkRenderingOpenGL2
11# for OpenGL2.
12
13# Set a default backend type if none was specified, populate the enum.
14if(NOT VTK_RENDERING_BACKEND)
15  message(STATUS "Setting rendering backend to 'OpenGL' as none was specified.")
16  set(VTK_RENDERING_BACKEND "OpenGL" CACHE STRING
17    "Choose the rendering backend." FORCE)
18  # Set the possible values of rendering backends for cmake-gui
19  set_property(CACHE VTK_RENDERING_BACKEND PROPERTY
20    STRINGS ${VTK_BACKENDS} "None")
21endif()
22
23# Now iterate through and enable the one that was selected.
24foreach(backend ${VTK_BACKENDS})
25  message(STATUS "Backend ${backend} modules: ${VTK_BACKEND_${backend}_MODULES}")
26  if(${backend} STREQUAL "${VTK_RENDERING_BACKEND}")
27    message(STATUS "Enabling modules for ${backend}.")
28    foreach(module ${VTK_BACKEND_${backend}_MODULES})
29      list(APPEND ${${module}_IMPLEMENTS}_IMPLEMENTATIONS ${module})
30    endforeach()
31  endif()
32endforeach()
33