]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CMake: including Python (and hence NumPy) definitions for DSC (Calcium)
authorbruneton <bruneton>
Thu, 29 Aug 2013 12:18:42 +0000 (12:18 +0000)
committerbruneton <bruneton>
Thu, 29 Aug 2013 12:18:42 +0000 (12:18 +0000)
salome_adm/cmake_files/FindSalomePython.cmake
src/DSC/DSC_Python/CMakeLists.txt
src/DSC/DSC_Python/calcium.i

index c74ae64bda9b6637c74de0065af0668a740aee8d..d1ef5532afa5d8fd7d748702251b5973a610fd29 100644 (file)
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
 # The interpreter is found first, and if OK, the corresponding libraries are searched.
-# We ensure the version of the libraries matches the one of the interpreter. 
+# We ensure the version of the libraries matches the one of the interpreter.
+#
+# 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.)    
 #
 
 # 1. Load environment or any previously detected Python
@@ -136,7 +141,9 @@ IF (SALOMEPYTHON_FOUND)
   ENDIF()
 
   # 6. Specifics
-
+  #
+  
+  # NumPy detection 
   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)
@@ -144,9 +151,9 @@ IF (SALOMEPYTHON_FOUND)
   IF(NUMPY_FOUND)
     SET(PYTHON_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
     SET(PYTHON_DEFINITIONS "${PYTHON_DEFINITIONS} -DWITH_NUMPY")
-    MESSAGE(STATUS "numpy found : ${NUMPY_INCLUDE_DIR}")
+    MESSAGE(STATUS "NumPy found : ${NUMPY_INCLUDE_DIR}")
   ELSE(NUMPY_FOUND)
-    MESSAGE(STATUS "numpy not found")
+    MESSAGE(STATUS "NumPy not found.")
   ENDIF(NUMPY_FOUND)
 
   ## None here    
index 9d803f1b8d101e206bc9dadab244da488138b8e6..b4e878048fe9bdf8896bdcdd6a3f665255bcca3a 100755 (executable)
@@ -22,7 +22,7 @@ INCLUDE(${SWIG_USE_FILE})
 
 SET_SOURCE_FILES_PROPERTIES(calcium.i PROPERTIES CPLUSPLUS ON)
 SET(CMAKE_SWIG_FLAGS "-noexcept")
-ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS})
+ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS})
 
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
index 45dd8e0c6cb516678c05bc25a67f13793e587b51..8532c03aa5d9e5dbdc973887637d67c756f83ec3 100644 (file)
@@ -146,7 +146,7 @@ const char* pytype_string(PyObject* py_obj) {
   if (PyModule_Check(  py_obj)) return "module"      ;
   if (PyInstance_Check(py_obj)) return "instance"    ;
 
-  return "unkown type";
+  return "unknown type";
 }
 
 /*