Commit 13b49046 authored by Ben Boeckel's avatar Ben Boeckel

Examples/GUI: update to the new module system

parent 33819cb6
......@@ -30,6 +30,10 @@ else ()
add_example(Annotation/Cxx/LabeledMesh)
add_example(Charts/Cxx)
add_example(DataManipulation/Cxx)
add_example(GUI/Qt/FourPaneViewer)
add_example(GUI/Qt/GraphicsView)
add_example(GUI/Qt/ImageViewer)
add_example(GUI/Qt/SimpleView)
endif ()
if (FALSE)
......@@ -75,9 +79,6 @@ else()
if(NOT vtkLocalExample_LOADED)
add_subdirectory(Build/vtkLocal)
endif()
if(TARGET vtkGUISupportQt AND vtkTestingCore_LOADED)
add_subdirectory(GUI/Qt)
endif()
endif()
......
if(NOT VTK_LEGACY_REMOVE)
# This example uses a 3DConnexion 3D mouse and Qt4 style widget.
add_subdirectory(Events)
endif()
add_subdirectory(FourPaneViewer)
add_subdirectory(ImageViewer)
add_subdirectory(SimpleView)
if(TARGET vtkGUISupportQtOpenGL)
find_package(Qt5 COMPONENTS WebKitWidgets OpenGLExtensions QUIET)
if(Qt5WebKitWidgets_FOUND AND Qt5OpenGLExtensions_FOUND)
add_subdirectory(GraphicsView)
endif()
endif()
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.ctest.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.ctest" @ONLY)
SET(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"QtCore"
"QtGui"
)
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project(QtVTKRenderWindows)
find_package(VTK COMPONENTS
vtkCommonCore
vtkFiltersSources
vtkGUISupportQt
vtkIOImage
vtkInteractionImage
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
find_package(VTK
COMPONENTS
CommonCore
GUISupportQt
IOImage
ImagingColor
ImagingGeneral
InteractionImage
InteractionStyle
InteractionWidgets)
if (NOT VTK_FOUND)
message("Skipping example: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
find_package(Qt5 COMPONENTS Widgets)
if (NOT TARGET Qt5::Widgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
# Set your files and resources here
set( Srcs QtVTKRenderWindowsApp.cxx QtVTKRenderWindows.cxx)
set(Srcs
QtVTKRenderWindowsApp.cxx
QtVTKRenderWindows.cxx)
set( Hdrs QtVTKRenderWindows.h )
set(Hdrs
QtVTKRenderWindows.h)
set( MOC_Hdrs QtVTKRenderWindows.h )
set( UIs QtVTKRenderWindows.ui )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
set(UIs
QtVTKRenderWindows.ui)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED QUIET)
qt5_wrap_ui(UI_Srcs ${UIs})
set(CMAKE_AUTOUIC ON)
# CMAKE_AUTOMOC in ON so the MocHdrs will be automatically wrapped.
add_executable(QtVTKRenderWindows ${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs})
target_link_libraries(QtVTKRenderWindows Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(QtVTKRenderWindows ${VTK_LIBRARIES})
add_executable(QtVTKRenderWindows
${Srcs} ${Hdrs} ${UIs})
target_link_libraries(QtVTKRenderWindows
PRIVATE
${VTK_LIBRARIES}
Qt5::Widgets)
vtk_module_autoinit(
TARGETS QtVTKRenderWindows
MODULES ${VTK_LIBRARIES})
#include "ui_QtVTKRenderWindows.h"
#include "QtVTKRenderWindows.h"
......
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project( GraphicsView )
find_package(OpenGL)
find_package(VTK COMPONENTS
vtkCommonCore
vtkGUISupportQt
vtkGUISupportQtOpenGL
vtkIOInfovis
vtkViewsInfovis
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
set( Srcs
main.cpp
project(GraphicsView)
find_package(VTK
COMPONENTS
CommonCore
GUISupportQt
GUISupportQtOpenGL
IOInfovis
InfovisCore
ViewsInfovis)
if (NOT VTK_FOUND)
message("Skipping example: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
find_package(Qt5 COMPONENTS WebKitWidgets)
if (NOT TARGET Qt5::WebKitWidgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
set(Srcs
GraphLayoutViewItem.cpp
OpenGLScene.cpp
TreeRingViewItem.cpp
GraphLayoutViewItem.cpp
WebView.cpp
)
main.cpp)
set( Hdrs
set(Hdrs
GraphLayoutViewItem.h
GraphicsView.hpp
OpenGLScene.hpp
QBoolAnimation.h
TreeRingViewItem.h
GraphLayoutViewItem.h
WebView.h
)
set( MOC_Hdrs
OpenGLScene.hpp
QBoolAnimation.h
WebView.h
)
WebView.h)
set( QRCs
GraphicsView.qrc
)
set(QRCs
GraphicsView.qrc)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS WebKitWidgets OpenGLExtensions QUIET)
qt5_add_resources(QRC_Srcs ${QRCs} )
set(CMAKE_AUTORCC ON)
add_executable(qtgraphicsview MACOSX_BUNDLE
${Srcs} ${Hdrs} ${MOC_Hdrs} ${QRC_Srcs})
target_link_libraries(qtgraphicsview Qt5::Core Qt5::Gui Qt5::Widgets
Qt5::WebKit Qt5::WebKitWidgets
Qt5::OpenGL Qt5::OpenGLExtensions)
target_link_libraries(qtgraphicsview ${VTK_LIBRARIES})
${Srcs} ${Hdrs} ${QRCs})
target_link_libraries(qtgraphicsview
PRIVATE
${VTK_LIBRARIES}
Qt5::WebKitWidgets)
vtk_module_autoinit(
TARGETS qtgraphicsview
MODULES ${VTK_LIBRARIES})
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
project(QtImageViewer)
find_package(VTK COMPONENTS
vtkGUISupportQt
vtkIOImage
vtkInteractionImage
vtkRenderingOpenGL2
vtkTestingCore
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
find_package(VTK
COMPONENTS
GUISupportQt
IOImage
InteractionImage
RenderingOpenGL2
TestingCore)
if (NOT VTK_FOUND)
message("Skipping example: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
set( Srcs main.cxx )
find_package(Qt5 COMPONENTS Widgets)
if (NOT TARGET Qt5::Widgets)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
find_package(Qt5 COMPONENTS Core REQUIRED QUIET)
set(Srcs main.cxx)
add_executable(qtimageviewer ${Srcs})
target_link_libraries(qtimageviewer Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(qtimageviewer ${VTK_LIBRARIES})
add_executable(qtimageviewer
${Srcs})
target_link_libraries(qtimageviewer
PRIVATE
${VTK_LIBRARIES}
Qt5::Widgets)
vtk_module_autoinit(
TARGETS qtimageviewer
MODULES ${VTK_LIBRARIES})
......@@ -23,8 +23,8 @@
!!! license.
=========================================================================*/
#include <QApplication>
#include <QSurfaceFormat>
#include <QtWidgets/QApplication>
#include <QtGui/QSurfaceFormat>
#include "vtkGenericOpenGLRenderWindow.h"
#include "vtkImageViewer.h"
......
cmake_minimum_required(VERSION 3.3...3.12 FATAL_ERROR)
foreach(p
CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
endif()
endforeach()
project(SimpleView)
find_package(VTK COMPONENTS
vtkCommonCore
vtkFiltersCore
vtkInfovisCore
vtkInteractionStyle
vtkViewsQt
)
include(${VTK_USE_FILE})
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
find_package(VTK
COMPONENTS
CommonCore
GUISupportQt
InfovisCore
RenderingFreeType
ViewsQt)
if (NOT VTK_FOUND)
message("Skipping example: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
find_package(Qt5 COMPONENTS Widgets Gui)
if (NOT TARGET Qt5::Widgets OR NOT TARGET Qt5::Gui)
message("Skipping example: ${Qt5_NOT_FOUND_MESSAGE}")
return ()
endif ()
# Set your files and resources here
set( Srcs main.cxx SimpleView.cxx )
set( Hdrs SimpleView.h )
set(Srcs
SimpleView.cxx
main.cxx)
set( MOC_Hdrs SimpleView.h )
set(Hdrs
SimpleView.h)
set( UIs SimpleView.ui )
set( QRCs Icons/icons.qrc )
set(UIs
SimpleView.ui)
set(QRCs
Icons/icons.qrc)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# The rest should just work (sure...)
# We have ui files, this will bring in the macro: qt5_wrap_ui
find_package(Qt5 COMPONENTS Widgets REQUIRED QUIET)
qt5_wrap_ui(UI_Srcs ${UIs})
qt5_add_resources(QRC_Srcs ${QRCs} )
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
source_group("Resources" FILES
${UIs}
${QRCs}
${EXE_ICON} # Not present
)
source_group("Generated" FILES
${UI_Srcs}
${MOC_Srcs}
${QRC_Srcs}
)
${QRCs})
add_executable(SimpleView MACOSX_BUNDLE
${Srcs} ${Hdrs} ${UI_Srcs} ${MOC_Hdrs} ${QRC_Srcs})
target_link_libraries(SimpleView Qt5::Core Qt5::Gui Qt5::Widgets)
target_link_libraries(SimpleView ${VTK_LIBRARIES})
${Srcs} ${Hdrs} ${UIs} ${QRCs})
target_link_libraries(SimpleView
PRIVATE
${VTK_LIBRARIES}
Qt5::Gui
Qt5::Widgets)
......@@ -7,8 +7,8 @@
* statement of authorship are reproduced on all copies.
*/
// QT includes
#include <QApplication>
#include <QSurfaceFormat>
#include <QtWidgets/QApplication>
#include <QtGui/QSurfaceFormat>
#include "QVTKOpenGLWidget.h"
#include "SimpleView.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment