1 # Copyright (C) 2017 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
19 # Author : Anthony Geay (EDF R&D)
21 FIND_PACKAGE(SWIG REQUIRED)
22 INCLUDE(${SWIG_USE_FILE})
24 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
26 SET_SOURCE_FILES_PROPERTIES(medcoupling.i PROPERTIES CPLUSPLUS ON)
27 IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
28 SET_SOURCE_FILES_PROPERTIES(medcoupling.i PROPERTIES SWIG_FLAGS "-py3")
30 SET_SOURCE_FILES_PROPERTIES(medcoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow")
32 SET(SWIG_MODULE_medcoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
34 SET(medcoupling_SWIG_DPYS_FILES medcoupling.i)
37 ${PYTHON_INCLUDE_DIRS}
39 ${MEDFILE_INCLUDE_DIRS}
41 ${CMAKE_CURRENT_SOURCE_DIR}
42 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
43 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig
44 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling_Swig
45 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
46 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
47 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
48 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
49 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
50 ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
51 ${CMAKE_CURRENT_SOURCE_DIR}/../RENUMBER
52 ${CMAKE_CURRENT_SOURCE_DIR}/../RENUMBER_Swig
53 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDPartitioner
54 ${CMAKE_CURRENT_SOURCE_DIR}/../MEDPartitioner_Swig
55 ${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo
56 ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDMEM
57 ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDMEM_Swig
58 ${PROJECT_BINARY_DIR}/doc
61 SET(medcoupling_LIB_dependancies ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingremapper)
63 IF(NOT MEDCOUPLING_MICROMED)
64 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_MED_FILE)
65 LIST(APPEND medcoupling_LIB_dependancies medloader)
66 ENDIF(NOT MEDCOUPLING_MICROMED)
68 IF(MEDCOUPLING_ENABLE_RENUMBER)
69 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_RENUMBER)
70 LIST(APPEND medcoupling_LIB_dependancies renumbercpp)
71 ENDIF(MEDCOUPLING_ENABLE_RENUMBER)
73 IF(MEDCOUPLING_ENABLE_PARTITIONER)
74 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_PARTITIONER)
75 LIST(APPEND medcoupling_LIB_dependancies medpartitionercpp)
76 ENDIF(MEDCOUPLING_ENABLE_PARTITIONER)
78 IF(MEDCOUPLING_USE_MPI)
79 INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
80 ADD_DEFINITIONS(${MPI_DEFINITIONS})
81 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_PARALLEL_INTERPOLATOR)
82 LIST(APPEND medcoupling_LIB_dependancies paramedmem)
83 ENDIF(MEDCOUPLING_USE_MPI)
85 SWIG_ADD_MODULE(medcoupling python medcoupling.i)
86 SWIG_LINK_LIBRARIES(medcoupling ${medcoupling_LIB_dependancies})
87 SWIG_CHECK_GENERATION(medcoupling)
89 SET_TARGET_PROPERTIES(_medcoupling PROPERTIES DEBUG_OUTPUT_NAME _medcoupling_d)
92 INSTALL(TARGETS _medcoupling DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
93 INSTALL(FILES medcoupling.i medcoupling_pycode DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
94 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/medcoupling.py ${MEDCOUPLING_INSTALL_PYTHON})
98 FOREACH(test ${BASE_TESTS})
99 GET_FILENAME_COMPONENT(testname ${test} NAME_WE)
100 ADD_TEST(NAME ${testname} COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test})
101 SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
104 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/PyWrapping)
106 INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake)
107 INSTALL(FILES ${BASE_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY})
108 INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})