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 ELSE(EXISTS ${KERNEL_ROOT_DIR})
45 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
46 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
50 INCLUDE(SalomeSetupPlatform) # From KERNEL
51 # Always build libraries as shared objects:
52 SET(BUILD_SHARED_LIBS TRUE)
54 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
57 # (some options have already been defined in KERNEL)
59 OPTION(SALOME_USE_MPI "Use MPI containers" ${SALOME_USE_MPI})
60 OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ${SALOME_BUILD_DOC})
61 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS})
64 OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" ${SALOME_LIGHT_ONLY})
66 OPTION(SALOME_USE_VTKVIEWER "Enable VTK visualization (Mandatory in classic configurations)" ON)
67 OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON)
68 OPTION(SALOME_USE_OCCVIEWER "Enable OCC visualization (Mandatory in classic configurations)" ON)
69 OPTION(SALOME_USE_GLVIEWER "Enable OpenGL visualization (Mandatory in classic configurations)" ON)
70 OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON)
71 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
72 OPTION(SALOME_USE_SUPERVGRAPHVIEWER "Enable Supervision visualization (Mandatory in classic configurations)" ON)
73 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
75 MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_LIBBATCH SALOME_USE_VTKVIEWER SALOME_USE_VTKVIEWER)
76 MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
77 MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_SUPERVGRAPHVIEWER SALOME_USE_QXGRAPHVIEWER)
81 # Find "big" prerequisites first - they reference themselves many others
82 # -> this can help finding the smaller prerequisites and detect conficts.
83 # In our case KERNEL has already loaded many prereq:
90 FIND_PACKAGE(SalomePython REQUIRED)
91 FIND_PACKAGE(SalomePThread REQUIRED)
92 FIND_PACKAGE(SalomeSWIG REQUIRED)
93 FIND_PACKAGE(SalomeLibXml2 REQUIRED)
94 FIND_PACKAGE(SalomeBoost REQUIRED)
95 FIND_PACKAGE(SalomeHDF5 REQUIRED COMPONENTS C)
97 # Other KERNEL optionals:
99 FIND_PACKAGE(SalomeMPI REQUIRED)
101 SALOME_ADD_MPI_TO_HDF5()
104 IF(NOT SALOME_LIGHT_ONLY)
105 FIND_PACKAGE(SalomeOmniORB REQUIRED)
106 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
108 IF(SALOME_BUILD_TESTS)
110 FIND_PACKAGE(SalomeCppUnit REQUIRED)
113 FIND_PACKAGE(SalomeDoxygen REQUIRED)
114 FIND_PACKAGE(SalomeGraphviz) # Remains optional even here.
115 FIND_PACKAGE(SalomeSphinx REQUIRED)
122 FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4
124 # Build with GUI observers feature
125 ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER)
128 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL)
129 INCLUDE(${QT_USE_FILE})
131 FIND_PACKAGE(SalomePyQt4 REQUIRED)
133 # Optional prerequisites for GUI
134 IF(SALOME_USE_OCCVIEWER)
135 FIND_PACKAGE(SalomeCAS REQUIRED)
137 IF(SALOME_USE_GLVIEWER)
138 FIND_PACKAGE(SalomeOpenGL REQUIRED)
140 IF(SALOME_USE_VTKVIEWER)
141 # Required components are listed in the FindSalomeVTK.cmake file:
142 FIND_PACKAGE(SalomeVTK 6.0 REQUIRED)
144 IF(SALOME_USE_PLOT2DVIEWER)
145 FIND_PACKAGE(SalomeQwt REQUIRED)
149 # (default values taken from KERNEL)
151 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
152 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
153 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
154 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
155 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
156 "Install path: SALOME scripts")
157 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
158 "Install path: SALOME script data")
159 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
160 "Install path: SALOME Python scripts")
161 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
162 "Install path: SALOME application skeleton - scripts")
163 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
164 "Install path: SALOME application skeleton - Python")
165 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
166 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
167 "Install path: SALOME Python shared modules")
168 SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Install path: SALOME CMake files")
169 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
170 "Install path: local SALOME CMake files")
172 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
175 SET(SALOME_GUI_INSTALL_PARAVIEW_LIBS lib/paraview CACHE PATH
176 "Install path: SALOME GUI ParaView libraries")
177 SET(SALOME_GUI_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/gui" CACHE PATH
178 "Install path: SALOME GUI specific data")
179 SET(SALOME_GUI_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/gui" CACHE PATH
180 "Install path: SALOME GUI scripts")
181 SET(SALOME_GUI_INSTALL_PLUGINS share/salome/plugins/gui CACHE PATH
182 "Install path: SALOME GUI plugins")
184 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
185 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
186 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
187 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
188 MARK_AS_ADVANCED(SALOME_GUI_INSTALL_PARAVIEW_LIBS SALOME_GUI_INSTALL_RES_DATA SALOME_GUI_INSTALL_RES_SCRIPTS SALOME_GUI_INSTALL_PLUGINS)
192 IF(NOT SALOME_LIGHT_ONLY)
193 ADD_SUBDIRECTORY(idl)
196 ADD_SUBDIRECTORY(adm_local)
197 ADD_SUBDIRECTORY(resources)
198 ADD_SUBDIRECTORY(src)
199 ADD_SUBDIRECTORY(doc)
200 ADD_SUBDIRECTORY(bin)
201 ADD_SUBDIRECTORY(tools)
203 # Header configuration
204 # ====================
205 SALOME_XVERSION(${PROJECT_NAME})
206 SALOME_CONFIGURE_FILE(GUI_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/GUI_version.h INSTALL ${SALOME_INSTALL_HEADERS})
208 # Configuration export
209 # (here only the level 1 prerequisites are exposed)
210 # ====================
211 INCLUDE(CMakePackageConfigHelpers)
213 # List of targets in this project we want to make visible to the rest of the world.
214 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
215 SET(_${PROJECT_NAME}_exposed_targets
216 caf CAM CASCatch DDS Event GLViewer LightApp LogWindow ObjBrowser
217 OCCViewer OpenGLUtils Plot2d PyConsole PyInterp QDS qtx QxScene SalomeApp
218 SalomeIDLGUI SalomeObject SalomePrs SalomePyQtGUILight SalomePyQtGUI
219 SalomePyQt SalomePy SalomeSession SalomeStyle SOCC SPlot2d std SUITApp suit
220 SUPERVGraph SVTK ToolsGUI ViewerTools VTKViewer vtkTools vtkEDFOverloads SalomeGuiHelpers
224 IF(SALOME_BUILD_TESTS)
225 LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeAppTest)
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(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in
246 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
247 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
248 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE 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}"
259 # PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE 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}")
273 # Install the export set for use with the install-tree
274 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE}"
275 FILE ${PROJECT_NAME}Targets.cmake)