]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix compilation with NumPy/SciPy.
authorrnv <rnv@opencascade.com>
Mon, 15 Feb 2016 15:12:28 +0000 (18:12 +0300)
committerrnv <rnv@opencascade.com>
Mon, 15 Feb 2016 16:03:52 +0000 (19:03 +0300)
CMakeLists.txt
salome_adm/cmake_files/CMakeLists.txt
salome_adm/cmake_files/FindSalomeNumPySciPy.cmake [new file with mode: 0644]
salome_adm/cmake_files/FindSalomePythonInterp.cmake

index f4a16cc78c12018a1c3b5d243ee175cb74d7c498..f19ccd81159ac4f5dc52beb6f568035baef956f0 100755 (executable)
@@ -81,6 +81,7 @@ ENDIF()
 
 FIND_PACKAGE(SalomePythonInterp REQUIRED)
 FIND_PACKAGE(SalomePythonLibs REQUIRED)
+FIND_PACKAGE(SalomeNumPySciPy)
 FIND_PACKAGE(SalomePThread REQUIRED)
 FIND_PACKAGE(SalomeSWIG REQUIRED)
 FIND_PACKAGE(SalomeLibXml2 REQUIRED)
index f29187feae91f10ea6c3a9f0849fe723d3f7a4fd..009db3a8f4547da2f541111481697b1af6caa3e9 100755 (executable)
@@ -48,6 +48,7 @@ SET(DATA
 #  FindSalomePython.cmake
   FindSalomePythonLibs.cmake
   FindSalomePythonInterp.cmake
+  FindSalomeNumPySciPy.cmake
   FindSalomeSphinx.cmake
   FindSalomeSWIG.cmake
   FindSphinx.cmake
diff --git a/salome_adm/cmake_files/FindSalomeNumPySciPy.cmake b/salome_adm/cmake_files/FindSalomeNumPySciPy.cmake
new file mode 100644 (file)
index 0000000..f88a20b
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author: Roman NIKOLAEV
+#
+# Looking for an installation of NumPy and SciPy, and if found the following variables are set
+#   NUMPY_INCLUDE_DIR  - NumPy header location
+#   NUMPY_DEFINITIONS  - NumPy compiler flags
+#   SCIPY_DEFINITIONS  - SciPy compiler flags
+#   SCIPY_VERSION      - SciPy version
+#
+
+IF(SALOMEPYTHONINTERP_FOUND)   
+  # Numpy
+  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy ; import sys ; sys.stdout.write(numpy.get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE_DIR ERROR_QUIET )
+  IF(NUMPY_INCLUDE_DIR)
+    SET(NUMPY_FOUND TRUE)
+  ENDIF(NUMPY_INCLUDE_DIR)
+  IF(NUMPY_FOUND)
+    SET(NUMPY_DEFINITIONS -DWITH_NUMPY)
+    MESSAGE(STATUS "NumPy found : ${NUMPY_INCLUDE_DIR}")
+  ELSE(NUMPY_FOUND)
+    MESSAGE(STATUS "NumPy not found.")
+  ENDIF(NUMPY_FOUND)
+
+  # SciPy detection
+  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import scipy ; import sys ; sys.stdout.write(scipy.version.version)" OUTPUT_VARIABLE SCIPY_VERSION ERROR_QUIET )
+  IF(SCIPY_VERSION)
+    SET(SCIPY_FOUND TRUE)
+  ENDIF(SCIPY_VERSION)
+  IF(SCIPY_FOUND)
+    MESSAGE(STATUS "Scipy found : Version ${SCIPY_VERSION}")
+    SET(SCIPY_DEFINITIONS -DWITH_SCIPY)
+  ELSE(SCIPY_FOUND)
+    MESSAGE(STATUS "SciPy not found.")
+  ENDIF(SCIPY_FOUND)
+ENDIF()
\ No newline at end of file
index 03dc0c626e97cd8a26770644b8dbcb9462f9a76a..8b20e14cc4390f4fd1f30a977d22afedd0421ebc 100644 (file)
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
-# We also look for an installation of NumPy, and if found the following variables are set
-#   NUMPY_INCLUDE_DIR  - NumPy header location
-#   NUMPY_DEFINITIONS  - compiler flag
-# and are automatically appended to PYTHON_INCLUDE_DIRS (and PYTHON_DEFINITIONS resp.)    
-#
 
 # Make sure the detection of both libs and interpreter (if both needed) occur in the correct order:
 IF(SALOMEPYTHONLIBS_FOUND AND NOT SALOMEPYTHONINTERP_FOUND)
@@ -45,31 +40,6 @@ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PythonInterp PYTHON_EXECUTABLE 1)
 
 IF(SALOMEPYTHONINTERP_FOUND) 
   SET(PYTHON_PYTHONPATH "${PYTHON_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-  
-  ##
-  ## Specifics -- NumPy/SciPy detection
-  ##
-  
-  # Numpy
-  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy ; import sys ; sys.stdout.write(numpy.get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE_DIR ERROR_QUIET )
-  IF(NUMPY_INCLUDE_DIR)
-    SET(NUMPY_FOUND TRUE)
-  ENDIF(NUMPY_INCLUDE_DIR)
-  IF(NUMPY_FOUND)
-    SET(NUMPY_DEFINITIONS "-DWITH_NUMPY")
-    MESSAGE(STATUS "NumPy found : ${NUMPY_INCLUDE_DIR}")
-  ELSE(NUMPY_FOUND)
-    MESSAGE(STATUS "NumPy not found.")
-  ENDIF(NUMPY_FOUND)
-  # SciPy detection
-  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import scipy ; import sys ; sys.stdout.write(scipy.version.version)" OUTPUT_VARIABLE SCIPY_VERSION ERROR_QUIET )
-  IF(SCIPY_VERSION)
-    SET(SCIPY_FOUND TRUE)
-  ENDIF(SCIPY_VERSION)
-  IF(SCIPY_FOUND)
-    MESSAGE(STATUS "Scipy found : Version ${SCIPY_VERSION}")
-  ENDIF(SCIPY_FOUND)
-
   SALOME_ACCUMULATE_ENVIRONMENT(PATH ${PYTHON_EXECUTABLE})
   SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PYTHON_PYTHONPATH})
 ENDIF()