target.Toolchain Class
Namespace: target
Description
Use a target.Toolchain
object to capture high-level information about a
toolchain.
To create a target.Toolchain
object, use the target.create
function. Create the object in a single
step.
toolchainObject = target.create('Toolchain', ... nameOfToolchain, ... parameterXName, parameterXValue, ... parameterYName, parameterYValue, ... parameterZName, parameterZValue)
nameOfToolchain
is the name of the target.Toolchain
object that you want to create.
parameterXName
is the name of either a property or a referenced
object property –– see tables below.Properties
Id
— Object identifier
string
Unique ID of object in internal database.
Attributes:
GetAccess | public |
SetAccess | private |
Name
— Toolchain name
string
Name of the toolchain, in a form that you want workflows to display.
Example: 'CMake/Ninja for all
hosts'
Attributes:
GetAccess | public |
SetAccess | public |
SupportedHardware
— Supported target devices
target.HardwareComponentSupport
object array
Optional. Target devices for which the toolchain can build code.
Attributes:
GetAccess | public |
SetAccess | public |
HostOperatingSystemSupport
— Operating system support
target.HostOperatingSystemSupport
object
Development computer operating systems that the toolchain can run on.
Attributes:
GetAccess | public |
SetAccess | public |
Tools
— Toolchain tools
target.Tool
object array
Tools in the toolchain.
If you use name-value arguments to create a target.Toolchain
object, for the Tools
property, specify these
arguments.
Name | Description |
---|---|
'Family' | Provides an initial list of tools through a default set of
Example: |
'Assembler' | Optional. In the list of tools, specify the assembler through a
Example: |
'CCompiler' | Optional. In the list of tools, specify the C compiler through a
Example: |
'CppCompiler' | Optional. In the list of tools, specify the C++ compiler through
a
Example: |
'Linker' | Optional. In the list of tools, specify the linker through a
Example: |
'CppLinker' | Optional. In the list of tools, specify the C++ linker through a
Example: |
'Archiver' | Optional. In the list of tools, specify the archiver through a
Example: |
'MakeTool' | Optional. In the list of tools, specify the
Example: |
'CommandFile' | Optional. For each tool that supports a command file directive,
specify the directive through the corresponding
Example: |
'ObjectExtension' | Optional. Specify the file extension that the tools
( Example: |
'ExecutableExtension' | Optional. Specify the file extension that the tools
( Example: |
'SharedLibraryExtension' | Optional. Specify the file extension that the tools
( Example: |
'StaticLibraryExtension' | Optional. Specify the file extension that the tools
( Example: |
'FileSep' | Optional. Specify the file separator that the tools
( Example:
|
'ToolPrefix' | Optional when Example: |
Attributes:
GetAccess | public |
SetAccess | public |
Builder
— Builder configuration
target.CMakeBuilder
object | target.MakefileBuilder
object
An object that describes the configuration of a build automation tool. For a
CMake-based toolchain, use a target.CMakeBuilder
object. For a
makefile-based toolchain, use a target.MakefileBuilder
object.
If you use name-value arguments to create a target.Toolchain
object, for the Builder
property, specify this
argument.
Name | Description |
---|---|
'MakeToolType' | Required. Example: |
'Generator' | Optional. Example:
|
'ToolchainFile' | Optional. Example:
|
Attributes:
GetAccess | public |
SetAccess | public |
BuildRequirements
— Build dependencies
target.BuildDependencies
object
C and C++ build dependencies that you must associate with the toolchain. For example, specific preprocessor directives or libraries. When you specify this property, every build that uses the toolchain includes the dependencies.
If you use name-value arguments to create a target.Toolchain
object, for the BuildRequirements
property, specify these
arguments.
Name | Description |
---|---|
'SharedLibraries' | Optional. Example:
|
'CompilerFlags' | Optional. Example:
|
'LinkerFlags' | Optional. Example:
|
Attributes:
GetAccess | public |
SetAccess | public |
EnvironmentConfiguration
— Environment configuration
target.EnvironmentConfiguration
object array
An array of objects that provide system environment setup commands and paths that are required for the use of the toolchain. For example, vendor-supplied setup scripts. Use only one object for each operating system of a development computer.
If you use name-value arguments to create a target.Toolchain
object, for the EnvironmentConfiguration
property, specify this
argument.
Name | Description |
---|---|
'SystemPaths' | Optional. Example: |
Attributes:
GetAccess | public |
SetAccess | public |
runsOn
— Remote build connection
'' (default) | SSHExecutionContext
object
Optional. For the build process, specify the use of a remote toolchain through a
connection with the remote build computer. You can specify an SSH connection by using
the SSHExecutionContext
object that is produced when you run
target.ExecutionContext.SSH()
. For
example:
tc.RunsOn = target.ExecutionContext.SSH();
Attributes:
GetAccess | public |
SetAccess | public |
Examples
Use target.Toolchain
to Configure CMake Build
This code snippet from Create Custom CMake Toolchain Definition shows
how you can create a target.Toolchain
object and use it to configure
the way CMake builds generated code.
tc = target.create('Toolchain', 'Name', 'Example Custom CMake Toolchain'); tc.Builder = target.create('CMakeBuilder'); tc.Builder.Generator = 'Ninja'; tc.Builder.ToolchainFile = 'pathTo/ExampleCMakeToolchain.cmake';
Or, create the object in a single step.
tc = target.create('Toolchain', ... 'Name', 'Example Custom CMake Toolchain', ... 'MakeToolType', 'CMake', ... 'Generator', 'Ninja', ... 'ToolchainFile', 'pathTo/ExampleCMakeToolchain.cmake')
Use target.Toolchain
Object to Configure Makefile Build
This command creates an object for a GNU®-based toolchain by using several name-value arguments.
mingwtc = target.create('Toolchain', ... 'MakeToolType', 'GMake', ... 'Name', 'ARM Toolchain', ... 'SystemPaths', {'$(ARM_TOOLS_LOCATION)/bin'}, ... 'CCompiler', 'arm-none-eabi-gcc', ... 'CppCompiler', 'arm-none-eabi-g++', ... 'Linker', 'arm-none-eabi-gcc', ... 'CppLinker', 'arm-none-eabi-g++', ... 'CompilerFlags', {'-fwrapv', '-fPIC'});
Using the Family
and ToolPrefix
name-value
arguments, you can create the same
object.
target.create('Toolchain', ... 'Family', 'GNU', ... 'Name', 'ARM Toolchain', ... 'ToolPrefix', 'arm-none-eabi-');
To capture information about a more customized toolchain, you can use additional name-value arguments. For example:
target.create('Toolchain', ... 'Family', 'GNU', ... 'Name', 'ARM Toolchain', ... 'ToolPrefix', 'arm-none-eabi-', ... 'SystemPaths', {'$(ARM_TOOLS_LOCATION)/bin'}, ... 'CompilerFlags', {'-fwrapv', '-fPIC'});;
Version History
Introduced in R2022b
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)