source: trunk/src/compile.m @ 643

Last change on this file since 643 was 606, checked in by sommeria, 11 years ago

bug on compilation solved (still to test with transform_field fct). faster browser inrtroduced. Various bug corrections

File size: 1.5 KB
Line 
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%
8function compile (FctName,SubfctPath)
9if isempty(which('mcc'))
10    msgbox_uvmat('no Matlab compiler toolbox mcc installed')
11    return
12end
13disp(['compiling ' FctName ' ...'])
14% commands to compile civ_matlab and eventually other functions
15if ~exist('bin','dir')
16    [success,errormsg]=mkdir('bin');
17    if success~=1
18        display(errormsg)
19    end
20end
21if ~isempty(SubfctPath)
22    SubfctPath=['-I ' SubfctPath];%string indicating the option of including the path SubfctPath
23end
24disp(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m'])
25eval(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh]
26%eval(['mcc -m -R -nojvm -R -nodisplay ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName
27system(['mv -f ' FctName ' bin/']);%move the binary file FctName to the subdir /bin
28system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctName '.sh']);%modify the cmd file and copy it to [FctName '.sh']
29system(['rm run_' FctName '.sh']);% remove the initial cmd file [run_' FctName '.sh]
30system(['chmod +x ' FctName '.sh']); % set the cmd file to 'executable'
31display('** END **')
32end
33
34
35
Note: See TracBrowser for help on using the repository browser.