Main Content

Configuring Build Process of Generated Code

Customize compilation and linking of generated source code

For 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

expand all

coder.updateBuildInfoUpdate RTW.BuildInfo build information object
target.addAdd target object to internal database
target.clearClear all target objects from internal database (Since R2023a)
target.createCreate target object
target.exportExport target object data
target.getRetrieve target objects from internal database
target.removeRemove target object from internal database
target.updateUpdate target objects in internal database (Since R2023a)
target.upgradeUpgrade existing definitions of hardware devices
addCompileFlagsAdd compiler options to build information
addDefinesAdd preprocessor macro definitions to build information
addIncludeFilesAdd include files to build information
addIncludePathsAdd include paths to build information
addLinkFlagsAdd link options to build information
addLinkObjectsAdd link objects to build information
addNonBuildFilesAdd nonbuild-related files to build information
addPreincludeFilesAdd preinclude files to build information (Since R2024a)
addSourceFilesAdd source files to build information
addSourcePathsAdd source paths to build information
addUndefinesAdd undefine preprocessor directives to build information (Since R2024a)
removeIncludePathsRemove include paths from build information (Since R2023b)
removeSourceFilesRemove source files from build information object (Since R2021b)
removeUndefinesRemove undefine preprocessor macros from build information (Since R2024a)
findBuildArgFind a specific build argument in build information
findIncludeFilesFind and add include (header) files to build information
getBuildArgsGet build arguments from build information
getCompileFlagsGet compiler options from build information
getDefinesGet preprocessor macro definitions from build information
getFullFileListGet list of files from build information
getIncludeFilesGet include files from build information
getIncludePathsGet include paths from build information
getLinkFlagsGet link options from build information
getNonBuildFilesGet nonbuild-related files from build information
getPreincludeFilesGet preinclude files from build information (Since R2024a)
getSourceFilesGet source files from build information
getSourcePathsGet source paths from build information
getUndefinesFrom build information, get preprocessor macros to undefine (Since R2024a)
setTargetProvidesMainDisable inclusion of code generator provided (generated or static) main.c source file during build
updateFilePathsAndExtensionsUpdate files in build information with missing paths and file extensions
updateFileSeparatorUpdate file separator character for file lists in build information

Objects

RTW.BuildInfoProvide information for compiling and linking generated code

Classes

coder.ExternalDependencyInterface to external code
target.AliasCreate alternative identifier for target object
target.BuildToolDescribe build tool (Since R2023a)
target.BuildToolTypeDescribe build tool type (Since R2023a)
target.CMakeSpecify CMake installation for building generated code (Since R2022b)
target.CMakeBuilder Configure how CMake builds generated code (Since R2022b)
target.CMakeBuildTypeDescribe CMake build type or build configuration (Since R2022b)
target.CMakeCacheEntryConfigure a CMake cache entry (Since R2022b)
target.EnvironmentConfigurationConfigure system environment for toolchain (Since R2022b)
target.HardwareComponentSupportDescribe support for a hardware component (Since R2022b)
target.LanguageImplementationProvide C and C++ compiler implementation details
target.ObjectBase class for target types
target.ProcessorProvide target processor information
target.ToolchainCapture high-level information about toolchain (Since R2022b)

Namespaces

targetManage target hardware and build tool information

Topics

Featured Examples