]> SALOME platform Git repositories - modules/shaper.git/blob - src/ExchangeAPI/CMakeLists.txt
Salome HOME
[bos #37570] [CEA] SHAPER hdf tests are failing. Fix Sphere feature attributes order.
[modules/shaper.git] / src / ExchangeAPI / 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 INCLUDE(UseQtExt)
22
23 SET(PROJECT_HEADERS
24   ExchangeAPI.h
25   ExchangeAPI_Export.h
26   ExchangeAPI_Import.h
27 )
28
29 SET(PROJECT_SOURCES
30   ExchangeAPI_Export.cpp
31   ExchangeAPI_Import.cpp
32 )
33
34 SET(PROJECT_LIBRARIES
35   Locale
36   ModelAPI
37   ModelHighAPI
38   GeomAlgoAPI
39   ${QT_LIBRARIES}
40 )
41
42 INCLUDE_DIRECTORIES(
43   ${PROJECT_SOURCE_DIR}/src/Events
44   ${PROJECT_SOURCE_DIR}/src/Locale
45   ${PROJECT_SOURCE_DIR}/src/ModelAPI
46   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
47   ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
48   ${QT_INCLUDES}
49 )
50
51 # Plugin headers dependency
52 INCLUDE_DIRECTORIES(
53   # TODO(spo): modify ExchangePlugin headers to remove dependency on GeomAPI headers
54   ${PROJECT_SOURCE_DIR}/src/GeomAPI
55   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
56   ${PROJECT_SOURCE_DIR}/src/ExchangePlugin
57 )
58
59 # additional preprocessor / compiler flags
60 ADD_DEFINITIONS(${QT_DEFINITIONS})
61
62 #TODO(spo): is ${OpenCASCADE_DEFINITIONS} necessary?
63 ADD_DEFINITIONS(-DEXCHANGEAPI_EXPORTS ${OpenCASCADE_DEFINITIONS})
64 ADD_LIBRARY(ExchangeAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
65 TARGET_LINK_LIBRARIES(ExchangeAPI ${PROJECT_LIBRARIES})
66
67 # SWIG wrapper
68
69 INCLUDE(PythonAPI)
70
71 SET(CMAKE_SWIG_FLAGS -threads -w325,321,302,362,322,383,403)
72
73 SET_SOURCE_FILES_PROPERTIES(ExchangeAPI.i PROPERTIES CPLUSPLUS ON)
74 SET_SOURCE_FILES_PROPERTIES(ExchangeAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
75
76 #TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
77 SET(SWIG_LINK_LIBRARIES
78   ExchangeAPI
79   ModelHighAPI
80   ModelAPI
81   ${PYTHON_LIBRARIES}
82 )
83
84 SET(SWIG_MODULE_ExchangeAPI_EXTRA_DEPS ${SWIG_MODULE_ExchangeAPI_EXTRA_DEPS}
85   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
86   doxyhelp.i
87   ${PROJECT_HEADERS}
88 )
89
90 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
91   SWIG_ADD_LIBRARY(ExchangeAPI LANGUAGE python SOURCES ExchangeAPI.i ${PROJECT_HEADERS})
92 ELSE()
93   SWIG_ADD_MODULE(ExchangeAPI python ExchangeAPI.i ${PROJECT_HEADERS})
94 ENDIF()
95 SWIG_LINK_LIBRARIES(ExchangeAPI ${SWIG_LINK_LIBRARIES})
96
97 IF(WIN32)
98   SET_TARGET_PROPERTIES(_ExchangeAPI PROPERTIES DEBUG_OUTPUT_NAME _ExchangeAPI_d)
99 ENDIF(WIN32)
100
101 INSTALL(TARGETS _ExchangeAPI DESTINATION ${SHAPER_INSTALL_SWIG})
102 INSTALL(TARGETS ExchangeAPI DESTINATION ${SHAPER_INSTALL_BIN})
103 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ExchangeAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
104
105 # Tests
106
107 INCLUDE(UnitTest)
108
109 include(tests.set)
110
111 ADD_UNIT_TESTS(${TEST_NAMES})
112
113 if(${HAVE_SALOME})
114   enable_testing()
115   set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ExchangeAPI")
116   
117   install(FILES CTestTestfileInstall.cmake
118   DESTINATION ${TEST_INSTALL_DIRECTORY}
119   RENAME CTestTestfile.cmake)
120   install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
121   
122   set(TMP_TESTS_NAMES)
123   foreach(tfile ${TEST_NAMES})
124     list(APPEND TMP_TESTS_NAMES "Test/${tfile}")
125   endforeach(tfile ${TEST_NAMES})
126   
127   install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
128 endif(${HAVE_SALOME})