Main Content

setPath

Class: coder.make.BuildTool
Package: coder.make

Set path and macro of build tool in Path

Syntax

h.setPath(btpath,btmacro)

Description

h.setPath(btpath,btmacro) sets the path and macro of the build tool in coder.make.BuildTool.Paths.

Input Arguments

expand all

Object handle for a coder.make.BuildTool object, specified as a variable.

Example: tool

The path of BuildTool object, returned as a scalar.

Data Types: char

Macro for path of BuildTool object, returned as a scalar.

Data Types: char

Examples

Get a default build tool and set its properties

The following example code shows setPath in a portion of the intel_tc.m file from the Add Custom Toolchains to MATLAB® Coder™ Build Process tutorial.

% ------------------------------
% 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<|');

Use the getPath and setPath methods interactively

This example shows example inputs and outputs for the methods in a MATLAB® Command Window:

Enter the following lines:

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