Salome HOME
Copyright update 2021
[modules/shaper_study.git] / src / SWIG / CMakeLists.txt
1 # Copyright (C) 2019-2021  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 # --- options ---
23 # additional include directories
24 INCLUDE_DIRECTORIES(
25   ${PYTHON_INCLUDE_DIRS}
26   ${OpenCASCADE_INCLUDE_DIR}
27   ${OMNIORB_INCLUDE_DIR}
28   ${PROJECT_SOURCE_DIR}/src/StudyData
29 )
30
31 # additional preprocessor / compiler flags
32 ADD_DEFINITIONS(
33   ${OpenCASCADE_DEFINITIONS}
34   ${OMNIORB_DEFINITIONS}
35   ${PYTHON_DEFINITIONS}
36 )
37
38 # libraries to link to
39 SET(_link_LIBRARIES
40   StudyData
41   ${PYTHON_LIBRARIES}
42 )
43
44 # --- headers ---
45
46 # header files / to be processed by moc
47 SET(SHAPERSTUDY_Swig_HEADERS
48 )
49
50 # --- sources ---
51
52 # sources / static
53 SET(StudyData_Swig_SOURCES
54   StudyData_Swig.i
55   #${SHAPERSTUDY_Swig_HEADERS}
56 )
57
58 # workaround about SWIG_ADD_MODULE bug: remove duplicates in include directories
59 GET_DIRECTORY_PROPERTY(_cmake_include_directories INCLUDE_DIRECTORIES)
60 LIST(REMOVE_DUPLICATES _cmake_include_directories)
61 SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${_cmake_include_directories}")
62
63 # swig flags
64 SET_SOURCE_FILES_PROPERTIES(StudyData_Swig.i PROPERTIES CPLUSPLUS ON)
65 SET_SOURCE_FILES_PROPERTIES(StudyData_Swig.i PROPERTIES SWIG_FLAGS "-py3")
66 SET_SOURCE_FILES_PROPERTIES(StudyData_swig_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
67
68 # --- scripts ---
69
70 # scripts / swig wrappings
71 SET(_swig_SCRIPTS
72   ${CMAKE_CURRENT_BINARY_DIR}/StudyData_Swig.py 
73 )
74
75 # --- rules ---
76 IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
77   SWIG_ADD_MODULE(StudyData_Swig python ${StudyData_Swig_SOURCES})
78 ELSE()
79   SWIG_ADD_LIBRARY(StudyData_Swig LANGUAGE python SOURCES ${StudyData_Swig_SOURCES})
80 ENDIF()
81
82
83 SWIG_LINK_LIBRARIES(StudyData_Swig ${_link_LIBRARIES})
84 SWIG_CHECK_GENERATION(StudyData_Swig)
85 IF(WIN32)
86   SET_TARGET_PROPERTIES(_StudyData_Swig PROPERTIES DEBUG_OUTPUT_NAME _StudyData_Swig_d)
87 ENDIF(WIN32)
88
89 INSTALL(TARGETS _StudyData_Swig DESTINATION ${SALOME_INSTALL_LIBS})
90
91 INSTALL(FILES ${StudyData_Swig_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
92
93 SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}"  ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_StudyData_Swig_REAL_NAME}")