Salome HOME
88fd35809bdb1296dd4834cd6a9f0d81177b2ca0
[modules/shaper.git] / src / ConstructionAPI / 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   ConstructionAPI.h
25   ConstructionAPI_Axis.h
26   ConstructionAPI_Plane.h
27   ConstructionAPI_Point.h
28 )
29
30 SET(PROJECT_SOURCES
31   ConstructionAPI_Axis.cpp
32   ConstructionAPI_Plane.cpp
33   ConstructionAPI_Point.cpp
34 )
35
36 SET(PROJECT_LIBRARIES
37   ModelAPI
38   ModelHighAPI
39 )
40
41 INCLUDE_DIRECTORIES(
42   ${PROJECT_SOURCE_DIR}/src/Events
43   ${PROJECT_SOURCE_DIR}/src/ModelAPI
44   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
45 )
46
47 # Plugin headers dependency
48 INCLUDE_DIRECTORIES(
49   # TODO(spo): modify ConstructionPlugin headers to remove dependency on GeomAPI headers
50   ${PROJECT_SOURCE_DIR}/src/GeomAPI
51   # TODO(spo): it is for *_swig.h files. Can we eliminate it?
52   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
53   ${PROJECT_SOURCE_DIR}/src/ConstructionPlugin
54 )
55
56 #TODO(spo): is ${CAS_DEFINITIONS} necessary?
57 ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
58 ADD_LIBRARY(ConstructionAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
59 TARGET_LINK_LIBRARIES(ConstructionAPI ${PROJECT_LIBRARIES})
60
61 # SWIG wrapper
62
63 INCLUDE(PythonAPI)
64
65 SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES CPLUSPLUS ON)
66 SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
67
68 #TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
69 SET(SWIG_LINK_LIBRARIES
70   ConstructionAPI
71   ModelHighAPI
72   ModelAPI
73   ${PYTHON_LIBRARIES}
74 )
75
76 SET(SWIG_MODULE_ConstructionAPI_EXTRA_DEPS ${SWIG_MODULE_ConstructionAPI_EXTRA_DEPS}
77   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
78   doxyhelp.i
79   ${PROJECT_HEADERS}
80 )
81
82 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
83   SWIG_ADD_LIBRARY(ConstructionAPI LANGUAGE python SOURCES ConstructionAPI.i ${PROJECT_HEADERS})
84 ELSE()
85   SWIG_ADD_MODULE(ConstructionAPI python ConstructionAPI.i ${PROJECT_HEADERS})
86 ENDIF()
87 SWIG_LINK_LIBRARIES(ConstructionAPI ${SWIG_LINK_LIBRARIES})
88
89 IF(WIN32)
90   SET_TARGET_PROPERTIES(_ConstructionAPI PROPERTIES DEBUG_OUTPUT_NAME _ConstructionAPI_d)
91 ENDIF(WIN32)
92
93 INSTALL(TARGETS _ConstructionAPI DESTINATION ${SHAPER_INSTALL_SWIG})
94 INSTALL(TARGETS ConstructionAPI DESTINATION ${SHAPER_INSTALL_BIN})
95 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ConstructionAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
96
97 # Tests
98
99 INCLUDE(UnitTest)
100
101 ADD_UNIT_TESTS(
102   TestPoint.py
103   TestAxis.py
104 )