7.5. Using Multiple ToolchainsΒΆ

GNATbench projects are integrated with the Workbench project builder and therefore use the active build spec to select the toolchain used when building the Ada part of a project.

However, other commands, such as compilation of individual files, are driven by the GNAT project file, specifically the project default toolchain. This toolchain is the native compiler unless you select a different default. Both native and cross toolchains may be chosen for a given project and any one of them may be selected as the default.

To configure the project’s toolchain selections, invoke the Properties menu for a given project and then select the “GNATbench Properties” page. The figure below shows this page. Note that both a native and a cross toolchain are selected, and that the cross compiler will be used by default.

multiple toolchains selected in properties

When multiple toolchains are selected, the GNATbench wizard alters the GNAT Project file (the “gpr file”) so that a new scenario variable named “Target” is declared, with possible values representing each selected toolchain. The wizard also alters the IDE package within the project file so that the “Target” scenario variable controls which toolchain will be applied. The following figure illustrates these alterations:

gpr file with multiple toolchains available

The wizard makes the necessary additions and alternations to the gpr file. You use the Scenario Variables view to select which toolchain to apply, just as would be done for any other scenario variable.

toolchain selection scenario var view