From: bruneton Date: Thu, 29 Aug 2013 12:18:42 +0000 (+0000) Subject: CMake: including Python (and hence NumPy) definitions for DSC (Calcium) X-Git-Tag: begin_agr_portmanager_branch_131004~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5deadc4d2efc0f4b691b1bddb6f2a4931cac256;p=modules%2Fkernel.git CMake: including Python (and hence NumPy) definitions for DSC (Calcium) --- diff --git a/salome_adm/cmake_files/FindSalomePython.cmake b/salome_adm/cmake_files/FindSalomePython.cmake index c74ae64bd..d1ef5532a 100644 --- a/salome_adm/cmake_files/FindSalomePython.cmake +++ b/salome_adm/cmake_files/FindSalomePython.cmake @@ -24,7 +24,12 @@ # !! 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 diff --git a/src/DSC/DSC_Python/CMakeLists.txt b/src/DSC/DSC_Python/CMakeLists.txt index 9d803f1b8..b4e878048 100755 --- a/src/DSC/DSC_Python/CMakeLists.txt +++ b/src/DSC/DSC_Python/CMakeLists.txt @@ -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} diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index 45dd8e0c6..8532c03aa 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -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"; } /*