Salome HOME
8cd9c647e2071c00206f8b5d8366371b5bd9d185
[modules/shaper.git] / src / PrimitivesAPI / 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   PrimitivesAPI.h
25   PrimitivesAPI_Box.h
26   PrimitivesAPI_Cone.h
27   PrimitivesAPI_Cylinder.h
28   PrimitivesAPI_Sphere.h
29   PrimitivesAPI_Torus.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 )
39
40 SET(PROJECT_LIBRARIES
41   ModelAPI
42   ModelHighAPI
43 )
44
45 INCLUDE_DIRECTORIES(
46   ${PROJECT_SOURCE_DIR}/src/Events
47   ${PROJECT_SOURCE_DIR}/src/ModelAPI
48   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
49 )
50
51 # Plugin headers dependency
52 INCLUDE_DIRECTORIES(
53   ${PROJECT_SOURCE_DIR}/src/GeomAPI
54   ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
55   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
56   ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin
57 )
58
59 ADD_DEFINITIONS(-DPRIMITIVESAPI_EXPORTS ${CAS_DEFINITIONS})
60 ADD_LIBRARY(PrimitivesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
61 TARGET_LINK_LIBRARIES(PrimitivesAPI ${PROJECT_LIBRARIES})
62
63 # SWIG wrapper
64
65 INCLUDE(PythonAPI)
66
67 SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES CPLUSPLUS ON)
68 SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
69
70 SET(SWIG_LINK_LIBRARIES
71   PrimitivesAPI
72   ModelHighAPI
73   ModelAPI
74   ${PYTHON_LIBRARIES}
75 )
76
77 SET(SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS ${SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS}
78   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
79   doxyhelp.i
80   ${PROJECT_HEADERS}
81 )
82
83 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
84   SWIG_ADD_LIBRARY(PrimitivesAPI LANGUAGE python SOURCES PrimitivesAPI.i ${PROJECT_HEADERS})
85 ELSE()
86   SWIG_ADD_MODULE(PrimitivesAPI python PrimitivesAPI.i ${PROJECT_HEADERS})
87 ENDIF()
88 SWIG_LINK_LIBRARIES(PrimitivesAPI ${SWIG_LINK_LIBRARIES})
89
90 IF(WIN32)
91   SET_TARGET_PROPERTIES(_PrimitivesAPI PROPERTIES DEBUG_OUTPUT_NAME _PrimitivesAPI_d)
92 ENDIF(WIN32)
93
94 INSTALL(TARGETS _PrimitivesAPI DESTINATION ${SHAPER_INSTALL_SWIG})
95 INSTALL(TARGETS PrimitivesAPI DESTINATION ${SHAPER_INSTALL_BIN})
96 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PrimitivesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})