2015-03-30 14:54:14 +02:00
|
|
|
function mexpath = add_path_to_mex_files(dynareroot, modifypath)
|
2017-05-16 15:10:20 +02:00
|
|
|
|
2021-03-17 17:47:27 +01:00
|
|
|
% Copyright (C) 2015-2021 Dynare Team
|
2015-03-30 14:54:14 +02:00
|
|
|
%
|
|
|
|
% This file is part of Dynare.
|
|
|
|
%
|
|
|
|
% Dynare 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 3 of the License, or
|
|
|
|
% (at your option) any later version.
|
|
|
|
%
|
|
|
|
% Dynare 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
|
2021-06-09 17:33:48 +02:00
|
|
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
2015-03-30 14:54:14 +02:00
|
|
|
|
|
|
|
if nargin<2
|
|
|
|
modifypath = true;
|
|
|
|
end
|
2017-05-16 15:10:20 +02:00
|
|
|
|
2018-09-06 17:12:15 +02:00
|
|
|
if isoctave
|
2019-08-30 18:07:11 +02:00
|
|
|
% Add specific paths for Dynare Windows package
|
|
|
|
if ispc
|
|
|
|
if strcmpi(computer(), 'i686-w64-mingw32')
|
2020-07-17 11:44:20 +02:00
|
|
|
warning('MEX files not available for 32-bit Octave')
|
2019-08-30 18:07:11 +02:00
|
|
|
else
|
|
|
|
tmp = [dynareroot '../mex/octave/win64/'];
|
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
if modifypath
|
|
|
|
addpath(mexpath);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
% Add generic MATLAB path (with higher priority than the previous ones)
|
|
|
|
if exist('mexpath')
|
|
|
|
mexpath = { mexpath; [dynareroot '../mex/octave/'] };
|
2017-04-26 15:08:34 +02:00
|
|
|
else
|
2019-08-30 18:07:11 +02:00
|
|
|
mexpath = { [dynareroot '../mex/octave/'] };
|
2017-04-26 15:08:34 +02:00
|
|
|
end
|
2015-03-30 14:54:14 +02:00
|
|
|
if modifypath
|
2019-08-30 18:07:11 +02:00
|
|
|
addpath([dynareroot '../mex/octave/']);
|
2015-03-30 14:54:14 +02:00
|
|
|
end
|
|
|
|
else
|
|
|
|
if strcmp(computer, 'PCWIN')
|
2020-07-17 11:44:20 +02:00
|
|
|
warning('MEX files not available for 32-bit MATLAB')
|
2015-03-30 14:54:14 +02:00
|
|
|
end
|
|
|
|
% Add win64 specific paths for Dynare Windows package
|
|
|
|
if strcmp(computer, 'PCWIN64')
|
2018-11-13 15:59:16 +01:00
|
|
|
if matlab_ver_less_than('9.4')
|
2020-04-07 12:24:16 +02:00
|
|
|
tmp = [dynareroot '../mex/matlab/win64-8.3-9.3/'];
|
2015-03-30 14:54:14 +02:00
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
if modifypath
|
|
|
|
addpath(mexpath);
|
|
|
|
end
|
|
|
|
end
|
2018-05-14 14:35:12 +02:00
|
|
|
else
|
2021-03-17 17:47:27 +01:00
|
|
|
tmp = [dynareroot '../mex/matlab/win64-9.4-9.10/'];
|
2018-05-14 14:35:12 +02:00
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
if modifypath
|
|
|
|
addpath(mexpath);
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 14:54:14 +02:00
|
|
|
end
|
|
|
|
end
|
2019-09-16 17:57:13 +02:00
|
|
|
% Add macOS paths for Dynare Mac package
|
2015-03-30 14:54:14 +02:00
|
|
|
if strcmp(computer, 'MACI64')
|
2019-09-16 17:31:46 +02:00
|
|
|
if matlab_ver_less_than('9.4')
|
2020-04-07 12:24:16 +02:00
|
|
|
tmp = [dynareroot '../mex/matlab/maci64-8.3-9.3/'];
|
2019-09-16 17:31:46 +02:00
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
if modifypath
|
|
|
|
addpath(mexpath);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
2021-03-17 17:47:27 +01:00
|
|
|
tmp = [dynareroot '../mex/matlab/maci64-9.4-9.10'];
|
2019-09-16 17:31:46 +02:00
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
if modifypath
|
|
|
|
addpath(mexpath);
|
|
|
|
end
|
2015-03-30 14:54:14 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
% Add generic MATLAB path (with higher priority than the previous ones)
|
|
|
|
if exist('mexpath')
|
2016-06-17 21:59:29 +02:00
|
|
|
mexpath = { mexpath; [dynareroot '../mex/matlab/'] };
|
2015-03-30 14:54:14 +02:00
|
|
|
else
|
|
|
|
mexpath = { [dynareroot '../mex/matlab/'] };
|
|
|
|
end
|
|
|
|
if modifypath
|
|
|
|
addpath([dynareroot '../mex/matlab/']);
|
|
|
|
end
|
2019-05-21 17:27:45 +02:00
|
|
|
end
|