-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtwmakecfg.m
66 lines (63 loc) · 2.82 KB
/
rtwmakecfg.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function makeInfo=rtwmakecfg()
%RTWMAKECFG.m adds include and source directories to rtw make files.
% makeInfo=RTWMAKECFG returns a structured array containing
% following field:
% makeInfo.includePath - cell array containing additional include
% directories. Those directories will be
% expanded into include instructions of Simulink
% Coder generated make files.
%
% makeInfo.sourcePath - cell array containing additional source
% directories. Those directories will be
% expanded into rules of Simulink Coder generated
% make files.
makeInfo.includePath = {};
makeInfo.sourcePath = {};
makeInfo.linkLibsObjs = {};
%<Generated by S-Function Builder 3.0. DO NOT REMOVE>
sfBuilderBlocksByMaskType = find_system(bdroot,'FollowLinks','on','LookUnderMasks','on','MaskType','S-Function Builder');
sfBuilderBlocksByCallback = find_system(bdroot,'OpenFcn','sfunctionwizard(gcbh)');
sfBuilderBlocksDeployed = find_system(bdroot,'BlockType','S-Function','SFunctionDeploymentMode','on');
sfBuilderBlocks = {sfBuilderBlocksByMaskType{:} sfBuilderBlocksByCallback{:} sfBuilderBlocksDeployed{:}};
sfBuilderBlocks = unique(sfBuilderBlocks);
if isempty(sfBuilderBlocks)
return;
end
sfBuilderBlockNameMATFile = cell(1, length(sfBuilderBlocks));
for idx = 1:length(sfBuilderBlocks)
sfBuilderBlockNameMATFile{idx} = get_param(sfBuilderBlocks{idx},'FunctionName');
sfBuilderBlockNameMATFile{idx} = ['.' filesep 'SFB__' char(sfBuilderBlockNameMATFile{idx}) '__SFB.mat'];
end
sfBuilderBlockNameMATFile = unique(sfBuilderBlockNameMATFile);
for idx = 1:length(sfBuilderBlockNameMATFile)
if exist(sfBuilderBlockNameMATFile{idx}, 'file')
loadedData = load(sfBuilderBlockNameMATFile{idx});
if isfield(loadedData,'SFBInfoStruct')
makeInfo = UpdateMakeInfo(makeInfo,loadedData.SFBInfoStruct);
clear loadedData;
end
end
end
function updatedMakeInfo = UpdateMakeInfo(makeInfo,SFBInfoStruct)
updatedMakeInfo = {};
if isfield(makeInfo,'includePath')
if isfield(SFBInfoStruct,'includePath')
updatedMakeInfo.includePath = {makeInfo.includePath{:} SFBInfoStruct.includePath{:}};
else
updatedMakeInfo.includePath = {makeInfo.includePath{:}};
end
end
if isfield(makeInfo,'sourcePath')
if isfield(SFBInfoStruct,'sourcePath')
updatedMakeInfo.sourcePath = {makeInfo.sourcePath{:} SFBInfoStruct.sourcePath{:}};
else
updatedMakeInfo.sourcePath = {makeInfo.sourcePath{:}};
end
end
if isfield(makeInfo,'linkLibsObjs')
if isfield(SFBInfoStruct,'additionalLibraries')
updatedMakeInfo.linkLibsObjs = {makeInfo.linkLibsObjs{:} SFBInfoStruct.additionalLibraries{:}};
else
updatedMakeInfo.linkLibsObjs = {makeInfo.linkLibsObjs{:}};
end
end