From 981f71c36f95ca12ebaf8532f4ba0f19f04042ba Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 18 Oct 2024 16:29:11 +0200 Subject: [PATCH] [EDF31196] : ooops --- src/MEDCoupling_Swig/CMakeLists.txt | 45 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 1e26d4dcd..cd8a4fefe 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -133,15 +133,15 @@ SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON) IF(WIN32) SET_PROPERTY(SOURCE MEDCouplingRemapper.i PROPERTY COMPILE_DEFINITIONS WIN32) ENDIF() -#IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") -# SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3") -#ELSE() -# SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow") -#ENDIF() -#SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") -#IF(MEDCOUPLING_USE_64BIT_IDS) -# STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") -#ENDIF(MEDCOUPLING_USE_64BIT_IDS) +IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") + SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3") +ELSE() + SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow") +ENDIF() +SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) # _ABR_ Ensure dependency mechanism on all SWIG files and headers SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} @@ -149,27 +149,26 @@ SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX}) -#IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") -# SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i) -#ELSE() -# SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i) -#ENDIF() +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i) +ELSE() + SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i) +ENDIF() -#IF(WIN32 OR CYGWIN) -# SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper) -#ELSE(WIN32 OR CYGWIN) -# # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 -# SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper) -#ENDIF(WIN32 OR CYGWIN) +IF(WIN32 OR CYGWIN) + SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper) +ELSE(WIN32 OR CYGWIN) + # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 + SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper) +ENDIF(WIN32 OR CYGWIN) IF(WIN32) SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d) SET_TARGET_PROPERTIES(_${MEDCouling_target_name} PROPERTIES DEBUG_OUTPUT_NAME _${MEDCouling_target_name}_d) ENDIF(WIN32) -INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) -#INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) +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}/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() -- 2.39.2