macOS: provisions to detect Apple Silicon architecture (maca64 and mexmaca64)

Works with MATLAB R2022b beta (ARM)
mr#2134
Willi Mutschler 2023-04-25 23:51:42 +02:00 committed by Sébastien Villemot
parent 5d335501d7
commit b8352b251d
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
5 changed files with 18 additions and 6 deletions

View File

@ -45,8 +45,8 @@ determine the type of your MATLAB/Octave installation, type:
```matlab
>> computer
```
at the MATLAB/Octave prompt. Under MATLAB, if it returns `PCWIN64`, `GLNX64` or
`MACI64`, then it is a 64-bit MATLAB; if it returns `PCWIN`, `MACI` or `GLNX`,
at the MATLAB/Octave prompt. Under MATLAB, if it returns `PCWIN64`, `GLNX64`,
`MACI64` or `MACA64` then it is a 64-bit MATLAB; if it returns `PCWIN`, `MACI` or `GLNX`,
then it is a 32-bit MATLAB. Under Octave, if it returns a string that begins
with `x86_64`, it is a 64-bit Octave; if the strings begins with `i686`, it is
a 32-bit Octave.

View File

@ -315,7 +315,7 @@ by the ``dynare`` command.
Prevent Dynare from printing the output of the steps leading up to the
preprocessor as well as the preprocessor output itself.
.. option:: mexext=mex|mexw32|mexw64|mexmaci64|mexa64
.. option:: mexext=mex|mexw32|mexw64|mexmaci64|mexmaca64|mexa64
The mex extension associated with your platform to be used
when compiling output associated with :opt:`use_dll`.

View File

@ -1,7 +1,7 @@
dnl matlabarch.m4 --- check for MATLAB machine architecture.
dnl
dnl Copyright © 2002, 2003 Ralph Schleicher
dnl Copyright © 2009 Dynare Team
dnl Copyright © 2009-2023 Dynare Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
@ -57,6 +57,9 @@ else
*mexmaci64)
ax_cv_matlab_arch=maci64
;;
*mexmaca64)
ax_cv_matlab_arch=maca64
;;
*)
ax_cv_matlab_arch=unknown
;;

View File

@ -68,7 +68,7 @@ case ${MATLAB_ARCH} in
FORTRAN_LIBS_FOR_CXXLINK="-Wl,-Bstatic -lgfortran -Wl,-Bdynamic" # libquadmath is already in MATLAB_LDFLAGS_NOMAP
ax_mexopts_ok="yes"
;;
maci64)
mac[[ai]]64)
MATLAB_DEFS="-DNDEBUG"
MATLAB_CFLAGS="-fno-common -fexceptions"
MATLAB_CXXFLAGS="-fno-common -fexceptions"
@ -78,7 +78,7 @@ case ${MATLAB_ARCH} in
# This -L flag is put here, hence later on the linker command line, so as
# to avoid linking against the HDF5 shipped by MATLAB (which would
# otherwise override the HDF5 from Homebrew)
MATLAB_LIBS="-L$MATLAB/bin/maci64 -lmx -lmex -lmat -lmwlapack -lmwblas"
MATLAB_LIBS="-L$MATLAB/bin/${MATLAB_ARCH} -lmx -lmex -lmat -lmwlapack -lmwblas"
FORTRAN_LIBS_FOR_CXXLINK="-lgfortran -lquadmath"
ax_mexopts_ok="yes"
;;

View File

@ -89,6 +89,15 @@ else
end
end
end
if strcmp(computer, 'MACA64')
tmp = [dynareroot '../mex/matlab/maca64-9.14/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
addpath(mexpath);
end
end
end
% Add generic MATLAB path (with higher priority than the previous ones)
if exist('mexpath')
mexpath = { mexpath; [dynareroot '../mex/matlab/'] };