]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/blob - rpp/blocks/compile_blocks.m
Remove unnecessary CAN_Common_MdlInitSizes call
[jenkicar/rpp-simulink.git] / rpp / blocks / compile_blocks.m
1 % Copyright (C) 2013-2014 Czech Technical University in Prague
2 %
3 % Authors:
4 %     - Carlos Jenkins <carlos@jenkins.co.cr>
5 %
6 % This document contains proprietary information belonging to Czech
7 % Technical University in Prague. Passing on and copying of this
8 % document, and communication of its contents is not permitted
9 % without prior written authorization.
10 %
11 % File : compile_blocks.m
12 % Abstract:
13 %     Compile all the C-MEX S-Function in current folder.
14 %
15 % References:
16 %     http://www.mathworks.com/help/matlab/ref/mex.html
17 %     http://www.mathworks.com/help/matlab/matlab_external/custom-building-mex-files.html
18
19
20 function compile_blocks()
21
22     % Options:
23     % -g        Create a binary MEX-file containing additional symbolic
24     %           information for use in debugging. This option disables the mex
25     %           default behavior of optimizing built object code
26     %           (see the -O option).
27     % -v        Verbose mode. Print the values for important internal variables
28     %           after the options file is processed and all command-line
29     %           arguments are considered. Prints each compile step and final
30     %           link step fully evaluated.
31     % options = '-v -g';
32     options = '';
33     mex = fullfile(matlabroot(), 'bin', 'mex');
34     sources = dir('sfunction_*.c');
35
36     for i = sources'
37         local_opts = options;
38         if strcmp(i.name, 'sfunction_canreceive.c') || ...
39            strcmp(i.name, 'sfunction_cantransmit.c'),
40             local_opts = [local_opts ' ' ...
41                 '-I' matlabroot  '/toolbox/shared/can/src/scanutil ' ...
42                 '-I' matlabroot  '/toolbox/rtw/targets/common/can/datatypes ' ...
43                 matlabroot '/toolbox/rtw/targets/common/can/datatypes/sfun_can_util.c '...
44                 matlabroot '/toolbox/rtw/targets/common/can/datatypes/can_msg.c'];
45         end
46         command = [mex ' ' i.name ' ' local_opts];
47         disp(command);
48         [status, result] = system(command);
49         if status ~= 0,
50             disp(result)
51             throw(MException('rpp:compile_block_failure', [i.name, ' failed to compile']))
52         end
53     end
54
55 end