Skip to Main Content Skip to Search
Product Documentation

addCompileFlags - Add compiler options to model build information

Syntax

addCompileFlags(buildinfo, options, groups)

groups is optional.

Arguments

buildinfo

Build information returned by RTW.BuildInfo.

options

A character array or cell array of character arrays that specifies the compiler options to be added to the build information. The function adds each option to the end of a compiler option vector. If you specify multiple options within a single character array, for example '-Zi -Wall', the function adds the string to the vector as a single element. For example, if you add '-Zi -Wall' and then '-O3', the vector consists of two elements, as shown below.

'-Zi -Wall'    '-O3'
groups (optional)

A character array or cell array of character arrays that groups specified compiler options. You can use groups to

  • Document the use of specific compiler options

  • Retrieve or apply collections of compiler options

You can apply

  • A single group name to one or more compiler options

  • Multiple group names to collections of compiler options (available for nonmakefile build environments only)

To...Specify groups as a...
Apply one group name to all compiler optionsCharacter array.
Apply different group names to compiler optionsCell array of character arrays such that the number of group names matches the number of elements you specify for options.

    Note  

    • To specify compiler options to be used in the standard Simulink Coder makefile build process, specify groups as either 'OPTS' or 'OPT_OPTS'.

    • To control compiler optimizations for your Simulink Coder makefile build at Simulink GUI level, use the Compiler optimization level parameter on the Code Generation pane of the Simulink Configuration Parameters dialog box. The Compiler optimization level parameter provides

      • Target-independent values Optimizations on (faster runs) and Optimizations off (faster builds), which allow you to easily toggle compiler optimizations on and off during code development

      • The value Custom for entering custom compiler optimization flags at Simulink GUI level (rather than at other levels of the build process)

      If you use the configuration parameter Make command to specify compiler options for your Simulink Coder makefile build using OPT_OPTS, MEX_OPTS (except MEX_OPTS="-v"), or MEX_OPT_FILE, the value of Compiler optimization level is ignored and a warning is issued about the ignored parameter.

Description

The addCompileFlags function adds specified compiler options to the model build information. Simulink Coder stores the compiler options in a vector. The function adds options to the end of the vector based on the order in which you specify them.

In addition to the required buildinfo and options arguments, you can use an optional groups argument to group your options.

Examples

See Also

addDefines | addLinkFlags | getCompileFlags

How To

  


Related Products & Applications

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