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 ${PROJECT_BINARY_DIR}/doc
58 SET(medcoupling_LIB_dependancies ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingremapper)
60 IF(NOT MEDCOUPLING_MICROMED)
61 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_MED_FILE)
62 LIST(APPEND medcoupling_LIB_dependancies medloader)
63 ENDIF(NOT MEDCOUPLING_MICROMED)
65 IF(MEDCOUPLING_ENABLE_RENUMBER)
66 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_RENUMBER)
67 LIST(APPEND medcoupling_LIB_dependancies renumbercpp)
68 ENDIF(MEDCOUPLING_ENABLE_RENUMBER)
70 IF(MEDCOUPLING_ENABLE_PARTITIONER)
71 LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_PARTITIONER)
72 LIST(APPEND medcoupling_LIB_dependancies medpartitionercpp)
73 ENDIF(MEDCOUPLING_ENABLE_PARTITIONER)
75 SWIG_ADD_MODULE(medcoupling python medcoupling.i)
76 SWIG_LINK_LIBRARIES(medcoupling ${medcoupling_LIB_dependancies})
77 SWIG_CHECK_GENERATION(medcoupling)
79 SET_TARGET_PROPERTIES(_medcoupling PROPERTIES DEBUG_OUTPUT_NAME _medcoupling_d)
82 INSTALL(TARGETS _medcoupling DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
83 INSTALL(FILES medcoupling.i medcoupling_pycode DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
84 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/medcoupling.py ${MEDCOUPLING_INSTALL_PYTHON})