Salome HOME
[bos #38360] [CEA] improve performances of exportXAO and PublishToStudy
[modules/shaper.git] / src / GeomAPI / CMakeLists.txt
1 # Copyright (C) 2014-2024  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 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_BSpline.h
29     GeomAPI_BSpline2d.h
30     GeomAPI_Circ.h
31     GeomAPI_Circ2d.h
32     GeomAPI_Interface.h
33     GeomAPI_XY.h
34     GeomAPI_XYZ.h
35     GeomAPI_Pnt.h
36     GeomAPI_Pnt2d.h
37     GeomAPI_Lin.h
38     GeomAPI_Lin2d.h
39     GeomAPI_Dir.h
40     GeomAPI_Dir2d.h
41     GeomAPI_Pln.h
42     GeomAPI_Shape.h
43     GeomAPI_ShapeExplorer.h
44     GeomAPI_ShapeIterator.h
45     GeomAPI_Edge.h
46     GeomAPI_Face.h
47     GeomAPI_PlanarEdges.h
48     GeomAPI_AISObject.h
49     GeomAPI_IPresentable.h
50     GeomAPI_Curve.h
51     GeomAPI_DataMapOfShapeMapOfShapes.h
52     GeomAPI_DataMapOfShapeShape.h
53     GeomAPI_IndexedMapOfShape.h
54     GeomAPI_ICustomPrs.h
55     GeomAPI_Vertex.h
56     GeomAPI_Ax1.h
57     GeomAPI_Ax2.h
58     GeomAPI_Ax3.h
59     GeomAPI_Trsf.h
60     GeomAPI_Angle2d.h
61     GeomAPI_Angle.h
62     GeomAPI_Wire.h
63     GeomAPI_Ellipse.h
64     GeomAPI_Ellipse2d.h
65     GeomAPI_Tools.h
66     GeomAPI_Shell.h
67     GeomAPI_Solid.h
68     GeomAPI_Sphere.h
69     GeomAPI_Cylinder.h
70     GeomAPI_Cone.h
71     GeomAPI_Torus.h
72     GeomAPI_Box.h
73     GeomAPI_WireExplorer.h
74     GeomAPI_ShapeHierarchy.h
75 )
76
77 SET(PROJECT_SOURCES
78     GeomAPI_BSpline.cpp
79     GeomAPI_BSpline2d.cpp
80     GeomAPI_Circ.cpp
81     GeomAPI_Circ2d.cpp
82     GeomAPI_Interface.cpp
83     GeomAPI_XY.cpp
84     GeomAPI_XYZ.cpp
85     GeomAPI_Pnt.cpp
86     GeomAPI_Pnt2d.cpp
87     GeomAPI_Lin.cpp
88     GeomAPI_Lin2d.cpp
89     GeomAPI_Dir.cpp
90     GeomAPI_Dir2d.cpp
91     GeomAPI_Pln.cpp
92     GeomAPI_Shape.cpp
93     GeomAPI_ShapeExplorer.cpp
94     GeomAPI_ShapeIterator.cpp
95     GeomAPI_Edge.cpp
96     GeomAPI_Face.cpp
97     GeomAPI_PlanarEdges.cpp
98     GeomAPI_AISObject.cpp
99     GeomAPI_Curve.cpp
100     GeomAPI_DataMapOfShapeMapOfShapes.cpp
101     GeomAPI_DataMapOfShapeShape.cpp
102     GeomAPI_IndexedMapOfShape.cpp
103     GeomAPI_Vertex.cpp
104     GeomAPI_ICustomPrs.cpp
105     GeomAPI_Ax1.cpp
106     GeomAPI_Ax2.cpp
107     GeomAPI_Ax3.cpp
108     GeomAPI_IPresentable.cpp
109     GeomAPI_Trsf.cpp
110     GeomAPI_Angle2d.cpp
111     GeomAPI_Angle.cpp
112     GeomAPI_Wire.cpp
113     GeomAPI_Ellipse.cpp
114     GeomAPI_Ellipse2d.cpp
115     GeomAPI_Tools.cpp
116     GeomAPI_Shell.cpp
117     GeomAPI_Solid.cpp
118     GeomAPI_Sphere.cpp
119     GeomAPI_Cylinder.cpp
120     GeomAPI_Cone.cpp
121     GeomAPI_Torus.cpp
122     GeomAPI_Box.cpp
123     GeomAPI_WireExplorer.cpp
124     GeomAPI_ShapeHierarchy.cpp
125 )
126
127 SET(PROJECT_LIBRARIES
128     ${OpenCASCADE_FoundationClasses_LIBRARIES}
129     ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
130     ${OpenCASCADE_Visualization_LIBRARIES}
131 )
132
133 ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
134 ADD_LIBRARY(GeomAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
135
136 SET(CMAKE_SWIG_FLAGS -threads -w325,321,362,383,512)
137
138 SET_SOURCE_FILES_PROPERTIES(GeomAPI.i PROPERTIES CPLUSPLUS ON)
139 SET_SOURCE_FILES_PROPERTIES(GeomAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
140
141 INCLUDE_DIRECTORIES(
142   ${OpenCASCADE_INCLUDE_DIR}
143 )
144
145 TARGET_LINK_LIBRARIES(GeomAPI ${PROJECT_LIBRARIES})
146
147 SET(SWIG_SCRIPTS
148   ${CMAKE_CURRENT_BINARY_DIR}/GeomAPI.py
149 )
150
151 SET(SWIG_LINK_LIBRARIES
152   GeomAPI
153   ${PYTHON_LIBRARIES}
154 )
155
156 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
157   SWIG_ADD_LIBRARY(GeomAPI LANGUAGE python SOURCES GeomAPI.i ${PROJECT_HEADERS})
158 ELSE()
159   SWIG_ADD_MODULE(GeomAPI python GeomAPI.i ${PROJECT_HEADERS})
160 ENDIF()
161 SWIG_LINK_LIBRARIES(GeomAPI ${SWIG_LINK_LIBRARIES})
162
163 IF(WIN32)
164   SET_TARGET_PROPERTIES(_GeomAPI PROPERTIES DEBUG_OUTPUT_NAME _GeomAPI_d)
165 ENDIF(WIN32)
166
167 INSTALL(TARGETS _GeomAPI DESTINATION ${SHAPER_INSTALL_SWIG})
168 INSTALL(TARGETS GeomAPI DESTINATION ${SHAPER_INSTALL_BIN})
169 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
170
171 include(tests.set)
172
173 ADD_UNIT_TESTS(${TEST_NAMES})
174
175 if(${HAVE_SALOME})
176   enable_testing()
177   set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/GeomAPI")
178   
179   install(FILES CTestTestfileInstall.cmake
180   DESTINATION ${TEST_INSTALL_DIRECTORY}
181   RENAME CTestTestfile.cmake)
182   install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
183   
184   set(TMP_TESTS_NAMES)
185   foreach(tfile ${TEST_NAMES})
186     list(APPEND TMP_TESTS_NAMES "Test/${tfile}")
187   endforeach(tfile ${TEST_NAMES})
188   
189   install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
190 endif(${HAVE_SALOME})