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