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,vtkRemotingCoreConfiguration
class provides options that affect how process module and other core Paraview remoting components are initialized.vtkRemotingServerManagerConfiguration
class 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.
-
vtkCLIOptions
is a class that wrapsCLI::App
and it intended to handle building and processing on command line arguments. Each of the configuration classes provides aPopulateOptions
method that takes avtkCLIOptions
instance 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
vtkPVOptions
instance will be initialized using values in each of the*Configuration
classes and thus old code depending onvtkPVOptions
will 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.