Main Content

Build Configuration

Configuration of build settings such as output file name, location, type, language

To control and configure the build process for generating binary code, there are many parameters and settings. These settings control attributes such as the output build type (MEX, lib, dll, or exe) and C versus C++ language. Other build settings enable you to customize the build output according to specific needs, such as readability, performance, and external code integration. You can modify the build options in the code generation configuration object from the app or from the command line. You can create the configuration object by using coder.config. Open the object in the editing app by using open. To specify additional build files and flags from inside your function code, use coder.updateBuildInfo.


expand all

coder.configCreate MATLAB Coder code generation configuration objects
coder.updateBuildInfoUpdate build information object RTW.BuildInfo
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 (Since R2019b)
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 (Since R2019b)
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
addTMFTokensAdd template makefile (TMF) tokens 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


coder.MexCodeConfigConfiguration parameters for MEX function generation from MATLAB code
coder.CodeConfigConfiguration parameters for C/C++ code generation from MATLAB code
coder.EmbeddedCodeConfigConfiguration parameters for C/C++ code generation from MATLAB code with Embedded Coder
coder.HardwareImplementationHardware-specific configuration parameters for C/C++ code generation from MATLAB code
coder.hardwareCreate hardware board configuration object for C/C++ code generation from MATLAB code
coder.ReplacementTypesConfiguration parameter to specify custom names for MATLAB built-in data types in C/C++ code generation (Since R2019b)
RTW.BuildInfoProvide information for compiling and linking generated code


coder.ExternalDependencyInterface to external code
target.AliasCreate alternative identifier for target object
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 (Since R2019b)
target.ProcessorProvide target processor information
target.ToolchainCapture high-level information about toolchain (Since R2022b)


targetManage target hardware and build tool information


Build Configuration Basics

Specific Build Options