From: ageay Date: Tue, 26 Nov 2013 10:44:09 +0000 (+0000) Subject: Split Numpy and Scipy detection X-Git-Tag: V7_3_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43ac3848e229194b2fb7d739a48bd30c386261ef;p=modules%2Fmed.git Split Numpy and Scipy detection --- diff --git a/src/MEDCalculator/Swig/CMakeLists.txt b/src/MEDCalculator/Swig/CMakeLists.txt index db42f32c1..b10981ba3 100644 --- a/src/MEDCalculator/Swig/CMakeLists.txt +++ b/src/MEDCalculator/Swig/CMakeLists.txt @@ -48,9 +48,7 @@ INSTALL(TARGETS medcalculatorspython DESTINATION ${SALOME_INSTALL_LIBS}) SET_SOURCE_FILES_PROPERTIES(MEDCalculator.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDCalculator.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDCalculator_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDCalculator_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) SWIG_ADD_MODULE(MEDCalculator python MEDCalculator.i) SWIG_LINK_LIBRARIES(MEDCalculator ${PYTHON_LIBRARIES} medcalculator) diff --git a/src/MEDCouplingCorba_Swig/CMakeLists.txt b/src/MEDCouplingCorba_Swig/CMakeLists.txt index bd523c13d..35eb37f18 100644 --- a/src/MEDCouplingCorba_Swig/CMakeLists.txt +++ b/src/MEDCouplingCorba_Swig/CMakeLists.txt @@ -27,9 +27,7 @@ INCLUDE(${SWIG_USE_FILE}) SET_SOURCE_FILES_PROPERTIES(MEDCouplingCorba.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDCouplingCorba.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDCouplingCorba_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDCouplingCorba_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) SET(MEDCouplingCorba_SWIG_DPYS_FILES MEDCouplingCorbaTypemaps.i) diff --git a/src/MEDCouplingCorba_Swig/Client/CMakeLists.txt b/src/MEDCouplingCorba_Swig/Client/CMakeLists.txt index 03a46a352..dfde63bfb 100644 --- a/src/MEDCouplingCorba_Swig/Client/CMakeLists.txt +++ b/src/MEDCouplingCorba_Swig/Client/CMakeLists.txt @@ -25,9 +25,7 @@ INCLUDE(${SWIG_USE_FILE}) SET_SOURCE_FILES_PROPERTIES(MEDCouplingClient.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDCouplingClient.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDCouplingClient_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDCouplingClient_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index e6454ece2..d136337d2 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -23,9 +23,7 @@ ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) SET (MEDCoupling_SWIG_DPYS_FILES MEDCouplingCommon.i @@ -57,9 +55,7 @@ SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcoupling SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) # _ABR_ Ensure dependency mechanism on all SWIG files and headers SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index 71394bd1d..4bdb8a68c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -129,6 +129,15 @@ namespace ParaMEDMEM #endif } + bool MEDCouplingHasSciPyBindings() + { +#ifdef WITH_SCIPY + return true; +#else + return false; +#endif + } + std::string MEDCouplingCompletionScript() throw(INTERP_KERNEL::Exception) { static const char script[]="import rlcompleter,readline\nreadline.parse_and_bind('tab:complete')"; diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py index 3b9dc6b52..9c463ca08 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py @@ -587,7 +587,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(0.3521445110626687 ,m[6][170],12) pass - @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") + @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy") def testGetCrudeCSRMatrix1(self): """ testing CSR matrix output using numpy/scipy. """ @@ -644,7 +644,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(m_1.getnnz(),7) pass - @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") + @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy") def testP0P1Bary_1(self): a=MEDCouplingUMesh("a",2) a.allocateCells() diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index 513cd99f1..c011c3ce4 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -25,9 +25,7 @@ ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) SET (MEDLoader_SWIG_DPYS_FILES MEDLoaderCommon.i diff --git a/src/ParaMEDMEM_Swig/CMakeLists.txt b/src/ParaMEDMEM_Swig/CMakeLists.txt index 57a82a540..a99127181 100644 --- a/src/ParaMEDMEM_Swig/CMakeLists.txt +++ b/src/ParaMEDMEM_Swig/CMakeLists.txt @@ -24,9 +24,7 @@ INCLUDE(${SWIG_USE_FILE}) SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY}) SET (ParaMEDMEM_SWIG_DPYS_FILES ParaMEDMEM.typemap) @@ -57,9 +55,6 @@ SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem medloader) SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(ParaMEDMEM.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_ParaMEDMEM_EXTRA_FLAGS -DWITH_NUMPY) -ENDIF(NUMPY_FOUND) INSTALL(TARGETS _ParaMEDMEM DESTINATION ${SALOME_INSTALL_PYTHON}) INSTALL(FILES ParaMEDMEM.i DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index a879a874c..128e365f5 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -23,11 +23,7 @@ ADD_DEFINITIONS(${PYTHON_DEFINITIONS}) SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow") -IF(NUMPY_FOUND) - SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS -DWITH_NUMPY -DWITHOUT_AUTOFIELD) -ELSE(NUMPY_FOUND) - SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS -DWITHOUT_AUTOFIELD) -ENDIF(NUMPY_FOUND) +SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY};-DWITHOUT_AUTOFIELD") IF(Boost_FOUND) SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS -DHAS_BOOST ${SWIG_MODULE_MEDRenumber_EXTRA_FLAGS})