-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup_mcnExtraLayers.m
43 lines (39 loc) · 1.35 KB
/
setup_mcnExtraLayers.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
function setup_mcnExtraLayers
%SETUP_MCNEXTRALAYERS Sets up mcnExtraLayers by adding its folders to the path
% add dependencies
check_dependency('autonn') ;
root = fileparts(mfilename('fullpath')) ;
addpath(root, [root '/matlab'], [root '/matlab/wrappers'], [root '/utils']) ;
% -----------------------------------
function check_dependency(moduleName)
% -----------------------------------
name2path = @(name) strrep(name, '-', '_') ;
setupFunc = ['setup_', name2path(moduleName)] ;
if exist(setupFunc, 'file')
vl_contrib('setup', moduleName) ;
else
% try adding the module to the path
addpath(fullfile(vl_rootnn, 'contrib', moduleName)) ;
if exist(setupFunc, 'file')
vl_contrib('setup', moduleName) ;
else
waiting = true ;
msg = ['module %s was not found on the MATLAB path. Would you like ' ...
'to install it now? (y/n)\n'] ;
prompt = sprintf(msg, moduleName) ;
while waiting
str = input(prompt,'s') ;
switch str
case 'y'
vl_contrib('install', moduleName) ;
vl_contrib('compile', moduleName) ;
vl_contrib('setup', moduleName) ;
return ;
case 'n'
throw(exception) ;
otherwise
fprintf('input %s not recognised, please use `y` or `n`\n', str) ;
end
end
end
end