Main Content

addSourcePaths

Add source paths to build information

Description

example

addSourcePaths(buildinfo,paths,groups) specifies source file paths to add to the build information.

The function requires the buildinfo and paths arguments. You can use an optional groups argument to group your options.

The code generator stores the source file path options in a build information object. The function adds options to the object based on the order in which you specify them.

The code generator does not check whether a specified path is valid.

Note

If you want to add source files and the corresponding file paths to build information, use the addSourceFiles function. Do not use addSourcePaths.

Examples

collapse all

Add the source path /etcproj/etc/etc_build to the build information myBuildInfo.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo, ...
   '/etcproj/etc/etc_build');

Add the source paths /etcproj/etclib and /etcproj/etc/etc_build to the build information myBuildInfo and place the files in the group etc.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo, ...
   {'/etcproj/etclib' '/etcproj/etc/etc_build'},'etc');

Add the source paths /etcproj/etclib, /etcproj/etc/etc_build, and /common/lib to the build information myBuildInfo. Group the paths /etc/proj/etclib and /etcproj/etc/etc_build with the character vector etc and the path /common/lib with the character vector shared.

myBuildInfo = RTW.BuildInfo;
addSourcePaths(myBuildInfo,...
   {'/etc/proj/etclib' '/etcproj/etc/etc_build'...
   '/common/lib'}, {'etc' 'etc' 'shared'});

Input Arguments

collapse all

RTW.BuildInfo object that contains information for compiling and linking generated code.

You can specify the paths argument as a character vector, as an array of character vectors, or as a string. If you specify a single path as a character vector, the function uses that path for all files. If you specify the paths argument as multiple character vectors, for example, '/proj/src' and '/proj/inc', the paths argument is added to the build information as an array of character vectors.

The function removes duplicate source file path entries with an exact match of a path and file name to a previously defined entry in the build information object.

Example: '/proj/src'

You can specify the groups argument as a character vector, as an array of character vectors, or as a string. If you specify multiple groups, for example, 'etc' 'etc' 'shared', the function relates the groups to the paths in order of appearance. For example, the paths argument '/etc/proj/etclib' '/etcproj/etc/etc_build' '/common/lib' is an array of character vectors with three elements. The first element is in the 'etc' group, the second element is in the 'etc' group, and the third element is in the 'shared' group.

Example: 'etc' 'etc' 'shared'

Version History

Introduced in R2006a