Custom Toolchain Registration

Register and use third-party software build toolchains to create executables and libraries

A toolchain refers to the set of build tools (build application, compiler, linker, archiver) that convert source code into a binary artifact, such as a static or dynamic library or an executable file. For example, in Linux, you invoke a toolchain for C files with gmake and set toolchain information in the makefile. For C/C++ code generation, the toolchain is formally defined in a MATLAB® object that you modify and load from a toolchain definition file (m-file). Write and use your own toolchain definition file when you perform intensive customizations to the build process.

The MATLAB Coder™ toolchain infrastructure is based around a class called coder.make.ToolchainInfo. In an object instantiation, the object properties store the formal toolchain information, such as paths to your build tools, syntaxes for the commands that call the build tools, and flags to append to the commands. Specific coder.make.ToolchainInfo methods enable access and modification of the toolchain object properties. The code generator uses the completed object definition to create and call the makefile for your toolchain.

In the code generation infrastructure, after creating the toolchain object from your toolchain definition file, you save it, and then register the object for code generation. Assign the object name to the Toolchain property of your code generation configuration object. See the featured examples for complete demonstrations.

Classes

coder.make.BuildConfigurationRepresent build configuration
coder.make.BuildItemRepresent build item
coder.make.BuildToolRepresent build tool
coder.make.ToolchainInfoRepresent custom toolchain

Topics

Custom Toolchain Registration Basics

Custom Toolchain Registration

Register third-party software build tools for creating executables and libraries.

About coder.make.ToolchainInfo

coder.make.ToolchainInfo represents a custom toolchain.

Toolchain Definition File with Commentary

Create a toolchain definition file.

Typical Workflow

Create and Edit Toolchain Definition File

Create and edit a toolchain definition file for a new custom toolchain.

Create and Validate ToolchainInfo Object

Create and validate a ToolchainInfo object from the toolchain definition file.

Register the Custom Toolchain

Register custom toolchain before you use it.

Use the Custom Toolchain

Build an executable or library with the custom toolchain.

Troubleshooting

Troubleshooting Custom Toolchain Validation

Troubleshoot validation errors.

Prevent Circular Data Dependencies with One-Pass or Single-Pass Linkers

Use StartLibraryGroup and EndLibraryGroup linker directives.

Featured Examples