]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/MEDLoader/Swig/CMakeLists.txt
Salome HOME
IMP: generation of Python docstrings from Doxygen output.
[tools/medcoupling.git] / src / MEDLoader / 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 # Author : Anthony Geay (CEA/DEN)
20
21 FIND_PACKAGE(SWIG REQUIRED)
22 INCLUDE(${SWIG_USE_FILE})
23
24 ADD_DEFINITIONS(${PYTHON_DEFINITIONS})
25
26 SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES CPLUSPLUS ON)
27 SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow")
28 SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS_FOR_NUMPYANDSCIPY})
29
30 SET (MEDLoader_SWIG_DPYS_FILES
31     MEDLoaderCommon.i
32     MEDLoaderTypemaps.i)
33
34 INCLUDE_DIRECTORIES(
35   ${PYTHON_INCLUDE_DIRS}
36   ${MEDFILE_INCLUDE_DIRS}
37   ${HDF5_INCLUDE_DIRS}
38   ${CMAKE_CURRENT_SOURCE_DIR}
39   ${CMAKE_CURRENT_SOURCE_DIR}/..
40   ${CMAKE_CURRENT_SOURCE_DIR}/../../MEDCoupling_Swig
41   ${CMAKE_CURRENT_SOURCE_DIR}/../../MEDCoupling
42   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL
43   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/Bases
44   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/Geometric2D
45   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/ExprEval
46   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/GaussPoints
47   ${PROJECT_BINARY_DIR}/doc
48 )
49
50 SET (SWIG_MODULE_MEDLoader_EXTRA_DEPS ${MEDLoader_SWIG_DPYS_FILES}
51     ${medloader_HEADERS_HXX}
52     ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX}
53     ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
54
55 # SWIG must run after the doc if we want to have the docstrings extracted from Doxygen
56 # into the Python module:
57 IF(SALOME_BUILD_DOC)
58     LIST(APPEND SWIG_MODULE_MEDLoader_EXTRA_FLAGS -DWITH_DOCSTRINGS)
59     LIST(APPEND SWIG_MODULE_MEDLoader_EXTRA_DEPS 
60         ${PROJECT_BINARY_DIR}/doc/MEDLoader_doc.i
61         swig_ready)
62 ENDIF()
63
64 SWIG_ADD_MODULE(MEDLoader python MEDLoader.i)
65 SWIG_LINK_LIBRARIES(MEDLoader ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medloader medcoupling)
66 IF(WIN32)
67   SET_TARGET_PROPERTIES(_MEDLoader PROPERTIES DEBUG_OUTPUT_NAME _MEDLoader_d)
68 ENDIF(WIN32)
69
70 INSTALL(TARGETS _MEDLoader DESTINATION ${SALOME_INSTALL_PYTHON})
71 INSTALL(FILES MEDLoader.i MEDLoaderTypemaps.i MEDLoaderCommon.i DESTINATION ${SALOME_INSTALL_HEADERS})
72
73 SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDLoader.py)
74 SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${SALOME_INSTALL_PYTHON})
75
76 INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py MEDLoaderSplitter.py medutilities.py DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS})
77 INSTALL(FILES med2sauv PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SALOME_INSTALL_BINS} )
78 INSTALL(FILES sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SALOME_INSTALL_BINS} )
79 INSTALL(FILES case2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SALOME_INSTALL_BINS} )
80 INSTALL(FILES med2case PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${SALOME_INSTALL_BINS} )
81
82 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
83
84 ADD_TEST(MEDLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest.py)
85 SET_TESTS_PROPERTIES(MEDLoaderTest PROPERTIES ENVIRONMENT "${tests_env}")
86 ADD_TEST(MEDLoaderTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest2.py)
87 SET_TESTS_PROPERTIES(MEDLoaderTest2 PROPERTIES ENVIRONMENT "${tests_env}")
88 ADD_TEST(MEDLoaderTest3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest3.py)
89 SET_TESTS_PROPERTIES(MEDLoaderTest3 PROPERTIES ENVIRONMENT "${tests_env}")
90 ADD_TEST(MEDLoaderTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest4.py)
91 SET_TESTS_PROPERTIES(MEDLoaderTest4 PROPERTIES ENVIRONMENT "${tests_env}")
92 ADD_TEST(MEDLoaderExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderExamplesTest.py)
93 SET_TESTS_PROPERTIES(MEDLoaderExamplesTest PROPERTIES ENVIRONMENT "${tests_env}")
94 ADD_TEST(SauvLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SauvLoaderTest.py)
95 SET_TESTS_PROPERTIES(SauvLoaderTest PROPERTIES ENVIRONMENT "${tests_env}")
96
97 IF(NUMPY_FOUND)
98   ADD_TEST(MEDLoaderCouplingTrainingSession ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderCouplingTrainingSession.py)
99   SET_TESTS_PROPERTIES(MEDLoaderCouplingTrainingSession PROPERTIES ENVIRONMENT "${tests_env}")
100 ENDIF(NUMPY_FOUND)
101
102 # Application tests
103
104 SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDCoupling/MEDLoader/Swig)
105
106 INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py MEDLoaderSplitter.py medutilities.py DESTINATION ${TEST_INSTALL_DIRECTORY})
107
108 INSTALL(FILES CTestTestfileInstall.cmake
109         DESTINATION ${TEST_INSTALL_DIRECTORY}
110         RENAME CTestTestfile.cmake)