Control Compiler Optimizations - MATLAB & Simulink (original) (raw)
Main Content
To control compiler optimizations for a makefile build at the GUI level, use the Compiler optimization level parameter. TheCompiler optimization level parameter provides
- Target-independent values
Optimizations on (faster runs)
andOptimizations 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 the Simulink® GUI level, rather than editing compiler flags into template makefiles (TMFs) or supplying compiler flags to build process make commands
The default setting is Optimizations off (faster builds)
. Selecting the valueCustom
enables the Custom compiler optimization flags field, in which you can enter custom compiler optimization flags (for example,-O2
).
If you specify compiler options for your makefile build usingOPT_OPTS
, MEX_OPTS
(exceptMEX_OPTS="-v"
), orMEX_OPT_FILE
, the value of Compiler optimization level is ignored and a warning is issued about the ignored parameter.
For a rapid simulation that uses the MinGW® compiler:
- If
[RTWCompilerOptimization](../../rtw/ref/compileroptimizationlevel.html)
is set to'on'
, the build process customizes compiler optimization to minimize run time. The build process ignores the[BuildConfiguration](../../rtw/ref/buildconfiguration.html)
and[CustomToolchainOptions](../../rtw/ref/toolchaindetails.html)
settings. - If
RTWCompilerOptimization
is set to'custom'
or'off'
, the build process usesBuildConfiguration
andCustomToolchainOptions
settings. The build process ignores theRTWCompilerOptimization
setting.