1 # Copyright (C) 2012-2019 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} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
24 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
25 IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
26 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3")
28 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_DEFINITIONS "-shadow")
30 SET(SWIG_MODULE_MEDPartitioner_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
32 SET (MEDPartitioner_SWIG_DPYS_FILES
33 MEDPartitionerCommon.i)
36 ${PYTHON_INCLUDE_DIRS}
37 ${PTHREAD_INCLUDE_DIR} # pthread dependency due to python2.7 library
39 ${CMAKE_CURRENT_SOURCE_DIR}
40 ${CMAKE_CURRENT_BINARY_DIR}
42 ${MEDFILE_INCLUDE_DIRS}
43 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDPartitioner
44 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling_Swig
45 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
46 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
47 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig
48 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
49 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
50 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
51 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
52 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
55 IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
56 SWIG_ADD_MODULE(MEDPartitioner python MEDPartitioner.i)
58 SWIG_ADD_LIBRARY(MEDPartitioner LANGUAGE python SOURCES MEDPartitioner.i)
61 SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medpartitionercpp)
62 SWIG_CHECK_GENERATION(MEDPartitioner)
65 SET_TARGET_PROPERTIES(_MEDPartitioner PROPERTIES DEBUG_OUTPUT_NAME _MEDPartitioner_d)
67 INSTALL(TARGETS ${SWIG_MODULE_MEDPartitioner_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
69 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDPartitioner.py)
70 SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_MEDPartitioner_REAL_NAME}")
72 INSTALL(FILES MEDPartitioner.i MEDPartitionerCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
73 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
75 IF(MEDCOUPLING_PARTITIONER_METIS)
76 # Python test of partitionner require METIS or PARMETIS?
77 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR}/../MEDLoader/Swig)
78 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
79 ADD_TEST(MEDPartitionerTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDPartitionerTest.py)
80 SET_TESTS_PROPERTIES(MEDPartitionerTest PROPERTIES ENVIRONMENT "${tests_env}")
81 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig/MEDLoaderDataForTest.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
86 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/MEDPartitioner_Swig)
87 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${TEST_INSTALL_DIRECTORY})
89 INSTALL(FILES CTestTestfileInstall.cmake
90 DESTINATION ${TEST_INSTALL_DIRECTORY}
91 RENAME CTestTestfile.cmake)