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