support Apple silicon

release/4.3a0
Varun Agrawal 2023-06-05 13:29:21 -04:00
parent 3a1d23b5bb
commit b1bce79e95
1 changed files with 18 additions and 3 deletions

View File

@ -105,7 +105,12 @@ function(wrap_library_internal interfaceHeader moduleName linkLibraries extraInc
set(mexModuleExt mexglx)
endif()
elseif(APPLE)
check_cxx_compiler_flag("-arch arm64" arm64Supported)
if (arm64Supported)
set(mexModuleExt mexmaca64)
else()
set(mexModuleExt mexmaci64)
endif()
elseif(MSVC)
if(CMAKE_CL_64)
set(mexModuleExt mexw64)
@ -299,7 +304,12 @@ function(wrap_library_internal interfaceHeader moduleName linkLibraries extraInc
APPEND
PROPERTY COMPILE_FLAGS "/bigobj")
elseif(APPLE)
check_cxx_compiler_flag("-arch arm64" arm64Supported)
if (arm64Supported)
set(mxLibPath "${MATLAB_ROOT}/bin/maca64")
else()
set(mxLibPath "${MATLAB_ROOT}/bin/maci64")
endif()
target_link_libraries(
${moduleName}_matlab_wrapper "${mxLibPath}/libmex.dylib"
"${mxLibPath}/libmx.dylib" "${mxLibPath}/libmat.dylib")
@ -367,7 +377,12 @@ function(check_conflicting_libraries_internal libraries)
if(UNIX)
# Set path for matlab's built-in libraries
if(APPLE)
check_cxx_compiler_flag("-arch arm64" arm64Supported)
if (arm64Supported)
set(mxLibPath "${MATLAB_ROOT}/bin/maca64")
else()
set(mxLibPath "${MATLAB_ROOT}/bin/maci64")
endif()
else()
if(CMAKE_CL_64)
set(mxLibPath "${MATLAB_ROOT}/bin/glnxa64")