Next: , Previous: Customizing through XML and Python files, Up: Customizing and Extending GPS


16.6 Adding support for new tools

GPS has built-in support for external tools. This feature can be used to support a wide variety of tools (in particular, to specify different compilers). Regular enhancements are done in this area, so if you are planning to use the external tool support in GPS, check for the latest GPS version available.

Typically, the following things need to be achieved to successfully use a tool:

Each of these points is discussed in further sections. In all these cases, most of the work can be done statically through XML customization files. These files have the same format as other XML customization files (see Customizing through XML and Python files), and the tool descriptions are found in <tool> tags.

This tag accepts the following attributes:

name (mandatory)
This is the name of the tool. This is purely descriptive, and will appear throughout the GPS interface whenever this tool is referenced. This includes for instances the tabs of the switches editor.
package (Default value is ide)
This optional attribute specifies which package should be used in the project to store information about this tool, in particular its switches. Most of the time the default value should be used, unless you are working with one of the predefined packages.

See also See Defining project attributes, for more information on defining your own project attributes. Using the "package", "attribute" or "index" XML attributes of <tool> will implicitly create new project attributes as needed.

If this attribute is set to "ide", then the switches cannot be set for a specific file, only at the project level. Support for file-specific switches currently requires modification of the GPS sources themselves.

attribute (Default value is default_switches)
This optional attribute specifies the name of the attribute in the project which is used to store the switches for that tool.
index (Default value is the tool name)
This optional attribute specifies what index is used in the project. This is mostly for internal use by GPS, and describes what index of the project attribute is used to store the switches for that tool.
override (Default value is 'false')
This optional attribute specifies whether the tool definition can be redefined. The accepted values are 'true' or 'false'. If override is not set, and the tool is defined several times, then a Warning will be displayed.

This tag accepts the following children, described in separate sections:

<switches>
(see Defining tool switches)
<language>
(see Defining supported languages)
<initial-cmd-line>
(see Defining default command line)