1 # Copyright (C) 2014-2023 CEA, EDF
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 INCLUDE(XMLProcessing)
23 FIND_PACKAGE(SWIG REQUIRED)
24 INCLUDE(${SWIG_USE_FILE})
26 INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events
27 ${PYTHON_INCLUDE_DIR})
31 Config_FeatureMessage.h
32 Config_PluginMessage.h
35 Config_FeatureReader.h
39 Config_PointerMessage.h
41 Config_ValidatorMessage.h
44 Config_AttributeMessage.h
45 Config_ValidatorReader.h
46 Config_DataModelReader.h
51 Config_FeatureMessage.cpp
52 Config_PluginMessage.cpp
54 Config_ModuleReader.cpp
55 Config_FeatureReader.cpp
57 Config_WidgetReader.cpp
58 Config_PointerMessage.cpp
60 Config_ValidatorMessage.cpp
62 Config_PropManager.cpp
63 Config_AttributeMessage.cpp
64 Config_ValidatorReader.cpp
65 Config_DataModelReader.cpp
69 SET(CMAKE_SWIG_FLAGS -threads -w321,401)
70 SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES CPLUSPLUS ON)
71 SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
73 ${CMAKE_CURRENT_BINARY_DIR}/ConfigAPI.py
75 SET(SWIG_LINK_LIBRARIES
79 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
80 SWIG_ADD_LIBRARY(ConfigAPI LANGUAGE python SOURCES ConfigAPI.i ${PROJECT_HEADERS})
82 SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS})
84 SWIG_LINK_LIBRARIES(ConfigAPI ${SWIG_LINK_LIBRARIES})
86 SET_TARGET_PROPERTIES(_ConfigAPI PROPERTIES DEBUG_OUTPUT_NAME _ConfigAPI_d)
91 ${CMAKE_CURRENT_BINARY_DIR}/plugins.xml
101 SOURCE_GROUP ("Resource Files" FILES ${XML_RESOURCES})
103 ADD_DEFINITIONS(-DCONFIG_EXPORTS -D_SCL_SECURE_NO_WARNINGS)
104 # -D_SCL_SECURE_NO_WARNINGS - to disable warnings 4996
106 ADD_LIBRARY(Config SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
108 TARGET_LINK_LIBRARIES(Config ${PROJECT_LIBRARIES})
110 # Prepare plugins.xml
112 # the solver to activate after installation
113 SET(DEFAULT_SOLVER "PlaneGCS")
115 # the list of all solvers
116 SET(SOLVERS "SolveSpace" "PlaneGCS")
118 # apply NO_<solver> variables
119 FOREACH(solver IN LISTS SOLVERS)
121 LIST(REMOVE_ITEM SOLVERS ${solver})
125 # check default solver in the list of solvers
126 LIST(FIND SOLVERS ${DEFAULT_SOLVER} INDEX)
127 IF(${INDEX} GREATER -1)
128 MESSAGE(STATUS "Default solver: ${DEFAULT_SOLVER}")
130 MESSAGE(FATAL_ERROR "Default solver: ${DEFAULT_SOLVER} is switched off.\nUnset NO_${DEFAULT_SOLVER} variable or define another default solver DEFAULT_SOLVER=<SOLVER> from the list: ${SOLVERS}.")
133 # prepare variables for configuration
134 SET(DEFAULT_SOLVER " <plugin library=\"${DEFAULT_SOLVER}Solver\"/>")
135 FOREACH(solver IN LISTS SOLVERS)
136 IF(DEFINED ALL_SOLVERS)
137 SET(ALL_SOLVERS "${ALL_SOLVERS}\n")
139 SET(ALL_SOLVERS "${ALL_SOLVERS} <plugin library=\"${solver}Solver\"/>")
144 "${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml.in"
145 "${CMAKE_CURRENT_BINARY_DIR}/plugins.xml"
148 INSTALL(TARGETS Config DESTINATION ${SHAPER_INSTALL_BIN})
149 INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
151 INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG})
152 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
156 ADD_UNIT_TESTS(${TEST_NAMES})
160 set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/Config")
162 install(FILES CTestTestfileInstall.cmake
163 DESTINATION ${TEST_INSTALL_DIRECTORY}
164 RENAME CTestTestfile.cmake)
165 install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
168 foreach(tfile ${TEST_NAMES})
169 list(APPEND TMP_TESTS_NAMES "Test/${tfile}")
170 endforeach(tfile ${TEST_NAMES})
172 install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
173 endif(${HAVE_SALOME})