Commit 277d8341 authored by Jay Dubb's avatar Jay Dubb
Browse files

-- In setpaths exclude more folders to avoid problems and headaches with...

-- In setpaths exclude more folders to avoid problems and headaches with unexpected matlab behavior because of inclusion of weird .m files from a build of AV. So for instance exclude *.app and *_install folders which contain a large amount of files which should never be included in matlab search paths.
-- Add ability to findDotMFolders to exclude folders based on wildcard patterns rather than only explicit names. This allows exclusion of many folders that fit a pattern without having to explicitly list ALL of them
-- Fix several bugs in the build for MAC
-- Finally fixed the requirement that you have to run MAC installation specifically from ~/Downloads/homer3_install. Added code to makesetup.pl to create a more intelligent setup.command which does not depend on execution from a specific folder.
parent d8641441
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
function Buildexe(appName, exclList, flags)
function Buildexe(appName, exclList, inclList, flags)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BuildExe allows building of the current directories project in 
@@ -14,15 +14,19 @@ rootdir = filesepStandard(pwd);
if ~exist('appName','var')
    [~, appName] = fileparts(rootdir);
end
rootdir = filesepStandard(fileparts(which(appName)));

if ~exist('exclList','var')
    exclList = {};
end
if ~exist('inclList','var')
    inclList = {};
end
if ~exist('flags','var')
    flags = {};
end

rootdir = filesepStandard(fileparts(which(appName)));


% Matlab compiler generates a readme file that overwrites the app readme
% that already xists. Before we start build , move readme to temp file and 
% at end of build delete the newly generated readme and move the temp one 
@@ -62,6 +66,8 @@ appDotMFilesStr = sprintf('-v %s', appDotMFileMain');

% Get all .m files which will go into making the app executable
appDotMFiles = findDotMFiles(rootdir, exclList);
appDotMFiles = [appDotMFiles; inclList];


% Create compile switches string
compileSwitches = '';
+10 −1
Original line number Diff line number Diff line
@@ -11,13 +11,22 @@ exclLst = {
    'Docs';
    'UnitTests'; ...
    'Install';
    'submodules';
    'Data';
    'setpaths.m';
    'getpaths.m';
    };

Buildexe(appname, exclLst)
rootdir = filesepStandard(fileparts(which(platform.exename{1})));
for ii = 1:length(platform.exename)
    rootdir = filesepStandard(fileparts(which(platform.exename{ii})));
    if ~isempty(rootdir)
        break;
    end    
end
if isempty(rootdir)
    return;
end
for ii = 1:length(platform.exename)
    if exist([rootdir,  platform.exename{ii}],'file')
        movefile([rootdir,  platform.exename{ii}], dirnameInstall);
+17 −1
Original line number Diff line number Diff line
@@ -6,5 +6,21 @@ end
if exist(dirnameInstall,'dir')
    cd(dirnameInstall);
end
Buildexe('setup');

p = filesepStandard(fileparts(which(getNamespace())));
inclList = {
    [p, 'Utils/Shared/Logger.m'];
    [p, 'Utils/Shared/str2cell.m'];
    [p, 'Utils/Shared/printStack.m'];
    [p, 'Utils/Shared/pathscompare.m'];
    [p, 'Utils/Shared/parseOptions.m'];
    [p, 'Utils/Shared/optionExists.m'];
    [p, 'Utils/Shared/fullpath.m'];
    [p, 'Utils/Shared/filesepStandard.m'];
    };

Buildexe('setup', {}, inclList);
if ispathvalid([dirnameInstall, 'Buildme.log'])
    movefile([dirnameInstall, 'Buildme.log'], [dirnameInstall, 'Buildme_Setup.log'])
end
cd(currdir);
+5 −5
Original line number Diff line number Diff line
@@ -3,14 +3,14 @@ global platform

installfilename = sprintf('%s_install', lower(getAppname()));

if ~exist('dirnameInstall','var') | isempty(dirnameInstall)
if ~exist('dirnameInstall','var') || isempty(dirnameInstall)
    if exist('./Install','dir')
        dirnameInstall = filesepStandard([pwd, '/Install']);
    else
        dirnameInstall = filesepStandard(pwd);
    end
end
if ~exist('dirnameApp','var') | isempty(dirnameApp)
if ~exist('dirnameApp','var') || isempty(dirnameApp)
    dirnameApp = getAppDir();
end
if ~exist('options','var')
@@ -21,7 +21,7 @@ end
if exist([dirnameInstall, installfilename],'dir')
    rmdir_safe([dirnameInstall, installfilename]);
end
for ii=1:length(platform.exename(1))
for ii = 1:length(platform.exename)
    if exist([dirnameInstall, platform.exename{ii}],'file')==2
        delete([dirnameInstall, platform.exename{ii}]);
    elseif exist([dirnameInstall, platform.exename{ii}],'dir')==7
@@ -49,8 +49,8 @@ if optionExists(options,'start')
    if exist([dirnameInstall, 'Buildme.log'],'file')
        delete([dirnameInstall, 'Buildme.log']);
    end
    if exist([dirnameApp, 'Buildme.log'],'file')
        delete([dirnameApp, 'Buildme.log']);
    if exist([dirnameApp, 'Buildme_Setup.log'],'file')
        delete([dirnameApp, 'Buildme_Setup.log']);
    end
end
if exist([dirnameInstall, 'mccExcludedFiles.log'],'file')
+19 −12
Original line number Diff line number Diff line
function createInstallFile(options)
global installfilename
global platform

platform = [];

% Start with a clean slate
cleanup('','','start');

installfilename = sprintf('%s_install', lower(getAppname()));
[~, exename] = getAppname();
@@ -11,7 +17,7 @@ if ~exist('options','var') || isempty(options)
end

% Find installation path and add it to matlab search paths
dirnameApp = getAppDir;
dirnameApp = getAppDir();
if isempty(dirnameApp)
    MessageBox('Cannot create installation package. Could not find root application folder.');
    deleteNamespace(exename)
@@ -26,9 +32,6 @@ end
addpath(dirnameInstall, '-end')
cd(dirnameInstall);

% Start with a clean slate
cleanup(dirnameInstall, dirnameApp, 'start');

% Set the executable names based on the platform type
platform = setplatformparams();

@@ -47,10 +50,14 @@ mkdir([dirnameInstall, installfilename, '/SubjDataSample']);
if ~strcmp(options, 'nobuild')
    Buildme_Setup();
    Buildme();
    if ~ispc()
        c = str2cell(version(),'.');
        mcrver = sprintf('v%s%s', c{1}, c{2});
        if islinux()
        perl('./makesetup.pl','./run_setup.sh','./setup.sh');
            perl('./makesetup.pl','./run_setup.sh','./setup.sh', mcrver);
        elseif ismac()
        perl('./makesetup.pl','./run_setup.sh','./setup.command');
            perl('./makesetup.pl','./run_setup.sh','./setup.command', mcrver);
        end
    end
end

Loading