cmake: added VTK_GLOBAL_WARNING_DISPLAY option (default off) for VTK>=9 (https://github.com/introlab/rtabmap_ros/issues/1111)

This commit is contained in:
matlabbe
2024-02-03 17:04:48 -08:00
parent b2a86d640a
commit 1dadd50cf2
3 changed files with 14 additions and 7 deletions
+10 -4
View File
@@ -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)
-3
View File
@@ -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());
+4
View File
@@ -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