Skip to content

WIP: Toggleable Libraries

Andrew Wilson requested to merge andrew.wilson/iMSTK:ImstkModule into master

This MR adds

1. definitions for each module and allows them to be toggleable.

Each module definition looks like this, corresponding with a library:

  • iMSTK_MODULE_ENABLE_RenderingCore ON

It may be toggled on/off. It resides in the advanced configuration settings in cmake.

At the user level (not advanced) we have other switches like:

  • iMSTK_MODULE_GROUP_RENDERING

These groups define groups of modules to be used, not dissimilar to a iMSTK_USE_X flag. This keeps things simple whilst allowing more complex configurations.


2. Splits devices up into:

  • DevicesCore
  • DevicesVRPN
  • DevicesOpenHaptics

3. Reduced linkage

In many spots ${VTK_LIBRARIES} was being used. This links & includes all of the built VTK targets/libs. We need not do that. This update reduces many spots to use specific libraries. For instance, MeshIO only needs to link to VTK's IO libraries, such as VTK::IOImage.

This update also uses the module definitions to avoid building parts not required.

  • VTK modules are not built with if the dependent libs are not requested in iMSTK. For instance, if you don't ask for a Rendering module in iMSTK, VTK rendering libs are not built.
  • When no rendering is used OpenVR is not pulled or built with.
  • Libusb, LibFalcon, & FTD were being pulled & built even when not used. They are only needed with VRPN. Now they are only included when building with VRPN.

Ultimately this allows greater extensibility of iMSTK libraries, greatly reduces linkage & individual library complexity, and alows very reduced builds. For example:

You can build iMSTK with:

  • iMSTK_MODULE_GROUP_RENDERING=NO

Which effectively gives:

  • iMSTK_MODULE_ENABLE_RenderingCore OFF
  • iMSTK_MODULE_ENABLE_RenderingVTK OFF
  • iMSTK_MODULE_ENABLE_ViewerCore OFF
  • iMSTK_MODULE_ENABLE_ViewerVTK OFF
  • iMSTK_MODULE_ENABLE_SimulationManager OFF

This builds iMSTK without any rendering functionalities. Meaning no VTK renderinb libraries built, no GL linkage, you may use iMSTK completely as a physics backend.

Similarly the following are often not needed:

  • iMSTK_MODULE_ENABLE_DevicesVRPN
  • iMSTK_MODULE_ENABLE_DevicesOpenHaptics
  • iMSTK_MODULE_ENABLE_Filtering
  • iMSTK_MODULE_ENABLE_FilteringCore
Edited by Andrew Wilson

Merge request reports