view src/ltpda_smoother/compile.m @ 48:16aa66670d74 database-connection-manager

Fix LTPDA Preferences tooltip
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% Compile package within MATLAB
%
% M Hewitson 22-01-07
%
% $Id: compile.m,v 1.12 2011/05/04 12:50:12 ingo Exp $
%
function compile(varargin)

  %% Settings

  PACKAGE_NAME = 'ltpda_smoother';
  RELEASE      = version('-release');

  % compile variables
  src          = './ltpda_smoother.c';
  include      = '';

  % install these files
  files        = {sprintf('ltpda_smoother.%s', mexext), ...
    'ltpda_smoother.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 ltpda_polyreg
    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