Skip to content

Commit

Permalink
Add MatlabConfigureVariables macro
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Nov 28, 2023
1 parent 0c046b4 commit 1d6120a
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions libmexclass/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ macro(MatlabPrintVariables)
message(STATUS "Matlab_HAS_CPP_API = ${Matlab_HAS_CPP_API}")
message(STATUS "Matlab_MEX_EXTENSION = ${Matlab_MEX_EXTENSION}")
message(STATUS "Matlab_INCLUDE_DIRS = ${Matlab_INCLUDE_DIRS}")
message(STATUS "Matlab_BINARIES_DIR = ${Matlab_BINARIES_DIR}")
#message(STATUS "Matlab_BINARIES_DIR = ${Matlab_BINARIES_DIR}")
message(STATUS "Matlab_EXTERN_LIBRARY_DIR = ${Matlab_EXTERN_LIBRARY_DIR}")
message(STATUS "Matlab_EXTERN_BINARIES_DIR = ${Matlab_EXTERN_BINARIES_DIR}")
# message(STATUS "Matlab_EXTERN_BINARIES_DIR = ${Matlab_EXTERN_BINARIES_DIR}")
endmacro()

macro(MatlabSetWindowsVariables)
Expand Down Expand Up @@ -105,19 +105,31 @@ macro(MatlabSetUnixVariables)
endmacro()

macro(MatlabConfigureVariables)
set(Matlab_VERSION_STRING "${MATLAB_RELEASE_VERSION}")
set(Matlab_INCLUDE_DIRS "${Matlab_ROOT_DIR}/extern/include")
if(WIN32)
set(MATLAB_BIN_DIR "${Matlab_ROOT_DIR}/extern/lib/win64/microsoft")
set(MATLAB_EXTERN_BIN_DIR "${Matlab_ROOT_DIR}/extern/lib/win64/microsoft")
set(MATLAB_EXTERN_LIB_DIR "${Matlab_ROOT_DIR}/extern/lib/win64")
elseif(APPLE)
set(MATLAB_BIN_DIR "${Matlab_ROOT_DIR}/bin/maci64")
set(MATLAB_EXTERN_BIN_DIR "${Matlab_ROOT_DIR}/extern/bin/maci64")
set(MATLAB_EXTERN_LIB_DIR "${Matlab_ROOT_DIR}/extern/lib/maci64")
elseif(UNIX AND NOT CYGWIN)
set(MATLAB_BIN_DIR "${Matlab_ROOT_DIR}/bin/glnxa64")
set(MATLAB_EXTERN_BIN_DIR "${Matlab_ROOT_DIR}/extern/bin/glnxa64")
set(MATLAB_EXTERN_LIB_DIR "${Matlab_ROOT_DIR}/extern/lib/glnxa64")
else()
message(FATAL_ERROR "Unsupported platform")
endif()

set(Matlab_HAS_CPP_API 1)
set(Matlab_VERSION_STRING "${MATLAB_RELEASE_VERSION}")
set(Matlab_INCLUDE_DIRS "${Matlab_ROOT_DIR}/extern/include")
set(Matlab_ENGINE_LIBRARY "${MATLAB_EXTERN_BIN_DIR}/libMatlabEngine${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_DATAARRAY_LIBRARY "${MATLAB_BIN_DIR}/libMatlabDataArray${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_MEX_LIBRARY "${MATLAB_BIN_DIR}/libmex${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_MX_LIBRARY "${MATLAB_BIN_DIR}/libmx${CMAKE_SHARED_LIBRARY_SUFFIX}")

set(Matlab_ENGINE_LIBRARY "${Matlab_ROOT_DIR}/extern/bin/glnxa64/libMatlabEngine${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_DATAARRAY_LIBRARY "${Matlab_ROOT_DIR}/bin/glnxa64/libMatlabDataArray${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_MEX_LIBRARY "${Matlab_ROOT_DIR}/bin/glnxa64/libmex${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(Matlab_MX_LIBRARY "${Matlab_ROOT_DIR}/bin/glnxa64/libmx${CMAKE_SHARED_LIBRARY_SUFFIX}")

set(Matlab_EXTERN_LIBRARY_DIR "${Matlab_ROOT_DIR}/extern/lib/glnxa64")
set(Matlab_BINARIES_DIR "${Matlab_ROOT_DIR}/bin/glnxa64")
set(Matlab_EXTERN_BINARIES_DIR "${Matlab_ROOT_DIR}/extern/bin/glnxa64")
set(Matlab_EXTERN_LIBRARY_DIR "${MATLAB_EXTERN_LIB_DIR")
endmacro()

macro(MatlabUnsetVariables)
Expand Down Expand Up @@ -154,17 +166,17 @@ macro(MatlabConfigure)
string(REGEX MATCH "([0-9]+[.])+[0-9]+" LONG_VERSION_STRING ${VERSION_XML_NODE})
string(REGEX MATCH "^[0-9]+[.][0-9]+" MATLAB_RELEASE_VERSION ${LONG_VERSION_STRING})
message(STATUS "MATLAB_RELEASE_VERSION = ${MATLAB_RELEASE_VERSION}")

if (WIN32)
MatlabSetWindowsVariables()
elseif(APPLE)
MatlabSetAppleVariables()
elseif(UNIX AND NOT CYGWIN)
MatlabSetUnixVariables()
else()
message(FATAL_ERROR "MatlabConfigure failed")
endif()
endif()
MatlabConfigureVariables()
# if (WIN32)
# MatlabSetWindowsVariables()
# elseif(APPLE)
# MatlabSetAppleVariables()
# elseif(UNIX AND NOT CYGWIN)
# MatlabSetUnixVariables()
# else()
# message(FATAL_ERROR "MatlabConfigure failed")
# endif()
# endif()
endmacro()

# Find MATLAB.
Expand Down

0 comments on commit 1d6120a

Please sign in to comment.