Salome HOME
updated copyright message
[modules/shaper.git] / src / PrimitivesAPI / CMakeLists.txt
1 # Copyright (C) 2014-2023  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 INCLUDE(Common)
21
22 SET(PROJECT_HEADERS
23   PrimitivesAPI.h
24   PrimitivesAPI_Box.h
25   PrimitivesAPI_Cone.h
26   PrimitivesAPI_Cylinder.h
27   PrimitivesAPI_Sphere.h
28   PrimitivesAPI_Torus.h
29   PrimitivesAPI_Tube.h
30 )
31
32 SET(PROJECT_SOURCES
33   PrimitivesAPI_Box.cpp
34   PrimitivesAPI_Cone.cpp
35   PrimitivesAPI_Cylinder.cpp
36   PrimitivesAPI_Sphere.cpp
37   PrimitivesAPI_Torus.cpp
38   PrimitivesAPI_Tube.cpp
39 )
40
41 SET(PROJECT_LIBRARIES
42   ModelAPI
43   ModelHighAPI
44 )
45
46 INCLUDE_DIRECTORIES(
47   ${PROJECT_SOURCE_DIR}/src/Events
48   ${PROJECT_SOURCE_DIR}/src/ModelAPI
49   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
50 )
51
52 # Plugin headers dependency
53 INCLUDE_DIRECTORIES(
54   ${PROJECT_SOURCE_DIR}/src/GeomAPI
55   ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
56   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
57   ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin
58 )
59
60 ADD_DEFINITIONS(-DPRIMITIVESAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
61 ADD_LIBRARY(PrimitivesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
62 TARGET_LINK_LIBRARIES(PrimitivesAPI ${PROJECT_LIBRARIES})
63
64 # SWIG wrapper
65
66 INCLUDE(PythonAPI)
67
68 SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES CPLUSPLUS ON)
69 SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
70
71 SET(SWIG_LINK_LIBRARIES
72   PrimitivesAPI
73   ModelHighAPI
74   ModelAPI
75   ${PYTHON_LIBRARIES}
76 )
77 SET(CMAKE_SWIG_FLAGS -threads -w325,321,302,362,322,383,403)
78
79 SET(SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS ${SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS}
80   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
81   doxyhelp.i
82   ${PROJECT_HEADERS}
83 )
84
85 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
86   SWIG_ADD_LIBRARY(PrimitivesAPI LANGUAGE python SOURCES PrimitivesAPI.i ${PROJECT_HEADERS})
87 ELSE()
88   SWIG_ADD_MODULE(PrimitivesAPI python PrimitivesAPI.i ${PROJECT_HEADERS})
89 ENDIF()
90 SWIG_LINK_LIBRARIES(PrimitivesAPI ${SWIG_LINK_LIBRARIES})
91
92 IF(WIN32)
93   SET_TARGET_PROPERTIES(_PrimitivesAPI PROPERTIES DEBUG_OUTPUT_NAME _PrimitivesAPI_d)
94 ENDIF(WIN32)
95
96 INSTALL(TARGETS _PrimitivesAPI DESTINATION ${SHAPER_INSTALL_SWIG})
97 INSTALL(TARGETS PrimitivesAPI DESTINATION ${SHAPER_INSTALL_BIN})
98 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PrimitivesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})