1 # Copyright (C) 2012-2024 CEA, EDF
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})
25 ADD_DEFINITIONS(-Wsign-compare -Wconversion)
28 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
29 IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
30 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3")
32 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_DEFINITIONS "-shadow")
34 SET(SWIG_MODULE_MEDPartitioner_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
36 SET (MEDPartitioner_SWIG_DPYS_FILES
37 MEDPartitionerCommon.i)
40 ${PYTHON_INCLUDE_DIRS}
41 ${PTHREAD_INCLUDE_DIR} # pthread dependency due to python2.7 library
43 ${CMAKE_CURRENT_SOURCE_DIR}
44 ${CMAKE_CURRENT_BINARY_DIR}
46 ${MEDFILE_INCLUDE_DIRS}
47 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDPartitioner
48 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling_Swig
49 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
50 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
51 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig
52 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
53 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
54 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
55 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
56 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
59 IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
60 SWIG_ADD_MODULE(MEDPartitioner python MEDPartitioner.i)
62 SWIG_ADD_LIBRARY(MEDPartitioner LANGUAGE python SOURCES MEDPartitioner.i)
65 SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medpartitionercpp)
66 SWIG_CHECK_GENERATION(MEDPartitioner)
69 SET_TARGET_PROPERTIES(_MEDPartitioner PROPERTIES DEBUG_OUTPUT_NAME _MEDPartitioner_d)
71 INSTALL(TARGETS ${SWIG_MODULE_MEDPartitioner_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
73 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDPartitioner.py)
74 SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_MEDPartitioner_REAL_NAME}")
76 INSTALL(FILES MEDPartitioner.i MEDPartitionerCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
77 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
79 IF(MEDCOUPLING_PARTITIONER_METIS)
80 IF(MEDCOUPLING_BUILD_PY_TESTS)
81 # Python test of partitionner require METIS or PARMETIS?
82 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/../MEDLoader/Swig)
83 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
84 ADD_TEST(MEDPartitionerTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDPartitionerTest.py)
85 SET_TESTS_PROPERTIES(MEDPartitionerTest PROPERTIES ENVIRONMENT "${tests_env}")
86 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig/MEDLoaderDataForTest.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
92 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/MEDPartitioner_Swig)
93 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${TEST_INSTALL_DIRECTORY})
95 INSTALL(FILES CTestTestfileInstall.cmake
96 DESTINATION ${TEST_INSTALL_DIRECTORY}
97 RENAME CTestTestfile.cmake)