Salome HOME
updated copyright message
[modules/shaper.git] / src / ConnectorAPI / CMakeLists.txt
1 # Copyright (C) 2014-2023  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(Common)
21
22 SET(PROJECT_HEADERS
23   ConnectorAPI.h
24   ConnectorAPI_Connector.h
25 )
26
27 SET(PROJECT_SOURCES
28   ConnectorAPI_Connector.cpp
29 )
30
31 SET(PROJECT_LIBRARIES
32   ModelAPI
33   ModelHighAPI
34 )
35
36 INCLUDE_DIRECTORIES(
37   ${PROJECT_SOURCE_DIR}/src/Events
38   ${PROJECT_SOURCE_DIR}/src/ModelAPI
39   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
40 )
41
42 # Plugin headers dependency
43 INCLUDE_DIRECTORIES(
44   # TODO(spo): modify ConnectorPlugin headers to remove dependency on GeomAPI headers
45   ${PROJECT_SOURCE_DIR}/src/GeomAPI
46   # TODO(spo): it is for *_swig.h files. Can we eliminate it?
47   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
48   ${PROJECT_SOURCE_DIR}/src/ConnectorPlugin
49 )
50
51 #TODO(spo): is ${OpenCASCADE_DEFINITIONS} necessary?
52 ADD_DEFINITIONS(-DCONNECTORAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
53 ADD_LIBRARY(ConnectorAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
54 TARGET_LINK_LIBRARIES(ConnectorAPI ${PROJECT_LIBRARIES})
55
56 # SWIG wrapper
57
58 INCLUDE(PythonAPI)
59
60 SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES CPLUSPLUS ON)
61 SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
62
63 #TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
64 SET(SWIG_LINK_LIBRARIES
65   ConnectorAPI
66   ModelHighAPI
67   ModelAPI
68   ${PYTHON_LIBRARIES}
69 )
70
71 SET(SWIG_MODULE_ConnectorAPI_EXTRA_DEPS ${SWIG_MODULE_ConnectorAPI_EXTRA_DEPS}
72   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
73   doxyhelp.i
74   ${PROJECT_HEADERS}
75 )
76 SET(CMAKE_SWIG_FLAGS -threads -w325,321,302,362,322,383,403)
77
78 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
79   SWIG_ADD_LIBRARY(ConnectorAPI LANGUAGE python SOURCES ConnectorAPI.i ${PROJECT_HEADERS})
80 ELSE()
81   SWIG_ADD_MODULE(ConnectorAPI python ConnectorAPI.i ${PROJECT_HEADERS})
82 ENDIF()
83 SWIG_LINK_LIBRARIES(ConnectorAPI ${SWIG_LINK_LIBRARIES})
84
85 IF(WIN32)
86   SET_TARGET_PROPERTIES(_ConnectorAPI PROPERTIES DEBUG_OUTPUT_NAME _ConnectorAPI_d)
87 ENDIF(WIN32)
88
89 INSTALL(TARGETS _ConnectorAPI DESTINATION ${SHAPER_INSTALL_SWIG})
90 INSTALL(TARGETS ConnectorAPI DESTINATION ${SHAPER_INSTALL_BIN})
91 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ConnectorAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
92
93 # Tests
94 IF(${HAVE_SALOME})
95   ENABLE_TESTING()
96   ADD_SUBDIRECTORY(Test)
97 ENDIF(${HAVE_SALOME})