From a3a68ebd6b718b5c13d15923fb27aea3a2efbfa6 Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 10 Oct 2018 22:57:50 +0300 Subject: [PATCH] Windows support --- src/MEDCoupling_Swig/CMakeLists.txt | 10 +++++++++- src/MEDCoupling_Swig/MEDCoupling.i | 4 ++++ src/PyWrapping/CMakeLists.txt | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 9a33c346c..3dc442075 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -90,6 +90,8 @@ ENDIF() IF(WIN32) # Under Windows MEDCoupling conflicts wiht medcoupling from PyWrapping SET(MEDCouling_target_name MEDCouplingCompat) + SET_PROPERTY(SOURCE MEDCoupling.i PROPERTY SWIG_MODULE_NAME MEDCouplingCompat) + SET_PROPERTY(SOURCE MEDCoupling.i PROPERTY COMPILE_DEFINITIONS WIN32) ELSE() SET(MEDCouling_target_name MEDCoupling) ENDIF() @@ -130,7 +132,13 @@ IF(WIN32) ENDIF(WIN32) INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) -SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py) +SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py) +IF(WIN32) + SET(PYFILES_TO_INSTALL ${PYFILES_TO_INSTALL} ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingCompat.py) +ELSE() + SET(PYFILES_TO_INSTALL ${PYFILES_TO_INSTALL} ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py) +ENDIF() + SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME};${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME}") INSTALL(FILES ${MC_Swig_interf} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 6f84bb74c..7bb789e37 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -17,7 +17,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#ifdef WIN32 +%module MEDCouplingCompat +#else %module MEDCoupling +#endif %include "MEDCouplingCommon.i" diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index 1d05b34d0..1ec4528c0 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -92,6 +92,8 @@ SWIG_LINK_LIBRARIES(medcoupling ${medcoupling_LIB_dependancies}) SWIG_CHECK_GENERATION(medcoupling) IF(WIN32) SET_TARGET_PROPERTIES(_medcoupling PROPERTIES DEBUG_OUTPUT_NAME _medcoupling_d) + # To increase the size of the .obj file on Windows because MEDLoaderPYTHON_wrap.cxx, generated by SWIG, is too big + TARGET_COMPILE_OPTIONS(_medcoupling PRIVATE /bigobj) ENDIF(WIN32) INSTALL(TARGETS _medcoupling DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) -- 2.39.2