mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
First cut at delivering swigged MATLAB files
This commit is contained in:
@@ -799,6 +799,50 @@ if (COOLPROP_SCILAB_SWIG_MODULE)
|
||||
|
||||
endif()
|
||||
|
||||
# Use an auto-generated SWIG interface file
|
||||
if (COOLPROP_MATLAB_SWIGAUTOGENERATED)
|
||||
find_package(Matlab REQUIRED)
|
||||
IF(MATLAB_FOUND)
|
||||
message(STATUS "MATLAB Found, MATLAB MEX will be compiled.")
|
||||
ELSE(MATLAB_FOUND)
|
||||
MESSAGE("MATLAB not found...nothing will be built.")
|
||||
ENDIF(MATLAB_FOUND)
|
||||
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
|
||||
list (APPEND APP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/wrappers/MATLAB/Matlabdef.def) # To export mexFunction
|
||||
list (APPEND APP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CoolPropMATLAB_wrap.cxx)
|
||||
add_library(CoolPropMATLAB_wrap SHARED ${MATLAB_LIBRARIES})
|
||||
target_link_libraries(CoolPropMATLAB_wrap ${MATLAB_LIBRARIES})
|
||||
|
||||
if(WIN32) # 32-bit or 64-bit mex
|
||||
# Force visual studio to statically link the c runtime to avoid dependency on MSVCRXXX.dll
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||
if (CMAKE_CL_64)
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexw64)
|
||||
else()
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES SUFFIX .mexw32)
|
||||
endif()
|
||||
add_custom_command(TARGET CoolPropMATLAB_wrap
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:CoolPropMATLAB_wrap> .
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
else()
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
if (${BITNESS} EQUAL "32")
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexmaci32 PREFIX "")
|
||||
elseif((${BITNESS} EQUAL "64"))
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexmaci64 PREFIX "")
|
||||
endif()
|
||||
else()
|
||||
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexa64 PREFIX "")
|
||||
else()
|
||||
SET_TARGET_PROPERTIES(CoolPropMATLAB_wrap PROPERTIES PREFIX "" SUFFIX .mexglx PREFIX "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
|
||||
# Must have SWIG
|
||||
@@ -821,7 +865,6 @@ if (COOLPROP_MATLAB_SWIG_MODULE)
|
||||
|
||||
SET(SWIG_MODULE_CoolPropMATLAB_wrap_EXTRA_DEPS ${SWIG_DEPENDENCIES} )
|
||||
|
||||
|
||||
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}")
|
||||
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
|
||||
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}")
|
||||
|
||||
Reference in New Issue
Block a user