Configure Build Process of Generated Code
R2026bFor certain applications, you might want to control aspects of the build process
that occur after C/C++ source code generation but before compilation. To specify
additional build files and flags from inside your MATLAB® code, use the coder.updateBuildInfo function. Alternatively, create a RTW.BuildInfo object in your workspace and use the associated object
functions to specify your build options. When you are working with external code
integration or you have multiple functions that use the same build information,
customize the build process by using the coder.ExternalDependency class.
Use classes in the target
namespace to manage target hardware and build tool information. For example,
register new target hardware for code generation, set up target connectivity for
external mode and processor-in-the-loop (PIL) simulations, or create custom CMake
toolchain definitions for building generated code on your development
computer.
Functions
Objects
RTW.BuildInfo | Provide information for compiling and linking generated code |
Classes
coder.ExternalDependency | Interface to external code |
coder.buildhookcontext.MATLABCoder | Provide information about build process at hook point (Since R2026b) |
coder.MATLABCoderBuildHooks | Interface class for MATLAB Coder build hooks (Since R2026b) |
target.Alias | Create alternative identifier for target object |
target.BuildTool | Describe build tool (Since R2023a) |
target.BuildToolType | Describe build tool type (Since R2023a) |
target.CMake | Specify CMake installation for building generated code (Since R2022b) |
target.CMakeBuilder | Configure how CMake builds generated code (Since R2022b) |
target.CMakeBuildType | Describe CMake build type or build configuration (Since R2022b) |
target.CMakeCacheEntry | Configure a CMake cache entry (Since R2022b) |
target.EnvironmentConfiguration | Configure system environment for toolchain (Since R2022b) |
target.HardwareComponentSupport | Describe support for a hardware component (Since R2022b) |
target.LanguageImplementation | Provide C and C++ compiler implementation details |
target.Object | Base class for target types |
target.Processor | Provide target processor information |
target.Toolchain | Capture high-level information about toolchain (Since R2022b) |
Namespaces
target | Manage target hardware and build tool information |
Topics
- Build Process Customization
Control aspects of the build process that occur after code generation but before compilation.
- Build Process Support for File and Folder Names
Troubleshoot build process errors that occur when file system issues prevent file processing.
- C Compiler Considerations for Signed Integer Overflows
For accurate results from signed integer C operations, the C compiler must preserve wrap-on-overflow behavior.
- Requirements for Signed Integer Representation
Compile generated code on a target that uses a two’s complement representation for signed integer values.
- Register New Hardware Devices
Extend the range of supported hardware by registering new devices.
- Configure CMake Build Process
Specify CMake toolchain definition for building generated code.
- Create Custom CMake Toolchain Definition
CMake is a third-party, open-source tool for build process management.
- Compiler and Linker Errors
Address common causes of errors that occur during build.
- Customize Build Process for Target Hardware Using Target Framework
Modify build process using a custom MATLAB build hook class.
- Use Automated Tool to Assist Migration of Existing Toolchain to Target Framework
Generate MATLAB scripts to assist upgrading existing toolchain to Target Framework.
