-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup_code.m
executable file
·48 lines (36 loc) · 1.21 KB
/
setup_code.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
function setup_code(varargin)
% Get repository path
repo_path = which('setup_code.m');
repo_path = fileparts(repo_path);
% remove any auxiliary folder from the search path
restoredefaultpath();
% remove the default user-specific path
userpath('clear');
% Add sub-directories to path
addpath(genpath(repo_path));
% Add libraries to path
libraries_path = strcat(repo_path, '/ds-libraries/');
addpath(genpath(libraries_path));
% Check if compilation is necessary
compile_thirdparty = 1;
if nargin == 1
compile_thirdparty = varargin{1};
end
if compile_thirdparty
% NOT WORKING FOR WINDOWS PC (MEX with a compiler needs to be configured = install compiler)
% Install lightspeed for Chapter 3 and 5 (PC-GMM Fitting)
lightspeed_path = strcat(repo_path, '/ds-libraries/thirdparty/lightspeed');
cd(lightspeed_path)
pause(1);
% If error here run "install_lightspeed", mex compiler has to be setup "mex -setup"
install_lightspeed
test_lightspeed
% Go back to ch3 directory
repo_path = which('setup_code.m');
repo_path = fileparts(repo_path);
cd(repo_path)
end
% If error here run "install_sedumi -build"
install_sedumi
display('--> Code and toolboxes installed correctly.');
end