From: vsr Date: Thu, 12 May 2022 10:43:01 +0000 (+0300) Subject: bos #29863 [CEA 29586] MEDCouplingBascisTest failing: SWIG 4 compatibility (temporary... X-Git-Tag: V9_9_0rc1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ff1972835c08ae3d9ba6830092dc65af1c114c0;p=tools%2Fmedcoupling.git bos #29863 [CEA 29586] MEDCouplingBascisTest failing: SWIG 4 compatibility (temporary solution) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 842dd4aee..8064b103d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,6 +211,14 @@ IF(MEDCOUPLING_ENABLE_PYTHON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") MESSAGE(STATUS "Using Python 3") ENDIF() + IF ("${SWIG_VERSION}" VERSION_GREATER_EQUAL "4") + SET(MEDCOUPLING_SWIG4_COMPAT TRUE CACHE BOOL "SWIG 4 compatibility (experimental)") + ELSE() + SET(MEDCOUPLING_SWIG4_COMPAT FALSE) + ENDIF() + IF(MEDCOUPLING_SWIG4_COMPAT) + LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT") + ENDIF() ENDIF(MEDCOUPLING_ENABLE_PYTHON) IF(MEDCOUPLING_BUILD_DOC) diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index cae752fff..7e363eaf3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -47,7 +47,11 @@ namespace INTERP_KERNEL catch (INTERP_KERNEL::Exception& _e) { // Reraise with SWIG_Python_Raise SWIG_Python_Raise(SWIG_NewPointerObj((new INTERP_KERNEL::Exception(static_cast< const INTERP_KERNEL::Exception& >(_e))),SWIGTYPE_p_INTERP_KERNEL__Exception,SWIG_POINTER_OWN), "INTERP_KERNEL::Exception", SWIGTYPE_p_INTERP_KERNEL__Exception); +#ifdef MEDCOUPLING_SWIG4_COMPAT + return nullptr; +#else SWIG_fail; +#endif } }