1 # Copyright (C) 2012-2013 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
20 PROJECT(SalomeGUI C CXX)
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
27 # Project name, upper case
28 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
30 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
31 SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
32 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
33 SET(${PROJECT_NAME_UC}_VERSION
34 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
35 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
39 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
40 IF(EXISTS ${KERNEL_ROOT_DIR})
41 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
43 FIND_PACKAGE(SalomeKERNEL REQUIRED)
44 ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
45 INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
46 ELSE(EXISTS ${KERNEL_ROOT_DIR})
47 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
48 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
52 INCLUDE(SalomeSetupPlatform) # From KERNEL
53 # Always build libraries as shared objects:
54 SET(BUILD_SHARED_LIBS TRUE)
56 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
59 # (some options have already been defined in KERNEL)
61 OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ${SALOME_BUILD_DOC})
62 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS})
65 OPTION(SALOME_USE_VTKVIEWER "Enable VTK visualization (Mandatory in classic configurations)" ON)
66 OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON)
67 OPTION(SALOME_USE_OCCVIEWER "Enable OCC visualization (Mandatory in classic configurations)" ON)
68 OPTION(SALOME_USE_GLVIEWER "Enable OpenGL visualization (Mandatory in classic configurations)" ON)
69 OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON)
70 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
71 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
73 MARK_AS_ADVANCED(SALOME_USE_VTKVIEWER SALOME_USE_VTKVIEWER)
74 MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
75 MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER)
79 # Find "big" prerequisites first - they reference themselves many others
80 # -> this can help finding the smaller prerequisites and detect conficts.
81 # In our case KERNEL has already loaded many prereq which are also used in GUI:
88 FIND_PACKAGE(SalomePython REQUIRED)
89 FIND_PACKAGE(SalomePThread REQUIRED)
90 FIND_PACKAGE(SalomeSWIG REQUIRED)
91 FIND_PACKAGE(SalomeLibXml2 REQUIRED)
92 FIND_PACKAGE(SalomeBoost REQUIRED)
93 FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
95 # Other KERNEL optionals:
96 IF(NOT SALOME_LIGHT_ONLY)
97 FIND_PACKAGE(SalomeOmniORB REQUIRED)
98 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
100 IF(SALOME_BUILD_TESTS)
102 FIND_PACKAGE(SalomeCppUnit)
103 SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
106 FIND_PACKAGE(SalomeDoxygen)
107 FIND_PACKAGE(SalomeGraphviz)
108 FIND_PACKAGE(SalomeSphinx)
109 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
110 SALOME_LOG_OPTIONAL_PACKAGE(Graphviz SALOME_BUILD_DOC)
111 SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
118 FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4
120 # Build with GUI observers feature
121 ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER)
124 FIND_PACKAGE(SalomeCAS REQUIRED)
127 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL)
128 INCLUDE(${QT_USE_FILE})
130 FIND_PACKAGE(SalomePyQt4 REQUIRED)
132 # Optional prerequisites for GUI
133 IF(SALOME_USE_GLVIEWER)
134 FIND_PACKAGE(SalomeOpenGL)
135 SALOME_LOG_OPTIONAL_PACKAGE(OpenGL SALOME_USE_GLVIEWER)
137 IF(SALOME_USE_VTKVIEWER)
138 # Required components are listed in the FindSalomeVTK.cmake file:
139 FIND_PACKAGE(SalomeVTK 6.0)
140 SALOME_LOG_OPTIONAL_PACKAGE(VTK SALOME_USE_VTKVIEWER)
142 IF(SALOME_USE_PLOT2DVIEWER)
143 FIND_PACKAGE(SalomeQwt)
144 SALOME_LOG_OPTIONAL_PACKAGE(Qwt SALOME_USE_PLOT2DVIEWER)
148 SALOME_PACKAGE_REPORT_AND_CHECK()
151 # (default values taken from KERNEL)
153 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
154 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
155 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
156 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
157 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
158 "Install path: SALOME scripts")
159 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
160 "Install path: SALOME script data")
161 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
162 "Install path: SALOME Python scripts")
163 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
164 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
165 "Install path: SALOME Python shared modules")
166 SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Install path: SALOME CMake files")
167 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
168 "Install path: local SALOME CMake files")
169 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
170 "Install path: local SALOME config files (obsolete, to be removed)")
172 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
173 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
176 SET(SALOME_GUI_INSTALL_PARAVIEW_LIBS lib/paraview CACHE PATH
177 "Install path: SALOME GUI ParaView libraries")
178 SET(SALOME_GUI_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/gui" CACHE PATH
179 "Install path: SALOME GUI specific data")
180 SET(SALOME_GUI_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/gui" CACHE PATH
181 "Install path: SALOME GUI scripts")
182 SET(SALOME_GUI_INSTALL_PLUGINS share/salome/plugins/gui CACHE PATH
183 "Install path: SALOME GUI plugins")
185 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
186 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
187 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
188 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
189 MARK_AS_ADVANCED(SALOME_GUI_INSTALL_PARAVIEW_LIBS SALOME_GUI_INSTALL_RES_DATA SALOME_GUI_INSTALL_RES_SCRIPTS SALOME_GUI_INSTALL_PLUGINS)
190 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
194 IF(NOT SALOME_LIGHT_ONLY)
195 ADD_SUBDIRECTORY(idl)
198 ADD_SUBDIRECTORY(adm_local)
199 ADD_SUBDIRECTORY(resources)
200 ADD_SUBDIRECTORY(src)
202 ADD_SUBDIRECTORY(doc)
204 ADD_SUBDIRECTORY(bin)
205 ADD_SUBDIRECTORY(tools)
207 # Header configuration
208 # ====================
209 SALOME_XVERSION(${PROJECT_NAME})
210 SALOME_CONFIGURE_FILE(GUI_version.h.in GUI_version.h INSTALL ${SALOME_INSTALL_HEADERS})
212 # Configuration export
213 # (here only the level 1 prerequisites are exposed)
214 # ====================
215 INCLUDE(CMakePackageConfigHelpers)
217 # List of targets in this project we want to make visible to the rest of the world.
218 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
219 SET(_${PROJECT_NAME}_exposed_targets
220 caf CAM CASCatch DDS Event GLViewer LightApp LogWindow ObjBrowser
221 OCCViewer OpenGLUtils Plot2d PyConsole PyInterp QDS qtx QxScene SalomeApp
222 SalomeIDLGUI SalomeObject SalomePrs SalomePyQtGUILight SalomePyQtGUI
223 SalomePyQt SalomePy SalomeSession SalomeStyle SOCC SPlot2d std SUITApp suit
224 SVTK ToolsGUI ViewerTools VTKViewer vtkTools vtkEDFOverloads SalomeGuiHelpers
228 # Add all targets to the build-tree export set
229 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
230 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
232 # Create the configuration files:
233 # - in the build tree:
235 # Ensure the variables are always defined for the configure:
236 SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
237 SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
238 SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}")
239 SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
240 SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}")
241 SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
242 SET(QWT_ROOT_DIR "${QWT_ROOT_DIR}")
244 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
245 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
246 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
247 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
248 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
249 KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR
250 OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
252 # - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
253 # Get the relative path of the include directory so
254 # we can register it in the generated configuration files:
255 #SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
256 #CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in
257 # ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
258 # INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
259 # PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
260 # KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR
261 # OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
263 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
264 VERSION ${${PROJECT_NAME_UC}_VERSION}
265 COMPATIBILITY AnyNewerVersion)
267 # Install the CMake configuration files:
269 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
270 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
271 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
273 # Install the export set for use with the install-tree
274 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
275 FILE ${PROJECT_NAME}Targets.cmake)