Commit 035ae1d9 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Ben Boeckel

vtkGUISupportQt: update to the new module system

parent 79bb9fea
include(vtkQt)
# set up sources to build
set(QVTKLibSrcs
QFilterTreeProxyModel.cxx
QVTKApplication.cxx
QVTKInteractorAdapter.cxx
QVTKInteractor.cxx
vtkEventQtSlotConnect.cxx
vtkQtAbstractModelAdapter.cxx
vtkQtAnnotationLayersModelAdapter.cxx
vtkQtConnection.cxx
vtkQtDebugLeaksModel.cxx
vtkQtDebugLeaksView.cxx
vtkQtTableModelAdapter.cxx
vtkQtTreeModelAdapter.cxx
QVTKOpenGLNativeWidget.cxx
QVTKOpenGLWidget.cxx
QVTKOpenGLWindow.cxx
)
set(QVTKMocHeaders
QFilterTreeProxyModel.h
QVTKApplication.h
QVTKInteractorAdapter.h
QVTKInteractorInternal.h
vtkQtAbstractModelAdapter.h
vtkQtAnnotationLayersModelAdapter.h
vtkQtConnection.h
vtkQtDebugLeaksModel.h
vtkQtDebugLeaksView.h
vtkQtTableModelAdapter.h
vtkQtTreeModelAdapter.h
QVTKOpenGLNativeWidget.h
QVTKOpenGLWidget.h
QVTKOpenGLWindow.h
)
set(classes
QFilterTreeProxyModel
QVTKApplication
QVTKInteractor
QVTKInteractorAdapter
QVTKOpenGLNativeWidget
QVTKOpenGLWidget
QVTKOpenGLWindow
vtkEventQtSlotConnect
vtkQtAbstractModelAdapter
vtkQtAnnotationLayersModelAdapter
vtkQtConnection
vtkQtDebugLeaksModel
vtkQtDebugLeaksView
vtkQtTableModelAdapter
vtkQtTreeModelAdapter)
set(add_qvtkwidget FALSE)
if(NOT VTK_LEGACY_REMOVE)
if (NOT VTK_LEGACY_REMOVE)
# QVTKWidget and related classes can only be added on Linux when
# X11 support is enabled since it depends on X11.
if(WIN32 OR APPLE OR VTK_USE_X)
list(APPEND QVTKMocHeaders QVTKWidget.h)
list(APPEND QVTKLibSrcs QVTKPaintEngine.cxx QVTKPaintEngine.h QVTKWidget.cxx)
list(APPEND classes
QVTKPaintEngine
QVTKWidget)
set(add_qvtkwidget TRUE)
endif()
endif()
if(VTK_USE_X AND VTK_USE_TDX)
list(APPEND QVTKMocHeaders vtkTDxQtUnixDevices.h)
list(APPEND QVTKLibSrcs vtkTDxQtUnixDevices.cxx)
endif()
if(VTK_USE_X)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
endif()
set(QVTKNonMocHeaders
QVTKWin32Header.h
vtkEventQtSlotConnect.h
QVTKInteractor.h
)
set(qt_component_x11extras)
if(VTK_USE_X)
set(qt_component_x11extras X11Extras)
endif()
find_package(Qt5 COMPONENTS Widgets ${qt_component_x11extras} REQUIRED QUIET)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
if(qt_component_x11extras)
include_directories(${Qt5X11Extras_INCLUDE_DIRS})
add_definitions(${Qt5X11Extras_DEFINITIONS})
endif()
qt5_wrap_cpp(QVTKLibMocSrcs ${QVTKMocHeaders})
set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
set(QT_LIBRARIES_PRIVATE ${Qt5X11Extras_LIBRARIES})
# When this module is loaded by an app, load Qt too.
vtk_module_export_code_find_package(Qt5 COMPONENTS Widgets)
foreach(opt
QT_RCC_EXECUTABLE
QT_MOC_EXECUTABLE
QT_UIC_EXECUTABLE
QT_QMAKE_EXECUTABLE
)
set(VTK_${opt} "${${opt}}")
list(APPEND vtkGUISupportQt_EXPORT_OPTIONS VTK_${opt})
endforeach()
endif ()
endif ()
if (VTK_USE_X AND VTK_USE_TDX)
list(APPEND classes
vtkTDxQtUnixDevices)
endif ()
set(headers
QVTKWin32Header.h)
set(private_headers
QVTKInteractorInternal.h)
set(qt5_components
Widgets)
if (VTK_USE_X)
list(APPEND qt5_components
X11Extras)
endif ()
vtk_module_find_package(
PACKAGE Qt5
COMPONENTS ${qt5_components}
FORWARD_VERSION_REQ MINOR
VERSION_VAR Qt5_VERSION)
set(${vtk-module}_NO_HeaderTest 1)
vtk_module_library(${vtk-module}
${QVTKLibSrcs} ${QVTKLibMocSrcs}
${QVTKNonMocHeaders} ${QVTKMocHeaders}
)
set(CMAKE_AUTOMOC 1)
vtk_module_link_libraries(${vtk-module} LINK_PUBLIC ${QT_LIBRARIES})
if(QT_LIBRARIES_PRIVATE)
vtk_module_link_libraries(${vtk-module} LINK_PRIVATE ${QT_LIBRARIES_PRIVATE})
endif()
vtk_module_add_module(VTK::GUISupportQt
CLASSES ${classes}
HEADERS ${headers}
PRIVATE_HEADERS ${private_headers})
if(VTK_USE_X)
vtk_module_link_libraries(${vtk-module} LINK_PRIVATE ${X11_LIBRARIES})
endif()
vtk_module_link(VTK::GUISupportQt PUBLIC Qt5::Widgets)
if (VTK_USE_X)
vtk_module_link(VTK::GUISupportQt PRIVATE Qt5::X11Extras)
endif ()
# This build plugin logic should just get migrated into a module I think.
cmake_dependent_option(VTK_BUILD_QT_DESIGNER_PLUGIN
......@@ -116,7 +70,7 @@ cmake_dependent_option(VTK_BUILD_QT_DESIGNER_PLUGIN
"BUILD_SHARED_LIBS;NOT VTK_LEGACY_REMOVE;add_qvtkwidget" OFF)
mark_as_advanced(VTK_BUILD_QT_DESIGNER_PLUGIN)
if(VTK_BUILD_QT_DESIGNER_PLUGIN AND add_qvtkwidget)
if (VTK_BUILD_QT_DESIGNER_PLUGIN)
set(PluginLibSrcs Q4VTKWidgetPlugin.cxx)
set(PluginMocHeaders Q4VTKWidgetPlugin.h)
......@@ -126,10 +80,7 @@ if(VTK_BUILD_QT_DESIGNER_PLUGIN AND add_qvtkwidget)
set(qt_component Designer)
endif ()
find_package(Qt5 COMPONENTS ${qt_component} REQUIRED QUIET)
add_definitions(${Qt5${qt_component}_DEFINITIONS})
include_directories(${Qt5${qt_component}_INCLUDE_DIRS})
qt5_wrap_cpp(PluginMocSrcs ${PluginMocHeaders} TARGET QVTKWidgetPlugin)
set(QT_LIBRARIES Qt5::${qt_component})
# add QVTK plugin from sources
# stand-alone as it doesn't depend on QVTK library
......@@ -142,7 +93,7 @@ if(VTK_BUILD_QT_DESIGNER_PLUGIN AND add_qvtkwidget)
set_target_properties(QVTKWidgetPlugin PROPERTIES COMPILE_DEFINITIONS QT_NO_DEBUG)
# link with Qt libs
vtk_module_link_libraries(QVTKWidgetPlugin ${QT_LIBRARIES})
target_link_libraries(QVTKWidgetPlugin Qt5::${qt_component})
# install rules
......@@ -178,10 +129,10 @@ if(VTK_BUILD_QT_DESIGNER_PLUGIN AND add_qvtkwidget)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PluginInstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/PluginInstall.cmake
@ONLY)
set_target_properties(${vtk-module} PROPERTIES POST_INSTALL_SCRIPT
set_target_properties(GUISupportQt PROPERTIES POST_INSTALL_SCRIPT
${CMAKE_CURRENT_BINARY_DIR}/PluginInstall.cmake)
endif()
endif()
endif ()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.ctest.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.ctest" @ONLY)
add_subdirectory(Cxx)
if (VTK_WRAP_PYTHON)
add_subdirectory(Python)
endif ()
include(vtkQt)
include(../../../../CMake/vtkQt.cmake)
vtk_add_test_cxx(vtkGUISupportQtCxxTests tests
NO_VALID
......@@ -28,15 +28,14 @@ if(NOT VTK_LEGACY_REMOVE)
endif()
endif()
find_package(Qt5 COMPONENTS Widgets REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
find_package(Qt5 COMPONENTS Widgets REQUIRED QUIET)
vtk_test_cxx_executable(vtkGUISupportQtCxxTests tests
QTestApp.cxx)
set_target_properties(vtkGUISupportQtCxxTests PROPERTIES
COMPILE_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
target_link_libraries(vtkGUISupportQtCxxTests
PRIVATE
Qt5::Widgets)
set_tests_properties(vtkGUISupportQtCxx-TestQVTKOpenGLWidgetPicking
set_tests_properties(VTK::GUISupportQtCxx-TestQVTKOpenGLWidgetPicking
PROPERTIES RUN_SERIAL ON)
vtk_module(vtkGUISupportQt
GROUPS
Qt
TEST_DEPENDS
vtkTestingCore
vtkTestingRendering
EXCLUDE_FROM_WRAPPING
DEPENDS
vtkCommonCore
vtkRenderingOpenGL2
vtkRenderingCore
PRIVATE_DEPENDS
vtkCommonDataModel
vtkFiltersExtraction
vtkInteractionStyle
)
NAME
VTK::GUISupportQt
LIBRARY_NAME
vtkGUISupportQt
GROUPS
Qt
DEPENDS
VTK::CommonCore
VTK::RenderingCore
VTK::RenderingOpenGL2
PRIVATE_DEPENDS
VTK::CommonDataModel
VTK::FiltersExtraction
VTK::InteractionStyle
TEST_DEPENDS
VTK::FiltersSources
VTK::TestingCore
VTK::TestingRendering
EXCLUDE_WRAP
......@@ -154,3 +154,4 @@ protected:
};
#endif
// VTK-HeaderTest-Exclude: vtkQtAbstractModelAdapter.h
......@@ -110,3 +110,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkQtAnnotationLayersModelAdapter.h
......@@ -98,3 +98,4 @@ class vtkQtConnection : public QObject
};
#endif
// VTK-HeaderTest-Exclude: vtkQtConnection.h
......@@ -96,3 +96,4 @@ protected slots:
#endif
// VTK-HeaderTest-Exclude: vtkQtDebugLeaksModel.h
......@@ -87,3 +87,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkQtDebugLeaksView.h
......@@ -157,3 +157,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkQtTableModelAdapter.h
......@@ -129,3 +129,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkQtTreeModelAdapter.h
......@@ -65,3 +65,4 @@ private:
};
#endif
// VTK-HeaderTest-Exclude: vtkTDxQtUnixDevices.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