Main Content

addAttribute

Class: coder.make.ToolchainInfo
Namespace: coder.make

Add custom attribute to Attributes

Syntax

h.addAttribute(Name,Value)

Description

h.addAttribute(Name,Value) adds a custom attribute with the specified name and value to coder.make.ToolchainInfo.Attributes. If you do not specify a value, the function initializes the attribute to true (default).

All attributes are optional. The toolchain uses the attributes during the build process.

Input Arguments

expand all

A coder.make.ToolchainInfo object, specified using an object handle, such as h. To create h, enter h = coder.make.ToolchainInfo in a MATLAB® Command Window.

Name-Value Arguments

Specify a Name,Value pair argument. Name is the argument name and Value is the corresponding value.

Look for spaces in paths to source files, include files, include paths, additional source paths, object paths, and prebuild object paths, library paths, and within MACROS used in any of the stated paths. If any path contains spaces, an alternate version of the path is returned. For long path names or paths with spaces, the method returns the '~' version on Windows when 8.3 name creation is enabled. On Linux® platforms, paths with spaces are returned with the spaces escaped.

Create a batch file that runs the generated makefile.

You can run the created batch file only on a Windows® operating system. On an operating system that is not Windows, to avoid running the batch file, set RequiresBatchFile to false or set the GenCodeOnly configuration parameter to true.

Looks in the same locations for UNC paths (Windows only, ignored on Linux/Mac platforms). If there is a drive mapped to the UNC the path is pointing to, then paths that are UNC paths will have a mapped drive letter put in place.

Wrap each path in double quotes if they contain spaces.

For handling long compiler or archiver/linker lines (typically in Windows). If specified:

  • In the compiler command line, the makefile replaces a long list of include paths with a call to the command file

  • In the linker/archiver command line, the makefile replaces a long object file list with a call to a command file.

Build process does not create a response file for the header file paths in the model reference hierarchy, which modifies the behaviour specified by RequiresCommandFile. Set NoCompilerCommandFile to true only if you need to avoid long compiler command lines and your compiler does not support compiler command files. Use with the CopyReferencedModelHeaders attribute.

Copy model reference header files to the referenced_model_includes subfolder in the top model build folder. Set CopyReferencedModelHeaders to true only if you need to avoid long compiler command lines and your compiler does not support compiler command files. Use with the NoCompilerCommandFile attribute.

Append prefix to the linker libraries specified on the command line. Applies only if toolchain has a gmake build artifact.

Example: tc.addAttribute('LinkerLibraryPrefix', '--library=')

Examples

Add an Attribute and Initialize Its Value, Overriding the Default Value

h.Attribute
ans = 


# -------------------
# "Attribute" List
# -------------------
(empty)
h.addAttribute('TransformPathsWithSpaces',false)
h.getAttribute('TransformPathsWithSpaces')
ans  = 

     0

Add Attribute Without Overriding Its Default Value

h.addAttribute('CustomAttribute')
h.Attributes
ans = 


# -------------------
# "Attributes" List
# -------------------
CustomAttribute = true

Add Attribute Using Toolchain Definition File

The intel_tc.m file from the Add Custom Toolchains to MATLAB® Coder™ Build Process example defines the following custom attributes:

tc.addAttribute('TransformPathsWithSpaces');
tc.addAttribute('RequiresCommandFile');
tc.addAttribute('RequiresBatchFile');

To see the property values from that example in the MATLAB Command Window, enter:

h = intel_tc;
h.Attributes
ans = 


# -------------------
# "Attributes" List
# -------------------
RequiresBatchFile        = true
RequiresCommandFile      = true
TransformPathsWithSpaces = true

Version History

Introduced in R2013a