Salome HOME
Reverted to SALOME current CMake build procedure.
[tools/medcoupling.git] / src / MEDPartitioner_Swig / CMakeLists.txt
1 # Copyright (C) 2012-2015  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 INCLUDE(${SWIG_USE_FILE})
21
22 ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} )
23
24 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON)
25 SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_DEFINITIONS "-shadow")
26 SET(SWIG_MODULE_MEDPartitioner_EXTRA_FLAGS "${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY};-DWITHOUT_AUTOFIELD")
27
28 SET (MEDPartitioner_SWIG_DPYS_FILES
29     MEDPartitionerCommon.i)
30
31 INCLUDE_DIRECTORIES(
32   ${PYTHON_INCLUDE_DIRS}
33   ${PTHREAD_INCLUDE_DIR} # pthread dependancy due to python2.7 library
34   ${CMAKE_CURRENT_SOURCE_DIR}
35   ${CMAKE_CURRENT_BINARY_DIR}
36   ${HDF5_INCLUDE_DIRS}
37   ${MEDFILE_INCLUDE_DIRS}
38   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDPartitioner
39   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling_Swig
40   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
41   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader
42   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig
43   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
44   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
45   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D
46   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval
47   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints
48   )
49
50 SWIG_ADD_MODULE(MEDPartitioner python MEDPartitioner.i)
51 SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medpartitionercpp)
52
53 IF(WIN32)
54   SET_TARGET_PROPERTIES(_MEDPartitioner PROPERTIES DEBUG_OUTPUT_NAME _MEDPartitioner_d)
55 ENDIF(WIN32)
56 INSTALL(TARGETS ${SWIG_MODULE_MEDPartitioner_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
57
58 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDPartitioner.py)
59 SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
60
61 INSTALL(FILES MEDPartitioner.i MEDPartitionerCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
62 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
63
64 IF(MEDCOUPLING_MED_PARTITIONER_METIS)
65    # Python test of partitionner require METIS or PARMETIS?
66    SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
67    ADD_TEST(MEDPartitionerTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDPartitionerTest.py)
68    SET_TESTS_PROPERTIES(MEDPartitionerTest PROPERTIES ENVIRONMENT "${tests_env}")
69    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader/Swig/MEDLoaderDataForTest.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
70 ENDIF()
71
72 # Application tests
73
74 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS}/test/MEDCoupling/MEDPartitioner_Swig)
75 INSTALL(FILES MEDPartitionerTest.py DESTINATION ${TEST_INSTALL_DIRECTORY})
76
77 INSTALL(FILES CTestTestfileInstall.cmake
78         DESTINATION ${TEST_INSTALL_DIRECTORY}
79         RENAME CTestTestfile.cmake)