addDefines
Add preprocessor macro definitions to build information
Description
addDefines(
specifies the preprocessor macro definitions to add to the build information.buildinfo
,macrodefs
,groups
)
The function requires the buildinfo
and
macrodefs
arguments. You can use an optional
groups
argument to group your options.
The code generator stores the definitions in a build information object. The function adds definitions to the object based on the order in which you specify them.
Examples
Add Macro Definitions to OPTS Group
Add a macro definition -DPRODUCTION
to the build
information myBuildInfo
and place the definition in the group
OPTS
.
myBuildInfo = RTW.BuildInfo; addDefines(myBuildInfo,'-DPRODUCTION','OPTS');
Add a macro definition MYDEF
with value
MYVAL
.
addDefines(myBuildInfo,'-MYDEF=MYVAL','OPTS');
Add a macro definition MYDEF
with empty value.
addDefines(myBuildInfo,'-MYDEF=','OPTS');
Add a macro definition MYDEF
with undefined value.
addDefines(myBuildInfo,'-MYDEF','OPTS');
Add Macro Definitions to OPT_OPTS Group
Add the macro definitions -DPROTO
and
-DDEBUG
to the build information myBuildInfo
and
place the definitions in the group OPT_OPTS
.
myBuildInfo = RTW.BuildInfo; addDefines(myBuildInfo, ... '-DPROTO -DDEBUG','OPT_OPTS');
Add Macro Definitions to Build Information
For a non-makefile build environment, add the macro definitions
-DPROTO
, -DDEBUG
, and
-DPRODUCTION
to the build information myBuildInfo
.
Place the definitions -DPROTO
and -DDEBUG
in the
group Debug
and the definition -DPRODUCTION
in the
group Release
.
myBuildInfo = RTW.BuildInfo; addDefines(myBuildInfo, ... {'-DPROTO -DDEBUG' '-DPRODUCTION'}, ... {'Debug' 'Release'});
Input Arguments
buildinfo
— Name of build information object returned by RTW.BuildInfo
object
Object contains information for compiling and linking generated code.
macrodefs
— List of macro definitions to add to build information
character vector | array of character vectors | string
You can specify the macrodefs
argument as a character
vector, as an array of character vectors, or as a string. You can specify the
macrodefs
argument as multiple definitions within a single
character vector, for example '-DRT -DDEBUG'
. If you specify the
macrodefs
argument as multiple character vectors, for
example'-DPROTO -DDEBUG'
and '-DPRODUCTION'
, the
macrodefs
argument is added to the build information as an
array of character vectors.
Example: {'-DPROTO -DDEBUG' '-DPRODUCTION'}
groups
— Optional group name for the added compiler options
character vector | array of character vectors | string
You can specify the groups
argument as a character
vector, as an array of character vectors, or as a string. If you specify multiple
groups
, for example 'Debug' 'Release'
,
the function relates the groups
to the
macrodefs
in order of appearance. For example, the
macrodefs
argument {'-DPROTO -DDEBUG'
'-DPRODUCTION'}
is an array of character vectors with two elements. The
first element is in the 'Debug'
group and the second element is in
the 'Release'
group.
Note
The template makefile-based build process considers only macro definitions in the
'OPTS'
, 'OPT_OPTS'
,
'OPTIMIZATION_FLAGS'
, and 'Custom'
groups when
generating the makefile.
For the build process to consider definitions in other groups, the template
makefile must contain the token |>DEFINES_OTHER<|
.
Example: {'Debug' 'Release'}
Version History
Introduced in R2006a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)