From 4308cc476be962b7ef108a3a8747c87a93e613c5 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 16 Jun 2015 11:43:11 +0300 Subject: [PATCH] Detection of OpenGL is mandatory if OCC, VTK or GLviewer support is switched ON (default) --- CMakeLists.txt | 26 +++--- src/CMakeLists.txt | 114 ++++++++++++++----------- src/OCCViewer/CMakeLists.txt | 14 +-- src/OCCViewer/OCCViewer_ViewWindow.cxx | 4 +- src/SVTK/CMakeLists.txt | 15 +--- src/SVTK/SVTK_ViewWindow.cxx | 9 +- 6 files changed, 84 insertions(+), 98 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0fbbaade..2929ce0dc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,29 +133,33 @@ IF(SALOME_GUI_USE_OBSERVERS) ADD_DEFINITIONS(-DWITH_SALOMEDS_OBSERVER) ENDIF() +# Single-study GUI IF(SALOME_USE_SINGLE_DESKTOP) ADD_DEFINITIONS(-DSINGLE_DESKTOP) ENDIF() # OCCT FIND_PACKAGE(SalomeCAS REQUIRED) -IF(NOT SALOME_USE_OCCVIEWER) - ADD_DEFINITIONS("-DDISABLE_OCCVIEWER") + +# OpenGL +IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) + FIND_PACKAGE(SalomeOpenGL REQUIRED) ENDIF() # Qt4 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL) INCLUDE(${QT_USE_FILE}) +# PyQt4 FIND_PACKAGE(SalomePyQt4 REQUIRED) # Optional prerequisites for GUI -IF(SALOME_USE_GLVIEWER) - FIND_PACKAGE(SalomeOpenGL) - SALOME_LOG_OPTIONAL_PACKAGE(OpenGL SALOME_USE_GLVIEWER) -ELSE() +IF(NOT SALOME_USE_GLVIEWER) ADD_DEFINITIONS("-DDISABLE_GLVIEWER") ENDIF() +IF(NOT SALOME_USE_OCCVIEWER) + ADD_DEFINITIONS("-DDISABLE_OCCVIEWER") +ENDIF() IF(SALOME_USE_VTKVIEWER) # Required components are listed in the FindSalomeVTK.cmake file: FIND_PACKAGE(SalomeVTK) @@ -175,15 +179,12 @@ IF (SALOME_USE_PVVIEWER) ELSE() ADD_DEFINITIONS("-DDISABLE_PVVIEWER") ENDIF() - IF (NOT SALOME_USE_GRAPHICSVIEW) ADD_DEFINITIONS("-DDISABLE_GRAPHICSVIEW") ENDIF() - IF (NOT SALOME_USE_PYVIEWER) ADD_DEFINITIONS("-DDISABLE_PYVIEWER") ENDIF() - IF(SALOME_USE_PYCONSOLE) # Build with obsolete Python module's methods ADD_DEFINITIONS(-DCALL_OLD_METHODS) @@ -282,6 +283,11 @@ SET(_${PROJECT_NAME}_exposed_targets ImageComposer ) +IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) + LIST(APPEND _${PROJECT_NAME}_exposed_targets + OpenGLUtils) +ENDIF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) + # SALOME object specific targets: IF(SALOME_USE_SALOMEOBJECT) LIST(APPEND _${PROJECT_NAME}_exposed_targets @@ -291,7 +297,7 @@ ENDIF(SALOME_USE_SALOMEOBJECT) # GL specific targets: IF(SALOME_USE_GLVIEWER) LIST(APPEND _${PROJECT_NAME}_exposed_targets - OpenGLUtils GLViewer) + GLViewer) ENDIF(SALOME_USE_GLVIEWER) # VTK specific targets: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1baf4576..86c9ce7b6 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,33 +20,54 @@ ## # Common packages ## -SET(SUBDIRS_COMMON - CASCatch Qtx HelpBrowser Style DDS QDS ObjBrowser SUIT SUITApp STD CAF - CAM LogWindow Prs Event ViewerData ViewerTools ImageComposer GUI_PY -) +ADD_SUBDIRECTORY(CASCatch) +ADD_SUBDIRECTORY(Qtx) +ADD_SUBDIRECTORY(HelpBrowser) +ADD_SUBDIRECTORY(Style) +ADD_SUBDIRECTORY(DDS) +ADD_SUBDIRECTORY(QDS) +ADD_SUBDIRECTORY(ObjBrowser) +ADD_SUBDIRECTORY(SUIT) +ADD_SUBDIRECTORY(SUITApp) +ADD_SUBDIRECTORY(STD) +ADD_SUBDIRECTORY(CAF) +ADD_SUBDIRECTORY(CAM) +ADD_SUBDIRECTORY(LogWindow) +ADD_SUBDIRECTORY(Prs) +ADD_SUBDIRECTORY(Event) +ADD_SUBDIRECTORY(ViewerData) +ADD_SUBDIRECTORY(ViewerTools) +ADD_SUBDIRECTORY(ImageComposer) +ADD_SUBDIRECTORY(GUI_PY) ## # SALOME object ## IF(SALOME_USE_SALOMEOBJECT) - SET(SUBDIRS_OBJECT OBJECT) + ADD_SUBDIRECTORY(OBJECT) ENDIF(SALOME_USE_SALOMEOBJECT) +## +# OpenGL utils +## +IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) + ADD_SUBDIRECTORY(OpenGLUtils) +ENDIF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER) + ## # GL viewer ## IF(SALOME_USE_GLVIEWER) - SET(SUBDIRS_GLVIEWER OpenGLUtils GLViewer) + ADD_SUBDIRECTORY(GLViewer) ENDIF(SALOME_USE_GLVIEWER) ## # VTK viewer ## IF(SALOME_USE_VTKVIEWER) - SET(SUBDIRS_VTKVIEWER VTKViewer) - + ADD_SUBDIRECTORY(VTKViewer) IF(SALOME_USE_SALOMEOBJECT) - LIST(APPEND SUBDIRS_VTKVIEWER SVTK) + ADD_SUBDIRECTORY(SVTK) ENDIF(SALOME_USE_SALOMEOBJECT) ENDIF(SALOME_USE_VTKVIEWER) @@ -54,10 +75,9 @@ ENDIF(SALOME_USE_VTKVIEWER) # OCC viewer ## IF(SALOME_USE_OCCVIEWER) - SET(SUBDIRS_OCCVIEWER OCCViewer) - + ADD_SUBDIRECTORY(OCCViewer) IF(SALOME_USE_SALOMEOBJECT) - LIST(APPEND SUBDIRS_OCCVIEWER SOCC) + ADD_SUBDIRECTORY(SOCC) ENDIF(SALOME_USE_SALOMEOBJECT) ENDIF(SALOME_USE_OCCVIEWER) @@ -65,10 +85,9 @@ ENDIF(SALOME_USE_OCCVIEWER) # Plot2d viewer ## IF(SALOME_USE_PLOT2DVIEWER) - SET(SUBDIRS_PLOT2DVIEWER Plot2d) - + ADD_SUBDIRECTORY(Plot2d) IF(SALOME_USE_SALOMEOBJECT) - LIST(APPEND SUBDIRS_PLOT2DVIEWER SPlot2d) + ADD_SUBDIRECTORY(SPlot2d) ENDIF(SALOME_USE_SALOMEOBJECT) ENDIF(SALOME_USE_PLOT2DVIEWER) @@ -76,72 +95,63 @@ ENDIF(SALOME_USE_PLOT2DVIEWER) # Qx scene viewer ## IF(SALOME_USE_QXGRAPHVIEWER) - SET(SUBDIRS_QXGRAPHVIEWER QxScene) + ADD_SUBDIRECTORY(QxScene) ENDIF(SALOME_USE_QXGRAPHVIEWER) # Graphics viewer ## IF(SALOME_USE_GRAPHICSVIEW) - SET(SUBDIRS_GRAPHICSVIEW GraphicsView) + ADD_SUBDIRECTORY(GraphicsView) ENDIF(SALOME_USE_GRAPHICSVIEW) # ParaView Viewer IF(SALOME_USE_PVVIEWER) - SET(SUBDIRS_PVVIEWER PVViewer) + ADD_SUBDIRECTORY(PVViewer) ENDIF() ## # Python Viewer ## IF(SALOME_USE_PYVIEWER) - SET(SUBDIRS_PYVIEWER PyEditor PyViewer) + ADD_SUBDIRECTORY(PyEditor) + ADD_SUBDIRECTORY(PyViewer) ENDIF(SALOME_USE_PYVIEWER) ## -# Python-based packages +# Python-based packages, part 1 (generic) ## IF(SALOME_USE_PYCONSOLE) - SET(SUBDIRS_PYCONSOLE PyInterp PyConsole) - SET(SUBDIRS_PYTHON SALOME_PYQT) - IF(SALOME_USE_VTKVIEWER) - LIST(APPEND SUBDIRS_PYTHON SALOME_PY) - ENDIF() - IF(SALOME_USE_SALOMEOBJECT) - LIST(APPEND SUBDIRS_PYTHON SALOME_SWIG) - ENDIF() + ADD_SUBDIRECTORY(PyInterp) + ADD_SUBDIRECTORY(PyConsole) + ADD_SUBDIRECTORY(SALOME_PYQT) ENDIF(SALOME_USE_PYCONSOLE) ## # Light SALOME packages ## -SET(SUBDIRS_LIGHT LightApp ResExporter) +ADD_SUBDIRECTORY(LightApp) +ADD_SUBDIRECTORY(ResExporter) + +## +# Python-based packages, part 2 (LightApp-dependent) +## +IF(SALOME_USE_PYCONSOLE) + IF(SALOME_USE_VTKVIEWER) + ADD_SUBDIRECTORY(SALOME_PY) + ENDIF(SALOME_USE_VTKVIEWER) + IF(SALOME_USE_SALOMEOBJECT) + ADD_SUBDIRECTORY(SALOME_SWIG) + ENDIF(SALOME_USE_VTKVIEWER) +ENDIF(SALOME_USE_PYCONSOLE) ## # Full (CORBA) SALOME packages ## IF(NOT SALOME_LIGHT_ONLY) - SET(SUBDIRS_CORBA TOOLSGUI SalomeApp Session GuiHelpers TreeData) + ADD_SUBDIRECTORY(TOOLSGUI) + ADD_SUBDIRECTORY(SalomeApp) + ADD_SUBDIRECTORY(Session) + ADD_SUBDIRECTORY(GuiHelpers) + ADD_SUBDIRECTORY(TreeData) ENDIF(NOT SALOME_LIGHT_ONLY) - -SET(SUBDIRS - ${SUBDIRS_COMMON} - ${SUBDIRS_OBJECT} - ${SUBDIRS_GLVIEWER} - ${SUBDIRS_VTKVIEWER} - ${SUBDIRS_OCCVIEWER} - ${SUBDIRS_PLOT2DVIEWER} - ${SUBDIRS_QXGRAPHVIEWER} - ${SUBDIRS_PVVIEWER} - ${SUBDIRS_GRAPHICSVIEW} - ${SUBDIRS_PYVIEWER} - ${SUBDIRS_PYCONSOLE} - ${SUBDIRS_LIGHT} - ${SUBDIRS_CORBA} - ${SUBDIRS_PYTHON} -) - -FOREACH(dir ${SUBDIRS}) - ADD_SUBDIRECTORY(${dir}) -ENDFOREACH(dir ${SUBDIRS}) - diff --git a/src/OCCViewer/CMakeLists.txt b/src/OCCViewer/CMakeLists.txt index 17f5c45a8..a69ace133 100755 --- a/src/OCCViewer/CMakeLists.txt +++ b/src/OCCViewer/CMakeLists.txt @@ -35,12 +35,8 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/ViewerData ${PROJECT_SOURCE_DIR}/src/ViewerTools + ${PROJECT_SOURCE_DIR}/src/OpenGLUtils ) -IF(SALOME_USE_GLVIEWER) - INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR}/src/OpenGLUtils - ) -ENDIF() # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) @@ -49,15 +45,9 @@ ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) SET(_link_LIBRARIES ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo} ${CAS_TKTopAlgo} ${CAS_TKG2d} ${CAS_TKOpenGl} - CASCatch qtx suit ViewerTools ViewerData + CASCatch qtx suit ViewerTools ViewerData OpenGLUtils ) -IF(SALOME_USE_GLVIEWER) - LIST(APPEND _link_LIBRARIES - OpenGLUtils - ) -ENDIF() - # --- headers --- # header files / to be processed by moc diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 08f89e269..0599c7534 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -49,9 +49,7 @@ #include #include -#ifndef DISABLE_GLVIEWER - #include -#endif +#include #include #include diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 4f7796dbb..69f99a014 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -34,14 +34,9 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/OBJECT ${PROJECT_SOURCE_DIR}/src/Prs ${PROJECT_SOURCE_DIR}/src/VTKViewer + ${PROJECT_SOURCE_DIR}/src/OpenGLUtils ) -IF(SALOME_USE_GLVIEWER) - INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR}/src/OpenGLUtils - ) -ENDIF() - # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS}) @@ -52,15 +47,9 @@ SET(_link_LIBRARIES ${VTK_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${KERNEL_OpUtil} - qtx suit ViewerTools SalomeObject SalomePrs VTKViewer + qtx suit ViewerTools SalomeObject SalomePrs VTKViewer OpenGLUtils ) -IF(SALOME_USE_GLVIEWER) - LIST(APPEND _link_LIBRARIES - OpenGLUtils - ) -ENDIF() - # --- headers --- # header files / to be processed by moc diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index f8fc7c41d..88bb74354 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -101,10 +101,7 @@ #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" -#ifndef DISABLE_GLVIEWER - #include -#endif - +#include namespace SVTK { @@ -126,10 +123,6 @@ namespace SVTK } } - - - - /*! Constructor */ -- 2.39.2