addSourceFiles
Add source files to build information
Description
addSourceFiles(
specifies source files and paths to add to the build information.buildinfo
,filenames
,paths
,groups
)
The function requires the buildinfo
and
filenames
arguments. You can use an optional
groups
argument to group your options.
The code generator stores the source file and path options in a build information object. The function adds options to the object based on the order in which you specify them.
Examples
Add Source File to Drivers Group
Add the source file driver.c
to the build
information myBuildInfo
and place the file in the group
Drivers
.
myBuildInfo = RTW.BuildInfo; addSourceFiles(myBuildInfo,'driver.c', ... '/proj/src', 'Drivers');
Add Source Files to a Group
Add the source files test1.c
and
test2.c
to the build information
myBuildInfo
and place the files in the group
Tests
.
myBuildInfo = RTW.BuildInfo; addSourceFiles(myBuildInfo, ... {'test1.c' 'test2.c'}, ... '/proj/src','Tests');
Add Source Files to Groups
Add the source files test1.c
,
test2.c
, and driver.c
to the build
information myBuildInfo
. Group the files
test1.c
and test2.c
with the character
vector Tests
. Group the file driver.c
with
the character vector Drivers
.
myBuildInfo = RTW.BuildInfo; addSourceFiles(myBuildInfo, ... {'test1.c' 'test2.c' 'driver.c'}, ... '/proj/src', ... {'Tests' 'Tests' 'Drivers'});
Add Source Files with Wildcard to CFiles
Group
Add the .c
files in a specified folder to
the build information myBuildInfo
and place the files in the
group CFiles
.
myBuildInfo = RTW.BuildInfo; addSourceFiles(myBuildInfo, ... '*.c','/proj/src','CFiles');
Input Arguments
buildinfo
— Build information object
object
RTW.BuildInfo
object that holds information for
compiling and linking generated code.
Example: myBuildInfo
filenames
— List of source files to add to build information
character vector | array of character vectors | string
You can specify the filenames
argument as a
character vector, as an array of character vectors, or as a string. If you
specify the filenames
argument as multiple
character vectors, for example, 'etc.c' 'etc_private.c'
,
the filenames
argument is added to the build
information as an array of character vectors.
If the dot delimiter (.
) is present, the file name text
can include wildcard characters. Examples are '*.*'
,
'*.c'
, and '*.c*'
.
The function removes duplicate included file entries with an exact match of a path and file name to a previously defined entry in the build information object.
Example: '*.c'
paths
— List of source file paths to add to build information
character vector | array of character vectors | string
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.
Example: '/proj/src'
groups
— Optional group name for the added source files
character vector | array of character vectors | string
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,
'Tests' 'Tests' 'Drivers'
, the function relates the
groups
to the
filenames
in order of appearance. For
example, the filenames
argument
'test1.c' 'test2.c' 'driver.c'
is an array of
character vectors with three elements. The first element is in the
'Tests'
group, and the second element is in the
'Tests'
group, and the third element is in the
'Drivers'
group.
Example: 'Tests' 'Tests' 'Drivers'
Version History
Introduced in R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)