1 # Copyright (C) 2012-2016 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 INCLUDE(${SWIG_USE_FILE})
22 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
24 SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON)
25 SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
26 SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
28 SET (MEDCoupling_SWIG_DPYS_FILES
31 MEDCouplingFieldDiscretization.i
33 MEDCouplingTypemaps.i)
36 MEDCouplingBasicsTest1.py
37 MEDCouplingBasicsTest2.py
38 MEDCouplingBasicsTest3.py
39 MEDCouplingBasicsTest4.py
40 MEDCouplingBasicsTest5.py
41 MEDCouplingRemapperTest.py
42 MEDCouplingDataForTest.py
43 MEDCouplingNumPyTest.py
44 MEDCouplingPickleTest.py
50 MEDCouplingRefCountObject.i
52 MEDCouplingFieldDiscretization.i
53 MEDCouplingTimeDiscretization.i
57 MEDCouplingDataArrayTypemaps.i
61 ${PYTHON_INCLUDE_DIRS}
63 ${PTHREAD_INCLUDE_DIR} # pthread dependancy due to python2.7 library
64 ${CMAKE_CURRENT_SOURCE_DIR}
65 ${CMAKE_CURRENT_BINARY_DIR}
66 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
67 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
68 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
69 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
70 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
71 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
72 ${PROJECT_BINARY_DIR}/doc
75 # _ABR_ Ensure dependency mechanism on all SWIG files and headers
76 SET (SWIG_MODULE_MEDCoupling_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES}
77 ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
78 ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
80 # SWIG must run after the doc if we want to have the docstrings extracted from Doxygen
81 # into the Python module:
82 IF(MEDCOUPLING_BUILD_DOC)
83 LIST(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS -DWITH_DOCSTRINGS)
84 LIST(APPEND SWIG_MODULE_MEDCoupling_EXTRA_DEPS
85 ${PROJECT_BINARY_DIR}/doc/MEDCoupling_doc.i
89 SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i)
90 SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcoupling)
92 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON)
93 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
94 SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
96 # _ABR_ Ensure dependency mechanism on all SWIG files and headers
97 SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES}
98 ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
99 ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
101 SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i)
102 SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper)
105 SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d)
106 SET_TARGET_PROPERTIES(_MEDCoupling PROPERTIES DEBUG_OUTPUT_NAME _MEDCoupling_d)
108 INSTALL(TARGETS ${SWIG_MODULE_MEDCoupling_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
110 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py)
111 SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON})
113 INSTALL(FILES ${MC_Swig_interf} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
114 INSTALL(FILES ${MC_pyTestFiles} DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
115 INSTALL(FILES MEDCouplingExamplesTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
117 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
119 ADD_TEST(MEDCouplingBasicsTest1 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest1.py)
120 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest1 PROPERTIES ENVIRONMENT "${tests_env}")
121 ADD_TEST(MEDCouplingBasicsTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest2.py)
122 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest2 PROPERTIES ENVIRONMENT "${tests_env}")
123 ADD_TEST(MEDCouplingBasicsTest3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest3.py)
124 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest3 PROPERTIES ENVIRONMENT "${tests_env}")
125 ADD_TEST(MEDCouplingBasicsTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest4.py)
126 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest4 PROPERTIES ENVIRONMENT "${tests_env}")
127 ADD_TEST(MEDCouplingBasicsTest5 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest5.py)
128 SET_TESTS_PROPERTIES(MEDCouplingBasicsTest5 PROPERTIES ENVIRONMENT "${tests_env}")
129 ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py)
130 SET_TESTS_PROPERTIES(MEDCouplingExamplesTest PROPERTIES ENVIRONMENT "${tests_env}")
131 ADD_TEST(MEDCouplingRemapperTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingRemapperTest.py)
132 SET_TESTS_PROPERTIES(MEDCouplingRemapperTest PROPERTIES ENVIRONMENT "${tests_env}")
135 ADD_TEST(MEDCouplingNumPyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumPyTest.py)
136 SET_TESTS_PROPERTIES(MEDCouplingNumPyTest PROPERTIES ENVIRONMENT "${tests_env}")
137 ADD_TEST(MEDCouplingPickleTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingPickleTest.py)
138 SET_TESTS_PROPERTIES(MEDCouplingPickleTest PROPERTIES ENVIRONMENT "${tests_env}")
143 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/MEDCoupling_Swig)
144 LIST(APPEND MC_pyTestFiles MEDCouplingExamplesTest.py)
145 INSTALL(FILES ${MC_pyTestFiles} DESTINATION ${TEST_INSTALL_DIRECTORY})
147 INSTALL(FILES CTestTestfileInstall.cmake
148 DESTINATION ${TEST_INSTALL_DIRECTORY}
149 RENAME CTestTestfile.cmake)