Here’s an MR that adds CLI11 to VTK: https://gitlab.kitware.com/vtk/vtk/-/pipelines/228604
Here a work-in-progress MR: https://gitlab.kitware.com/paraview/paraview/-/merge_requests/4951
Currently, the design is as such:
-
ParaView components (and ParaView-based applications) can depend on arbitrary run-time configuration options. These options are to be treated as set-once-never-modified in the lifetime of the process and setup during process startup. The code can use these options to control runtime behavior.
For example,vtkRemotingCoreConfigurationclass provides options that affect how process module and other core Paraview remoting components are initialized.vtkRemotingServerManagerConfigurationclass provides options that affect ServerManager operation / initialization etc. One can concieve similar configuration classes for the each of the executables to support additional configuration options. -
All these configuration classes are singletons.
-
vtkCLIOptionsis a class that wrapsCLI::Appand it intended to handle building and processing on command line arguments. Each of the configuration classes provides aPopulateOptionsmethod that takes avtkCLIOptionsinstance that it then populates with command line arguments for each of the available option.
A typical executable, has the following code to parse args:
vtkNew<vtkCLIOptions> options;
options->SetName("TestRemotingCoreConfiguration");
options->SetDescription("Test for 'vtkRemotingCoreConfiguration'");
/**
* We can provides a `paraview::PopulateOptions(...)`,
* `pvbatch::PopulateOptions(..)` etc. as convenience methods to populate all supported
* options for each standard executable in ParaView.
*/
vtkRemotingCoreConfiguration::GetInstance()->PopulateOptions(options);
vtkRemotingServerManagerConfiguration::GetInstance()->PopulateOptions(options);
...
/**
* For ParaView-based applications, they can do
* the following to add new options
*/
MyCustomConfiguration::GetInstance()->PopulateOptions(options);
if (options->Parse(argc, argv))
{
// parsing successful.
}
- For backwards compatibility, the
vtkPVOptionsinstance will be initialized using values in each of the*Configurationclasses and thus old code depending onvtkPVOptionswill continue to work.
Thoughts? Suggestions?
Just an update, these changes are now in master. ParaView-based custom applications will be impacted by this change. So please feel free to raise any questions on the forum that you may have regarding the necessary changes.