| Contents | Index |
addDefines(buildinfo, macrodefs, groups)
groups is optional.
Build information returned by RTW.BuildInfo.
A character array or cell array of character arrays that specifies the preprocessor macro definitions to be added to the object. The function adds each definition to the end of a compiler option vector. If you specify multiple definitions within a single character array, for example '-DRT -DDEBUG', the function adds the string to the vector as a single element. For example, if you add '-DPROTO -DDEBUG' and then '-DPRODUCTION', the vector consists of two elements, as shown below.
'-DPROTO -DDEBUG' '-DPRODUCTION'
A character array or cell array of character arrays that groups specified definitions. You can use groups to
Document the use of specific macro definitions
Retrieve or apply groups of macro definitions
You can apply
A single group name to one or more macro definitions
Multiple group names to collections of macro definitions (available for nonmakefile build environments only)
| To... | Specify groups as a... |
|---|---|
| Apply one group name to all macro definitions | Character array. |
| Apply different group names to macro definitions | Cell array of character arrays such that the number of group names matches the number of elements you specify for macrodefs. |
The addDefines function adds specified preprocessor macro definitions to the model build information. The Simulink Coder software stores the definitions in a vector. The function adds definitions to the end of the vector based on the order in which you specify them.
In addition to the required buildinfo and macrodefs arguments, you can use an optional groups argument to group your options.
Add the macro definition -DPRODUCTION to build information myModelBuildInfo and place the definition in the group OPTS.
myModelBuildInfo = RTW.BuildInfo; addDefines(myModelBuildInfo, '-DPRODUCTION', 'OPTS');
Add the macro definitions -DPROTO and -DDEBUG to build information myModelBuildInfo and place the definitions in the group OPT_OPTS.
myModelBuildInfo = RTW.BuildInfo; addDefines(myModelBuildInfo, ... '-DPROTO -DDEBUG', 'OPT_OPTS');
For a nonmakefile build environment, add the macro definitions -DPROTO, -DDEBUG, and -DPRODUCTION to build information myModelBuildInfo. Place the definitions -DPROTO and -DDEBUG in the group Debug and the definition -DPRODUCTION in the group Release.
myModelBuildInfo = RTW.BuildInfo;
addDefines(myModelBuildInfo, ...
{'-DPROTO -DDEBUG' '-DPRODUCTION'}, ...
{'Debug' 'Release'});addCompileFlags | addLinkFlags | getDefines

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |