Mercurial > hg > ltpda
diff src/ltpda_dft/compile.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ltpda_dft/compile.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,86 @@ +% Compile package within MATLAB +% +% M Hewitson 22-01-07 +% +% $Id: compile.m,v 1.20 2011/05/04 12:50:12 ingo Exp $ +% +function compile(varargin) + + %% Settings + + PACKAGE_NAME = 'ltpda_dft'; + RELEASE = version('-release'); + + % compile variables + src = './ltpda_dft.c '; + include = ''; + + % install these files + files = {sprintf('ltpda_dft.%s', mexext), ... + 'ltpda_dft.m'}; + + + %% Set variables for this platform + + os = computer; + switch os + case 'PCWIN' % Windows + platform = 'Windows PC'; + mexPkg = 'windows'; + case 'PCWIN64' % Windows 64-bit + platform = 'Windows PC 64-bit'; + mexPkg = 'windows64'; + case 'GLNX86' % Linux + platform = 'Linux PC'; + mexPkg = 'linux'; + case 'GLNXA64' % Linux + platform = 'Linux PC 64-bit'; + mexPkg = 'linux64'; + case 'MAC' % Mac PPC + platform = 'PPC Mac'; + mexPkg = 'macppc'; + case 'MACI' % Mac intel + platform = 'Intel Mac'; + mexPkg = 'macintel'; + case 'MACI64' % 64-bit Intel Mac + platform = 'Intel Mac 64-bit'; + mexPkg = 'maci64'; + otherwise + error('### compile: unknown platform'); + end + + + + disp(sprintf('* Compiling %s for %s', PACKAGE_NAME, platform)); + + %% Compile test_ltpda_lpsd + extras = ''; + switch os + case 'PCWIN64' + cmd = sprintf('mex -f mexopts_XP64bit.bat -v %s %s %s', extras, include, src) + case 'PCWIN' + cmd = sprintf('mex -v %s %s %s', extras, include, src) + case 'MACI' + cmd = sprintf('mex -f mexopts.sh -v %s %s %s', extras, include, src) + case 'MACI64' + cmd = sprintf('mex -v %s %s %s', extras, include, src) + case 'GLNX86' + cmd = sprintf('mex -v %s %s %s', extras, include, src) + case 'GLNXA64' + cmd = sprintf('mex -v %s %s %s', extras, include, src) + end + eval(cmd) + + if nargin==0 + return % It is not necessary to copy the mex file. + else + installPoint = varargin{1}; + end + mkdir(installPoint) + for f = files + fi = char(f); + disp(sprintf(' - installing %s', fi)); + copyfile(fi, installPoint); + end +end +