Salome HOME
0fda17637178a1004ffbafa9f0264a7cca8b87ee
[modules/shaper.git] / src / GeomAPI / CMakeLists.txt
1 # Copyright (C) 2014-2019  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 FIND_PACKAGE(SWIG REQUIRED)
21
22 INCLUDE(${SWIG_USE_FILE})
23 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
24 INCLUDE(UnitTest)
25
26 SET(PROJECT_HEADERS
27     GeomAPI.h
28     GeomAPI_BSpline2d.h
29     GeomAPI_Circ.h
30     GeomAPI_Circ2d.h
31     GeomAPI_Interface.h
32     GeomAPI_XY.h
33     GeomAPI_XYZ.h
34     GeomAPI_Pnt.h
35     GeomAPI_Pnt2d.h
36     GeomAPI_Lin.h
37     GeomAPI_Lin2d.h
38     GeomAPI_Dir.h
39     GeomAPI_Dir2d.h
40     GeomAPI_Pln.h
41     GeomAPI_Shape.h
42     GeomAPI_ShapeExplorer.h
43     GeomAPI_ShapeIterator.h
44     GeomAPI_Edge.h
45     GeomAPI_Face.h
46     GeomAPI_PlanarEdges.h
47     GeomAPI_AISObject.h
48     GeomAPI_IPresentable.h
49     GeomAPI_Curve.h
50     GeomAPI_DataMapOfShapeMapOfShapes.h
51     GeomAPI_DataMapOfShapeShape.h
52     GeomAPI_ICustomPrs.h
53     GeomAPI_Vertex.h
54     GeomAPI_Ax1.h
55     GeomAPI_Ax2.h
56     GeomAPI_Ax3.h
57     GeomAPI_Trsf.h
58     GeomAPI_Angle2d.h
59     GeomAPI_Angle.h
60     GeomAPI_Wire.h
61     GeomAPI_Ellipse.h
62     GeomAPI_Ellipse2d.h
63     GeomAPI_Tools.h
64     GeomAPI_Shell.h
65     GeomAPI_Solid.h
66     GeomAPI_Sphere.h
67     GeomAPI_Cylinder.h
68     GeomAPI_Cone.h
69     GeomAPI_Torus.h
70     GeomAPI_Box.h
71     GeomAPI_WireExplorer.h
72 )
73
74 SET(PROJECT_SOURCES
75     GeomAPI_BSpline2d.cpp
76     GeomAPI_Circ.cpp
77     GeomAPI_Circ2d.cpp
78     GeomAPI_Interface.cpp
79     GeomAPI_XY.cpp
80     GeomAPI_XYZ.cpp
81     GeomAPI_Pnt.cpp
82     GeomAPI_Pnt2d.cpp
83     GeomAPI_Lin.cpp
84     GeomAPI_Lin2d.cpp
85     GeomAPI_Dir.cpp
86     GeomAPI_Dir2d.cpp
87     GeomAPI_Pln.cpp
88     GeomAPI_Shape.cpp
89     GeomAPI_ShapeExplorer.cpp
90     GeomAPI_ShapeIterator.cpp
91     GeomAPI_Edge.cpp
92     GeomAPI_Face.cpp
93     GeomAPI_PlanarEdges.cpp
94     GeomAPI_AISObject.cpp
95     GeomAPI_Curve.cpp
96     GeomAPI_DataMapOfShapeMapOfShapes.cpp
97     GeomAPI_DataMapOfShapeShape.cpp
98     GeomAPI_Vertex.cpp
99     GeomAPI_ICustomPrs.cpp
100     GeomAPI_Ax1.cpp
101     GeomAPI_Ax2.cpp
102     GeomAPI_Ax3.cpp
103     GeomAPI_IPresentable.cpp
104     GeomAPI_Trsf.cpp
105     GeomAPI_Angle2d.cpp
106     GeomAPI_Angle.cpp
107     GeomAPI_Wire.cpp
108     GeomAPI_Ellipse.cpp
109     GeomAPI_Ellipse2d.cpp
110     GeomAPI_Tools.cpp
111     GeomAPI_Shell.cpp
112     GeomAPI_Solid.cpp
113     GeomAPI_Sphere.cpp
114     GeomAPI_Cylinder.cpp
115     GeomAPI_Cone.cpp
116     GeomAPI_Torus.cpp
117     GeomAPI_Box.cpp
118     GeomAPI_WireExplorer.cpp
119 )
120
121 SET(PROJECT_LIBRARIES
122     ${OpenCASCADE_FoundationClasses_LIBRARIES}
123     ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
124     ${OpenCASCADE_Visualization_LIBRARIES}
125 )
126
127 ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
128 ADD_LIBRARY(GeomAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
129
130 SET(CMAKE_SWIG_FLAGS -threads -w325,321,362,383,512)
131
132 SET_SOURCE_FILES_PROPERTIES(GeomAPI.i PROPERTIES CPLUSPLUS ON)
133 SET_SOURCE_FILES_PROPERTIES(GeomAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
134
135 INCLUDE_DIRECTORIES(
136   ${OpenCASCADE_INCLUDE_DIR}
137 )
138
139 TARGET_LINK_LIBRARIES(GeomAPI ${PROJECT_LIBRARIES})
140
141 SET(SWIG_SCRIPTS
142   ${CMAKE_CURRENT_BINARY_DIR}/GeomAPI.py
143 )
144
145 SET(SWIG_LINK_LIBRARIES
146   GeomAPI
147   ${PYTHON_LIBRARIES}
148 )
149
150 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
151   SWIG_ADD_LIBRARY(GeomAPI LANGUAGE python SOURCES GeomAPI.i ${PROJECT_HEADERS})
152 ELSE()
153   SWIG_ADD_MODULE(GeomAPI python GeomAPI.i ${PROJECT_HEADERS})
154 ENDIF()
155 SWIG_LINK_LIBRARIES(GeomAPI ${SWIG_LINK_LIBRARIES})
156
157 IF(WIN32)
158   SET_TARGET_PROPERTIES(_GeomAPI PROPERTIES DEBUG_OUTPUT_NAME _GeomAPI_d)
159 ENDIF(WIN32)
160
161 INSTALL(TARGETS _GeomAPI DESTINATION ${SHAPER_INSTALL_SWIG})
162 INSTALL(TARGETS GeomAPI DESTINATION ${SHAPER_INSTALL_BIN})
163 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
164
165 ADD_UNIT_TESTS(
166   TestAx123.py
167   TestBox.py
168   TestBuilders.py
169   TestCone.py
170   TestCylinder.py
171   TestEllipse2d.py
172   TestLine.py
173   TestPlanarEdge.py
174   TestPolygon.py
175   TestSphere.py
176   TestTorus.py
177   Test2675.py
178   Test2879.py
179 )