setPath在 Path 中设置编译工具的路径和宏
全页展开
语法h.setPath(btpath,btmacro)
说明h.setPath(btpath,btmacro) 在 coder.make.BuildTool.Paths 中设置编译工具的路径和宏。
输入参数全部展开
h — 对象句柄 可变coder.make.BuildTool 对象的对象句柄,指定为变量。
示例: tool
btpath — 编译工具对象的路径
字符向量BuildTool 对象的路径,以标量形式返回。
数据类型: char
btmacro — 编译工具对象的路径的宏
字符向量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_PATHtool.setPath('/gcc')
tool.Pathans =
Macro : CC_PATH
Value : /gcc版本历史记录在 R2013a 中推出
另请参阅Properties | getPath
主题向 MATLAB® Coder™ 编译过程添加自定义工具链