view src/ltpda_dft/compile.m @ 22:b11e88004fca database-connection-manager

Update collection.fromRepository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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