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} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
25 ADD_DEFINITIONS(-Wsign-compare -Wconversion)
28 SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON)
29 IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
30 SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3")
32 SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
34 SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
35 IF(MEDCOUPLING_USE_64BIT_IDS)
36 STRING(APPEND SWIG_MODULE_MEDRenumber_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
37 ENDIF(MEDCOUPLING_USE_64BIT_IDS)
39 SET (MEDRenumber_SWIG_DPYS_FILES
45 ${PYTHON_INCLUDE_DIRS}
46 ${PTHREAD_INCLUDE_DIR} # pthread dependency due to python2.7 library
47 ${CMAKE_CURRENT_SOURCE_DIR}
48 ${CMAKE_CURRENT_BINARY_DIR}
49 ${CMAKE_CURRENT_SOURCE_DIR}/../RENUMBER
50 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling_Swig
51 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
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
60 SET_PROPERTY(SOURCE MEDRenumber.i PROPERTY COMPILE_DEFINITIONS WIN32)
62 IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
63 SWIG_ADD_MODULE(MEDRenumber python MEDRenumber.i)
65 SWIG_ADD_LIBRARY(MEDRenumber LANGUAGE python SOURCES MEDRenumber.i)
68 SWIG_LINK_LIBRARIES(MEDRenumber ${PLATFORM_LIBS} renumbercpp)
70 # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
71 SWIG_LINK_LIBRARIES(MEDRenumber ${PYTHON_LIBRARIES})
73 SWIG_CHECK_GENERATION(MEDRenumber)
76 SET_TARGET_PROPERTIES(_MEDRenumber PROPERTIES DEBUG_OUTPUT_NAME _MEDRenumber_d)
78 INSTALL(TARGETS ${SWIG_MODULE_MEDRenumber_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
80 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/MEDRenumber.py ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_MEDRenumber_REAL_NAME}")
82 INSTALL(FILES MEDRenumber.i MEDRenumberCommon.i MEDRenumberImpl.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
83 INSTALL(FILES MEDRenumberTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
85 IF(MEDCOUPLING_BUILD_PY_TESTS)
86 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/../PyWrapping)
87 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
88 ADD_TEST(MEDRenumberTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDRenumberTest.py)
89 SET_TESTS_PROPERTIES(MEDRenumberTest PROPERTIES ENVIRONMENT "${tests_env}")
90 IF(MEDCOUPLING_ENABLE_PARTITIONER)
91 ADD_TEST(MEDRenumberUserGuide ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/UsersGuideExamplesTest.py)
92 SET_TESTS_PROPERTIES(MEDRenumberUserGuide PROPERTIES ENVIRONMENT "${tests_env}")
98 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/RENUMBER_Swig)
99 INSTALL(FILES MEDRenumberTest.py UsersGuideExamplesTest.py DESTINATION ${TEST_INSTALL_DIRECTORY})
101 INSTALL(FILES CTestTestfileInstall.cmake
102 DESTINATION ${TEST_INSTALL_DIRECTORY}
103 RENAME CTestTestfile.cmake)