]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/RENUMBER_Swig/CMakeLists.txt
Salome HOME
Ensure that ShapeRecognition links against cblas
[tools/medcoupling.git] / src / RENUMBER_Swig / CMakeLists.txt
1 # Copyright (C) 2012-2024  CEA, EDF
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} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS})
23
24 IF (NOT DEFINED MSVC)
25   ADD_DEFINITIONS(-Wsign-compare -Wconversion)
26 ENDIF()
27
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")
31 ELSE()
32   SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
33 ENDIF()
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)
38
39 SET (MEDRenumber_SWIG_DPYS_FILES
40   MEDRenumberCommon.i
41   MEDRenumberImpl.i)
42
43 INCLUDE_DIRECTORIES(
44   ${NUMPY_INCLUDE_DIR}
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
57   )
58
59 IF(WIN32)
60   SET_PROPERTY(SOURCE MEDRenumber.i PROPERTY COMPILE_DEFINITIONS WIN32)
61 ENDIF()
62 IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")     
63   SWIG_ADD_MODULE(MEDRenumber python MEDRenumber.i)
64 ELSE()
65   SWIG_ADD_LIBRARY(MEDRenumber LANGUAGE python SOURCES MEDRenumber.i)
66 ENDIF()
67
68 SWIG_LINK_LIBRARIES(MEDRenumber ${PLATFORM_LIBS} renumbercpp)
69 IF (WIN32)
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})
72 ENDIF()
73 SWIG_CHECK_GENERATION(MEDRenumber)
74
75 IF(WIN32)
76   SET_TARGET_PROPERTIES(_MEDRenumber PROPERTIES DEBUG_OUTPUT_NAME _MEDRenumber_d)
77 ENDIF(WIN32)
78 INSTALL(TARGETS ${SWIG_MODULE_MEDRenumber_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
79
80 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/MEDRenumber.py ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_MEDRenumber_REAL_NAME}")
81
82 INSTALL(FILES MEDRenumber.i MEDRenumberCommon.i MEDRenumberImpl.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
83 INSTALL(FILES MEDRenumberTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
84
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}")
93     ENDIF()
94 ENDIF()
95
96 # Application tests
97
98 SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/RENUMBER_Swig)
99 INSTALL(FILES MEDRenumberTest.py UsersGuideExamplesTest.py DESTINATION ${TEST_INSTALL_DIRECTORY})
100
101 INSTALL(FILES CTestTestfileInstall.cmake
102         DESTINATION ${TEST_INSTALL_DIRECTORY}
103         RENAME CTestTestfile.cmake)