0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % Compile package within MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % M Hewitson 22-01-07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % $Id: compile.m,v 1.14 2011/05/04 12:50:12 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 function compile(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %% Settings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 PACKAGE_NAME = 'ltpda_polyreg';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 RELEASE = version('-release');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % compile variables
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 src = './ltpda_polyreg.c ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 include = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % install these files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 files = {sprintf('ltpda_polyreg.%s', mexext), ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 'ltpda_polyreg.m'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %% Set variables for this platform
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 os = computer;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 switch os
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 case 'PCWIN' % Windows
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 platform = 'Windows PC';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 mexPkg = 'windows';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 case 'PCWIN64' % Windows 64-bit
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 platform = 'Windows PC 64-bit';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 mexPkg = 'windows64';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 case 'GLNX86' % Linux
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 platform = 'Linux PC';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 mexPkg = 'linux';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 case 'GLNXA64' % Linux
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 platform = 'Linux PC 64-bit';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 mexPkg = 'linux64';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 case 'MAC' % Mac PPC
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 platform = 'PPC Mac';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 mexPkg = 'macppc';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 case 'MACI' % Mac intel
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 platform = 'Intel Mac';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 mexPkg = 'macintel';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 case 'MACI64' % 64-bit Intel Mac
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 platform = 'Intel Mac 64-bit';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 mexPkg = 'maci64';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 error('### compile: unknown platform');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 disp(sprintf('* Compiling %s for %s', PACKAGE_NAME, platform));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 %% Compile ltpda_polyreg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 extras = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 switch os
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 case 'PCWIN64'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 cmd = sprintf('mex -f mexopts_XP64bit.bat -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 case 'PCWIN'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 cmd = sprintf('mex -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 case 'MACI'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 cmd = sprintf('mex -f mexopts.sh -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 case 'MACI64'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 cmd = sprintf('mex -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 case 'GLNX86'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 cmd = sprintf('mex -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 case 'GLNXA64'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 cmd = sprintf('mex -v %s %s %s', extras, include, src)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 eval(cmd)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 if nargin==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 return % It is not necessary to copy the mex file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 installPoint = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 mkdir(installPoint)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 for f = files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 fi = char(f);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 disp(sprintf(' - installing %s', fi));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 copyfile(fi, installPoint);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85
|