ActiveConfigProgramOptions Python Module
Table of Contents:
Indices and Tables
Overview
The ActiveConfigProgramOptions package extends the
ActiveConfigParser
package by adding additional operations for handling command-line
options.
The general use-case behind this tool is to allow a section inside
a .ini file to be used to generate a command line option for some
application. Specifically, we were working with generating
configurations for a CMake based project with hundreds of configuration
options. We wanted a tool that would allow us to encode different
configurations while also havng base configurations to reduce
replication of standard command lines as those can be difficult to
maintain once the number of different configurations becomes large.
The primary use case that provided the impetus to develop ActiveConfigProgramOptions was to support complex configuration environments for a software project that is tested on a variety of platforms and architectures, including GPUs and HPC systems. This project is several million lines of code and has hundreds of CMake options in its configuration space.
We developed ActiveConfigProgramOptions and ActiveConfigProgramOptionsCMake to allow our build system to use optimized .ini files to manage our configuration space.
This package includes two classes:
ActiveConfigProgramOptions - A general purpose command line handler that handles generic command line options.
ActiveConfigProgramOptionsCMake - A subclass of ActiveConfigProgramOptions, this class further extends ActiveConfigProgramOptions by adding CMake-specific operations to provide ease of use for CMake specific options. It also adds an additional generator option to allow the generation of either bash style command line options or a CMake source fragment file.
An example .ini file using ActiveConfigProgramOptions might look like:
1[Directory *nix]
2opt-set ls
This configuration is the ActiveConfigProgramOptions version of a hello world example.
Here, the opt-set ls option is specifying a single command line option
which in this case is the command ls.
We can expand this to add additional entries:
1[Directory *nix]
2opt-set ls
3opt-set -l
4opt-set -r
5opt-set -t
6opt-remove -r
When processed, this example would result in a concactenated string containing
the command ls -l -t. We threw in the opt-remove -r operation which
removed the -r entry.
ActiveConfigProgramOptionsCMake
This is a subclass of ActiveConfigProgramOptions that adds a new handler for CMake
specific options for setting configuration flags for projects. It adds
a new operation, opt-set-cmake-var to the handlers and adds an addition
generator type, cmake_fragment plus some logic for handling these
options properly.
It can be used to show how specializations of ActiveConfigProgramOptions can be created for other programs if needed. See the Quick Start guide for details on ActiveConfigProgramOptionsCMake.
Quick Start
See the Quick Start guide for a more comprehensive starting tutorial and the Examples for additional use case examples.