-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_slicot.m
82 lines (82 loc) · 2.97 KB
/
build_slicot.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
71
72
73
74
75
76
77
78
79
80
81
82
%=============================================================================
% Copyright (c) 2016-2019 Allan CORNET (Nelson)
%=============================================================================
% LICENCE_BLOCK_BEGIN
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http:%www.gnu.org/licenses/>.
% LICENCE_BLOCK_END
%=============================================================================
configure_compiler = false;
if ispc()
configure_compiler = true;
configuremsvc();
end
%=============================================================================
this_path = nfilename('fullpathext');
this_path = fileparts(this_path, 'path');
%=============================================================================
fortran_files = dir([this_path, '/fortran/*.f']);
destination_c = [this_path, '/c'];
if ~isdir(destination_c)
mkdir(destination_c);
end
%=============================================================================
for k = 1:length(fortran_files)
src = [this_path, '/fortran/', fortran_files(k).name];
f2c(src, destination_c);
end
%=============================================================================
destinationdir = [this_path, '/bin/'];
if ~isdir(destinationdir)
mkdir(destinationdir);
end
%=============================================================================
c_files_info = dir([this_path, '/c/*.c']);
c_files = {};
for k = 1:length(c_files_info)
c_files = [c_files; [this_path, '/c/', c_files_info(k).name]];
end
currentpath = fileparts(nfilename('fullpathext'));
%=============================================================================
if ispc()
external_libs = {[modulepath('elementary_functions','bin'), '/libnlsblaslapack']; ...
[modulepath('f2c','bin'), '/libnlsF2C']};
else
external_libs = {[modulepath('f2c','bin'), '/libnlsF2C']; ...
'blas'; 'lapack'};
end
[status, message] = dlgeneratemake(destinationdir, ...
'libslicot', ...
c_files, ...
[modulepath('f2c'), '/src/include'], [], ...
external_libs);
if ~status
error(message);
end
%=============================================================================
[status, message] = dlmake(destinationdir);
if configure_compiler
removecompilerconf();
end
if ~status
error(message);
exit(1);
else
try
copyfile([destinationdir, 'libslicot', getdynlibext()], [modulepath('core','bin'), '/libslicot', getdynlibext()]);
catch
exit(1);
end
exit();
end
%=============================================================================