Main Content

getIncludeFiles

Get include files from build information

Description

files = getIncludeFiles(buildinfo,concatenatePaths,replaceMatlabroot,includeGroups,excludeGroups) returns the names of include files from the build information.

The function requires the buildinfo, concatenatePaths, and replaceMatlabroot arguments. You can use optional includeGroups and excludeGroups arguments. These optional arguments let you include or exclude groups selectively from the include files returned by the function.

If you choose to specify excludeGroups and omit includeGroups, specify a null character vector ('') for includeGroups.

The makefile for the build resolves file locations based on source paths and rules. The build process does not require you to resolve the path of every file in the build information. If you specify true for the concatenatePaths argument, the getIncludeFiles function returns the path for each file:

  • If a path was explicitly associated with the file when it was added.

  • If you called updateFilePathsAndExtensions (Simulink Coder) to resolve file paths and extensions before calling getIncludeFiles.

example

Examples

collapse all

Get the include paths and file names from the build information, myBuildInfo.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo,{'etc.h' 'etc_private.h' ...
   'mytypes.h'},{'/etc/proj/etclib' '/etcproj/etc/etc_build' ...
   '/common/lib'},{'etc' 'etc' 'shared'});
incfiles=getIncludeFiles(myBuildInfo,true,false);
>> incfiles

incfiles = 

    [1x22 char]    [1x36 char]    [1x21 char]

Get the names of include files in group etc from the build information, myBuildInfo.

myBuildInfo = RTW.BuildInfo;
addIncludeFiles(myBuildInfo,{'etc.h' 'etc_private.h' ...
   'mytypes.h'},{'/etc/proj/etclib' '/etcproj/etc/etc_build' ...
   '/common/lib'},{'etc' 'etc' 'shared'});
incfiles = getIncludeFiles(myBuildInfo,false,false, ... 
   'etc');
>> incfiles

incfiles = 

    'etc.h'     'etc_private.h'

Input Arguments

collapse all

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

SpecifyFunction Action
trueConcatenates and returns each file name with its corresponding path.
falseReturns only file names.

Example: true

Use the replaceMatlabroot argument to control whether the function includes the MATLAB® root definition in the output it returns.

SpecifyFunction Action
trueReplaces the token $(MATLAB_ROOT) with the absolute path for your MATLAB installation folder.
falseDoes not replace the token $(MATLAB_ROOT).

Example: true

Group names of include paths and files to include in the return from the function, specified as a string or a cell array of character vectors. To view the group name of an include path or file, access the Group property of the corresponding object.

Example: ''

Group names of include paths and files to exclude from the return from the function, specified as a string or a cell array of character vectors. To view the group name of an include path or file, access the Group property of the corresponding object.

Example: ''

Output Arguments

collapse all

The names of include files that you add with the addIncludeFiles (Simulink Coder) function. If you call the packNGo (Simulink Coder) function, the names include files that packNGo (Simulink Coder) found and added while packaging code.

Version History

Introduced in R2006a