forked from fastalgorithms/chunkie
-
Notifications
You must be signed in to change notification settings - Fork 1
/
startup.m
70 lines (57 loc) · 1.43 KB
/
startup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function [] = startup(varargin)
opts = [];
if(nargin == 1)
opts = nargin;
end
ifflam = true;
if(isfield(opts,'ifflam'))
ifflam = opts.ifflam;
end
addpath('./chunkie')
if(ifflam)
if(exist('chunkie/FLAM/startup.m'))
run 'chunkie/FLAM/startup.m';
end
end
iffmm0 = true;
if(isfield(opts,'iffmm'))
iffmm0 = opts.iffmm;
end
iffmm = true;
if(iffmm0)
if ismac || isunix
[status,cmdout] = system('which gfortran');
if(~status)
fprintf('fortran compiler found at: %s\n',cmdout);
iffmm = true;
path1 = getenv('PATH');
cmdout2 = extractBefore(cmdout, 'gfortran');
path1 = [path1 cmdout2];
setenv('PATH', path1);
if ismac
!cp -f chunkie/fmm2d/make.inc.macos.gnu.x86-64 chunkie/fmm2d/make.inc;
end
else
fprintf('Fortran compiler not found\n');
iffmm = false;
end
else
fprintf('Fortran installations not supported through startup.m\n');
fprintf('Follow manual installation instructions on github\n');
iffmm = false;
end
end
if(iffmm)
if(exist('chunkie/fmm2d/matlab','dir'))
cd './chunkie/fmm2d';
!make clean;
!make matlab;
addpath './matlab';
cd matlab;
runtests;
cd ../../../;
else
fprintf('Fmm installation not in standard location\n');
fprintf('Manual installation required');
end
end