Skip to content

Commit

Permalink
[SCons] Add support for building MATLAB toolbox on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Jul 3, 2023
1 parent 6f2c665 commit 2cf33cf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/matlab/SConscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys
from os.path import join as pjoin
from buildutils import *
from pathlib import Path

Import('env', 'build', 'install')

Expand Down Expand Up @@ -33,12 +35,16 @@ elif localenv['OS'] == 'Darwin':
linklibs += ['mx', 'mex', 'mat'] + env['LIBM']
linkflags.extend(['-Wl,-exported_symbol,_mexFunction'])

if localenv['OS_BITS'] == 64:
matlab_libs = pjoin(localenv['matlab_path'], 'bin', 'maci64')
mexSuffix = '.mexmaci64'
matlab_path = Path(localenv["matlab_path"])
if (matlab_path / "bin" / "maca64").is_dir():
matlab_libs = (matlab_path / "bin" / "maca64").as_posix()
mexSuffix = ".mexmaca64"
elif (matlab_path / "bin" / "maci64").is_dir():
matlab_libs = (matlab_path / "bin" / "maci64").as_posix()
mexSuffix = ".mexmaci64"
else:
matlab_libs = pjoin(localenv['matlab_path'], 'bin', 'macx86')
mexSuffix = '.mexmaci'
logger.error("Couldn't determine target architecture for Matlab toolbox")
sys.exit(1)

elif os.name == 'posix':
linklibs = list(env['cantera_libs'])
Expand Down

0 comments on commit 2cf33cf

Please sign in to comment.