2023-09-27 13:24:14 +02:00
|
|
|
function mexpath = get_path_to_mex_files(dynareroot)
|
|
|
|
% Returns a cell array containing one or several directory paths
|
|
|
|
% which should contain the MEX files.
|
2017-05-16 15:10:20 +02:00
|
|
|
|
2023-03-17 16:31:26 +01:00
|
|
|
% Copyright © 2015-2023 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
|
|
|
|
2023-07-24 17:30:03 +02:00
|
|
|
build_dir = get_build_dir(dynareroot);
|
|
|
|
if ~isempty(build_dir)
|
|
|
|
% If a Meson build directory is found, use it preferably
|
|
|
|
mexpath = { build_dir };
|
|
|
|
elseif 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;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-09-27 13:24:14 +02:00
|
|
|
% Add generic Octave path (with higher priority than the previous ones)
|
2019-08-30 18:07:11 +02:00
|
|
|
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
|
|
|
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')
|
2023-11-22 13:24:52 +01:00
|
|
|
tmp = [dynareroot '../mex/matlab/win64-9.5-23.2/'];
|
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
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')
|
2023-11-22 13:24:52 +01:00
|
|
|
tmp = [dynareroot '../mex/matlab/maci64-9.5-23.2/'];
|
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
2015-03-30 14:54:14 +02:00
|
|
|
end
|
|
|
|
end
|
2023-04-25 23:51:42 +02:00
|
|
|
if strcmp(computer, 'MACA64')
|
2023-09-22 10:49:27 +02:00
|
|
|
tmp = [dynareroot '../mex/matlab/maca64-23.2/'];
|
2023-04-25 23:51:42 +02:00
|
|
|
if exist(tmp, 'dir')
|
|
|
|
mexpath = tmp;
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 14:54:14 +02:00
|
|
|
% 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
|
2019-05-21 17:27:45 +02:00
|
|
|
end
|