Rev | Line | |
---|
[593] | 1 | %'compile': compile a Matlab function, create a binary in a subdirectory /bin |
---|
| 2 | %-------------------------------------------------------------------- |
---|
| 3 | % compile (FctName) |
---|
| 4 | % |
---|
| 5 | %INPUT: |
---|
| 6 | %FctName: name of the Matlab fct to compile (without .m extension) |
---|
| 7 | % |
---|
[606] | 8 | function compile (FctName,SubfctPath) |
---|
[593] | 9 | if isempty(which('mcc')) |
---|
[746] | 10 | msgbox_uvmat('ERROR','no Matlab compiler toolbox mcc installed') |
---|
[593] | 11 | return |
---|
[746] | 12 | else |
---|
[747] | 13 | hh=msgbox_uvmat('WAITING...',['compilation of ' FctName ' in progress...']); |
---|
[593] | 14 | end |
---|
[606] | 15 | disp(['compiling ' FctName ' ...']) |
---|
[593] | 16 | % commands to compile civ_matlab and eventually other functions |
---|
| 17 | if ~exist('bin','dir') |
---|
| 18 | [success,errormsg]=mkdir('bin'); |
---|
| 19 | if success~=1 |
---|
| 20 | display(errormsg) |
---|
| 21 | end |
---|
| 22 | end |
---|
[606] | 23 | if ~isempty(SubfctPath) |
---|
| 24 | SubfctPath=['-I ' SubfctPath];%string indicating the option of including the path SubfctPath |
---|
| 25 | end |
---|
[800] | 26 | disp(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m']) |
---|
[746] | 27 | try |
---|
[800] | 28 | eval(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh] |
---|
[746] | 29 | system(['mv -f ' FctName ' bin/']);%move the binary file FctName to the subdir /bin |
---|
| 30 | system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctName '.sh']);%modify the cmd file and copy it to [FctName '.sh'] |
---|
| 31 | system(['rm run_' FctName '.sh']);% remove the initial cmd file [run_' FctName '.sh] |
---|
| 32 | system(['chmod +x ' FctName '.sh']); % set the cmd file to 'executable' |
---|
| 33 | catch ME |
---|
| 34 | msgbox_uvmat('ERROR',ME.message); |
---|
| 35 | end |
---|
[593] | 36 | display('** END **') |
---|
[746] | 37 | delete(hh) |
---|
[593] | 38 | |
---|
| 39 | |
---|
| 40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.