]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/MEDCoupling_Swig/CMakeLists.txt
Salome HOME
addition of numpy
[tools/medcoupling.git] / src / MEDCoupling_Swig / CMakeLists.txt
1 # Copyright (C) 2012-2013  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 INCLUDE(${SWIG_USE_FILE})
21
22 SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON)
23 SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
24 IF(NUMPY_FOUND)
25   SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS -DWITH_NUMPY)
26 ENDIF(NUMPY_FOUND)
27
28 SET (MEDCoupling_SWIG_DPYS_FILES
29     MEDCouplingCommon.i
30     MEDCouplingMemArray.i
31     MEDCouplingFinalize.i
32     MEDCouplingTypemaps.i)   
33
34 INCLUDE_DIRECTORIES(
35   ${PYTHON_INCLUDE_DIRS}
36   ${PTHREAD_INCLUDE_DIRS} # pthread dependancy due to python2.7 library
37   ${CMAKE_CURRENT_SOURCE_DIR}
38   ${CMAKE_CURRENT_BINARY_DIR}
39   ${CMAKE_BINARY_DIR}
40   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
41   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
42   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
43   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
44   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
45   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
46   )
47
48 # _ABR_ Ensure dependency mechanism on all SWIG files and headers
49 SET (SWIG_MODULE_MEDCoupling_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} 
50     ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
51     ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
52
53 SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i)
54 SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBS} ${PLATFORM_LIBS} medcoupling)
55 SET_TARGET_PROPERTIES(${SWIG_MODULE_MEDCoupling_REAL_NAME} PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${PYTHON_DEFINITIONS}")
56
57 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON)
58 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
59 IF(NUMPY_STATUS)
60   SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS -DWITH_NUMPY)
61 ENDIF(NUMPY_STATUS)
62
63 # _ABR_ Ensure dependency mechanism on all SWIG files and headers
64 SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES}
65     ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
66     ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
67
68 SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i)
69 SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBS} medcouplingremapper)
70 SET_TARGET_PROPERTIES(${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS} ${PYTHON_DEFINITIONS}")
71
72 IF(WIN32)
73   SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d)
74   SET_TARGET_PROPERTIES(_MEDCoupling PROPERTIES DEBUG_OUTPUT_NAME _MEDCoupling_d)
75 ENDIF(WIN32)
76 INSTALL(TARGETS ${SWIG_MODULE_MEDCoupling_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${SALOME_INSTALL_PYTHON})
77
78 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py ${CMAKE_CURRENT_SOURCE_DIR}/libMEDCoupling_Swig.py)
79 INSTALL_AND_COMPILE_PYTHON_FILE("${PYFILES_TO_INSTALL}" ${SALOME_INSTALL_SCRIPT_PYTHON})
80
81 INSTALL(FILES MEDCoupling.i MEDCouplingCommon.i MEDCouplingMemArray.i MEDCouplingFinalize.i MEDCouplingRemapper.i MEDCouplingTypemaps.i DESTINATION ${SALOME_INSTALL_HEADERS})
82 INSTALL(FILES MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCouplingDataForTest.py MEDCouplingNumPyTest.py DESTINATION ${SALOME_INSTALL_SCRIPT_PYTHON})
83
84 ADD_TEST(MEDCouplingBasicsTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest.py)
85 ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py)
86 ADD_TEST(MEDCouplingRemapperTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingRemapperTest.py)
87 IF(NUMPY_STATUS)
88   ADD_TEST(MEDCouplingNumPyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumPyTest.py)
89 ENDIF(NUMPY_STATUS)