From ffaa92df9a2ed2cc35ea729a506e16f90e5c1904 Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Mon, 27 Nov 2023 20:06:10 -0500 Subject: [PATCH] Use SHARED_LIB_SUFFIX when on windows only --- libmexclass/cpp/CMakeLists.txt | 44 ++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/libmexclass/cpp/CMakeLists.txt b/libmexclass/cpp/CMakeLists.txt index 3631940..883d1d9 100644 --- a/libmexclass/cpp/CMakeLists.txt +++ b/libmexclass/cpp/CMakeLists.txt @@ -109,26 +109,40 @@ macro(MatlabConfigureVariables) 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") + set(SHARED_LIB_SUFFIX "${CMAKE_LINK_LIBRARY_SUFFIX}") + else + set(SHARED_LIB_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(APPLE) + set(PLATFORM_FOLDER "maci64") + elseif(UNIX And NOT CYGWIN) + set(PLATFORM_FOLDER "maci64") + else() + message(FATAL_ERROR "Unsupported platform") + endif() + set(MATLAB_BIN_DIR "${Matlab_ROOT_DIR}/bin/${PLATFORM_FOLDER}") + set(MATLAB_EXTERN_BIN_DIR "${Matlab_ROOT_DIR}/extern/bin/${PLATFORM_FOLDER}") + set(MATLAB_EXTERN_LIB_DIR "${Matlab_ROOT_DIR}/extern/lib/${PLATFORM_FOLDER}") endif() + # if(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_LINK_LIBRARY_SUFFIX}") - set(Matlab_DATAARRAY_LIBRARY "${MATLAB_BIN_DIR}/libMatlabDataArray${CMAKE_LINK_LIBRARY_SUFFIX}") - set(Matlab_MEX_LIBRARY "${MATLAB_BIN_DIR}/libmex${CMAKE_LINK_LIBRARY_SUFFIX}") - set(Matlab_MX_LIBRARY "${MATLAB_BIN_DIR}/libmx${CMAKE_LINK_LIBRARY_SUFFIX}") - + set(Matlab_ENGINE_LIBRARY "${MATLAB_EXTERN_BIN_DIR}/libMatlabEngine${SHARED_LIB_SUFFIX}") + set(Matlab_DATAARRAY_LIBRARY "${MATLAB_BIN_DIR}/libMatlabDataArray${SHARED_LIB_SUFFIX}") + set(Matlab_MEX_LIBRARY "${MATLAB_BIN_DIR}/libmex${SHARED_LIB_SUFFIX}") + set(Matlab_MX_LIBRARY "${MATLAB_BIN_DIR}/libmx${SHARED_LIB_SUFFIX}") set(Matlab_EXTERN_LIBRARY_DIR "${MATLAB_EXTERN_LIB_DIR}") endmacro()