Skip to content

Commit

Permalink
cmake: added VTK_GLOBAL_WARNING_DISPLAY option (default off) for VTK>…
Browse files Browse the repository at this point in the history
…=9 (#1111)
  • Loading branch information
matlabbe committed Feb 4, 2024
1 parent b2a86d6 commit 9f06c45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,20 @@ SET(ADD_VTK_GUI_SUPPORT_QT_TO_CONF FALSE)
IF(WITH_QT)
FIND_PACKAGE(VTK)
IF(NOT VTK_FOUND)
MESSAGE(FATAL_ERROR "VTK is required when using Qt. Set -DWITH_QT=OFF if you don't want gui tools.")
MESSAGE(FATAL_ERROR "VTK is required when using Qt. Set -DWITH_QT=OFF if you don't want gui tools.")
ENDIF(NOT VTK_FOUND)

# If Qt is here, the GUI will be built
IF(NOT(${VTK_MAJOR_VERSION} LESS 9))
IF(NOT VTK_QT_VERSION)
MESSAGE(FATAL_ERROR "WITH_QT option is ON, but VTK ${VTK_MAJOR_VERSION} has not been built with Qt support, disabling Qt.")
ENDIF()
IF(NOT VTK_QT_VERSION)
MESSAGE(FATAL_ERROR "WITH_QT option is ON, but VTK ${VTK_MAJOR_VERSION} has not been built with Qt support, disabling Qt.")
ENDIF()

option(VTK_GLOBAL_WARNING_DISPLAY "Show VTK warning display on runtime" OFF)
IF(NOT VTK_GLOBAL_WARNING_DISPLAY)
ADD_DEFINITIONS(-DVTK_GLOBAL_WARNING_DISPLAY_OFF)
ENDIF()

MESSAGE(STATUS "VTK>=9 detected, will use VTK_QT_VERSION=${VTK_QT_VERSION} for Qt version.")
IF(${VTK_QT_VERSION} EQUAL 6)
FIND_PACKAGE(Qt6 COMPONENTS Widgets Core Gui OpenGL PrintSupport QUIET OPTIONAL_COMPONENTS Svg)
Expand Down
3 changes: 0 additions & 3 deletions app/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ int main(int argc, char* argv[])
CoInitialize(nullptr);
#endif

#if VTK_MAJOR_VERSION >= 8 && defined(BUILD_AS_BUNDLE)
vtkObject::GlobalWarningDisplayOff();
#endif
#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1)
// needed to ensure appropriate OpenGL context is created for VTK rendering.
QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat());
Expand Down
4 changes: 4 additions & 0 deletions guilib/src/CloudViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ CloudViewer::CloudViewer(QWidget *parent, CloudViewerInteractorStyle * style) :
}
_visualizer->getRenderWindow()->SetNumberOfLayers(4);

#ifdef VTK_GLOBAL_WARNING_DISPLAY_OFF
_visualizer->getRenderWindow()->GlobalWarningDisplayOff();
#endif

#if VTK_MAJOR_VERSION > 8
this->setRenderWindow(_visualizer->getRenderWindow());
#else
Expand Down

0 comments on commit 9f06c45

Please sign in to comment.