Main Content

setPath

Path 中设置编译工具的路径和宏

语法

h.setPath(btpath,btmacro)

说明

h.setPath(btpath,btmacro)coder.make.BuildTool.Paths 中设置编译工具的路径和宏。

输入参数

全部展开

coder.make.BuildTool 对象的对象句柄,指定为变量。

示例: tool

BuildTool 对象的路径,以标量形式返回。

数据类型: char

BuildTool 对象的路径的宏,以标量形式返回。

数据类型: char

示例

获取默认编译工具并设置其属性

以下示例代码显示 向 MATLAB® Coder™ 编译过程添加自定义工具链 教程中 intel_tc.m 文件的一部分中的 setPath

% ------------------------------
% C Compiler
% ------------------------------
 
tool = tc.getBuildTool('C Compiler');

tool.setName('Intel C Compiler');
tool.setCommand('icl');
tool.setPath('');

tool.setDirective('IncludeSearchPath','-I');
tool.setDirective('PreprocessorDefine','-D');
tool.setDirective('OutputFlag','-Fo');
tool.setDirective('Debug','-Zi');

tool.setFileExtension('Source','.c');
tool.setFileExtension('Header','.h');
tool.setFileExtension('Object','.obj');

tool.setCommandPattern('|>TOOL<| |>TOOL_OPTIONS<| |>OUTPUT_FLAG<||>OUTPUT<|');

以交互方式使用 getPath 和 setPath 方法

此示例说明 MATLAB® 命令行窗口中方法的输入和输出示例:

输入以下行:

tc = coder.make.ToolchainInfo;
tool = tc.getBuildTool('C Compiler');
tool.getPath
ans  = 

     ''
tool.getPath('macro')
ans  = 

CC_PATH
tool.setPath('/gcc')
tool.Path
ans = 

	Macro  : CC_PATH
	Value : /gcc

版本历史记录

在 R2013a 中推出