SET_SOURCE_FILES_PROPERTIES(MEDCalculator.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(MEDCalculator.i PROPERTIES SWIG_FLAGS "-py3")
SET(SWIG_MODULE_MEDCalculator_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
-SWIG_ADD_MODULE(MEDCalculator python MEDCalculator.i)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(MEDCalculator python MEDCalculator.i)
+ELSE()
+ SWIG_ADD_LIBRARY(MEDCalculator LANGUAGE python SOURCES MEDCalculator.i)
+ENDIF()
+
SWIG_LINK_LIBRARIES(MEDCalculator ${PYTHON_LIBRARIES} medcalculator)
IF(WIN32)
SET_TARGET_PROPERTIES(_MEDCalculator PROPERTIES DEBUG_OUTPUT_NAME _MEDCalculator_d)
+ # To increase the size of the .obj file on Windows because MEDLoaderPYTHON_wrap.cxx, generated by SWIG, is too big
+ TARGET_COMPILE_OPTIONS(_MEDCalculator PRIVATE /bigobj)
ENDIF(WIN32)
FILE(GLOB medcalculatorspython_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
-SWIG_ADD_MODULE(MEDCouplingCorba python MEDCouplingCorba.i)
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(MEDCouplingCorba python MEDCouplingCorba.i)
+ELSE()
+ SWIG_ADD_LIBRARY(MEDCouplingCorba LANGUAGE python SOURCES MEDCouplingCorba.i)
+ENDIF()
+
SWIG_LINK_LIBRARIES(MEDCouplingCorba ${PYTHON_LIBRARIES} medcouplingcorba ${PLATFORM_LIBS})
IF(WIN32)
SET_TARGET_PROPERTIES(_MEDCouplingCorba PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingCorba_d)
${CMAKE_CURRENT_SOURCE_DIR}/../../MEDCouplingCorba/Client
)
-SWIG_ADD_MODULE(MEDCouplingClient python MEDCouplingClient.i)
+
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(MEDCouplingClient python MEDCouplingClient.i)
+ELSE()
+ SWIG_ADD_LIBRARY(MEDCouplingClient LANGUAGE python SOURCES MEDCouplingClient.i)
+ENDIF()
+
SWIG_LINK_LIBRARIES(MEDCouplingClient ${PYTHON_LIBRARIES} medcouplingclient)
IF(WIN32)
SET_TARGET_PROPERTIES(_MEDCouplingClient PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingClient_d)