]> SALOME platform Git repositories - modules/shaper.git/blob - src/Config/CMakeLists.txt
Salome HOME
Reverted some changes in salome build/run scripts.
[modules/shaper.git] / src / Config / 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 INCLUDE(XMLProcessing)
23 FIND_PACKAGE(SWIG REQUIRED)
24 INCLUDE(${SWIG_USE_FILE})
25
26 INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events
27                      ${PYTHON_INCLUDE_DIR})
28
29 SET(PROJECT_HEADERS
30   Config_def.h
31   Config_FeatureMessage.h
32   Config_PluginMessage.h
33   Config_XMLReader.h
34   Config_ModuleReader.h
35   Config_FeatureReader.h
36   Config_Keywords.h
37   Config_WidgetAPI.h
38   Config_WidgetReader.h
39   Config_PointerMessage.h
40   Config_Common.h
41   Config_ValidatorMessage.h
42   Config_Prop.h
43   Config_PropManager.h
44   Config_AttributeMessage.h
45   Config_ValidatorReader.h
46   Config_DataModelReader.h
47   Config_Translator.h
48  )
49
50 SET(PROJECT_SOURCES
51   Config_FeatureMessage.cpp
52   Config_PluginMessage.cpp
53   Config_XMLReader.cpp
54   Config_ModuleReader.cpp
55   Config_FeatureReader.cpp
56   Config_WidgetAPI.cpp
57   Config_WidgetReader.cpp
58   Config_PointerMessage.cpp
59   Config_Common.cpp
60   Config_ValidatorMessage.cpp
61   Config_Prop.cpp
62   Config_PropManager.cpp
63   Config_AttributeMessage.cpp
64   Config_ValidatorReader.cpp
65   Config_DataModelReader.cpp
66   Config_Translator.cpp
67 )
68
69 SET(CMAKE_SWIG_FLAGS -threads -Wall)
70 SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES CPLUSPLUS ON)
71 SET_SOURCE_FILES_PROPERTIES(ConfigAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
72 SET(SWIG_SCRIPTS
73   ${CMAKE_CURRENT_BINARY_DIR}/ConfigAPI.py
74 )
75 SET(SWIG_LINK_LIBRARIES
76   Config
77   ${PYTHON_LIBRARIES}
78 )
79 IF(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
80   SWIG_ADD_LIBRARY(ConfigAPI LANGUAGE python SOURCES ConfigAPI.i ${PROJECT_HEADERS})
81 ELSE()
82   SWIG_ADD_MODULE(ConfigAPI python ConfigAPI.i ${PROJECT_HEADERS})
83 ENDIF()
84 SWIG_LINK_LIBRARIES(ConfigAPI ${SWIG_LINK_LIBRARIES})
85 IF(WIN32)
86   SET_TARGET_PROPERTIES(_ConfigAPI PROPERTIES DEBUG_OUTPUT_NAME _ConfigAPI_d)
87 ENDIF(WIN32)
88
89
90 SET(XML_RESOURCES
91   ${CMAKE_CURRENT_BINARY_DIR}/plugins.xml
92   dataModel.xml
93 )
94
95 SET(PROJECT_LIBRARIES
96     Events
97     ${LIBXML2_LIBRARIES}
98     ${PYTHON_LIBRARIES}
99 )
100
101 SOURCE_GROUP ("Resource Files" FILES ${XML_RESOURCES})
102
103 ADD_DEFINITIONS(-DCONFIG_EXPORTS -D_SCL_SECURE_NO_WARNINGS)
104 # -D_SCL_SECURE_NO_WARNINGS - to disable warnings 4996
105
106 ADD_LIBRARY(Config SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
107
108 TARGET_LINK_LIBRARIES(Config ${PROJECT_LIBRARIES})
109
110 # Prepare plugins.xml
111
112 # the solver to activate after installation
113 SET(DEFAULT_SOLVER "PlaneGCS")
114
115 # the list of all solvers
116 SET(SOLVERS "SolveSpace" "PlaneGCS")
117
118 # apply NO_<solver> variables
119 FOREACH(solver IN LISTS SOLVERS)
120   IF(NO_${solver})
121     LIST(REMOVE_ITEM SOLVERS ${solver})
122   ENDIF()
123 ENDFOREACH()
124
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}")
129 ELSE()
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}.")
131 ENDIF()
132
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")
138   ENDIF()
139   SET(ALL_SOLVERS "${ALL_SOLVERS}  <plugin library=\"${solver}Solver\"/>")
140 ENDFOREACH()
141
142 # configuration
143 CONFIGURE_FILE(
144   "${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml.in"
145   "${CMAKE_CURRENT_BINARY_DIR}/plugins.xml"
146   )
147
148 INSTALL(TARGETS Config DESTINATION ${SHAPER_INSTALL_BIN})
149 INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
150
151 INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG})
152 INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})