Bug#1013190: openems: Migration from vtk7 to vtk9
Francois Mazen
francois at mzf.fr
Sat Jun 18 19:59:29 BST 2022
Package: openems
Severity: wishlist
Tags: patch
X-Debbugs-Cc: francois at mzf.fr
Dear Maintainer,
OpenEMS package depends on vtk7 which is quite old and not maintained upstream.
I've succeeded to build OpenEMS with vtk9 by changing Build-Depends from
libvtk7-dev to libvtk9-dev and fixing CMake and build errors.
The patch is attached to this message.
Could you please update to vtk9?
Thanks,
François
-------------- next part --------------
--- a/openEMS/CMakeLists.txt
+++ b/openEMS/CMakeLists.txt
@@ -122,7 +122,7 @@
)
# vtk
-find_package(VTK COMPONENTS vtkIOXML vtkIOGeometry vtkIOLegacy vtkIOPLY NO_MODULE REQUIRED)
+find_package(VTK COMPONENTS IOXML IOGeometry IOLegacy IOPLY NO_MODULE REQUIRED)
message(STATUS "Found package VTK. Using version " ${VTK_VERSION})
if("${VTK_MAJOR_VERSION}" GREATER 5)
@@ -174,7 +174,7 @@
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
${Boost_LIBRARIES}
- ${vtk_LIBS}
+ ${VTK_LIBRARIES}
${MPI_LIBRARIES}
hdf5_serial_hl
)
--- a/CSXCAD/src/CSPrimPolyhedronReader.cpp
+++ b/CSXCAD/src/CSPrimPolyhedronReader.cpp
@@ -163,7 +163,7 @@
AddVertex(polydata->GetPoint(n));
vtkIdType numP;
- vtkIdType *vertices = new vtkIdType[10];
+ vtkIdType const *vertices = new vtkIdType[10];
while (verts->GetNextCell(numP, vertices))
{
face f;
--- a/QCSXCAD/CMakeLists.txt
+++ b/QCSXCAD/CMakeLists.txt
@@ -6,7 +6,7 @@
SET( CMAKE_BUILD_TYPE Release CACHE STRING "Set to either \"Release\" or \"Debug\"" )
ENDIF()
-PROJECT( QCSXCAD CXX)
+PROJECT( QCSXCAD C CXX)
cmake_minimum_required(VERSION 2.8)
@@ -100,6 +100,8 @@
message(STATUS "Found package VTK. Using version " ${VTK_VERSION})
include(${VTK_USE_FILE})
INCLUDE_DIRECTORIES (${VTK_INCLUDE_DIRS})
+message("VTK_MAJOR_VERSION: ${VTK_MAJOR_VERSION}")
+add_compile_definitions(VTK_MAJOR_VERSION=${VTK_MAJOR_VERSION})
# Qt
SET(RESOURCES resources.qrc)
--- a/QCSXCAD/QCSXCAD.cpp
+++ b/QCSXCAD/QCSXCAD.cpp
@@ -58,7 +58,7 @@
#include "CSPrimWire.h"
#include "CSPrimUserDefined.h"
-#include <QVTKWidget.h>
+#include <QVTKOpenGLNativeWidget.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
--- a/QCSXCAD/QVTKStructure.h
+++ b/QCSXCAD/QVTKStructure.h
@@ -21,7 +21,9 @@
#include <QtGui>
#include "vtkCommand.h"
-#if VTK_MAJOR_VERSION>=8
+#if VTK_MAJOR_VERSION>=9
+ class QVTKOpenGLNativeWidget;
+#elif VTK_MAJOR_VERSION>=8
class QVTKOpenGLWidget;
#else
class QVTKWidget;
@@ -100,7 +102,9 @@
unsigned int uID;
} VTKLayerStruct;
-#if VTK_MAJOR_VERSION>=8
+#if VTK_MAJOR_VERSION>=9
+ QVTKOpenGLNativeWidget *VTKWidget;
+#elif VTK_MAJOR_VERSION>=8
QVTKOpenGLWidget *VTKWidget;
#else
QVTKWidget *VTKWidget;
--- a/QCSXCAD/QVTKStructure.cpp
+++ b/QCSXCAD/QVTKStructure.cpp
@@ -20,7 +20,10 @@
#include "QVTKStructure.h"
#include "vtkCommand.h"
-#if VTK_MAJOR_VERSION>=8
+#if VTK_MAJOR_VERSION>=9
+ #include "QVTKOpenGLNativeWidget.h"
+ #include "vtkGenericOpenGLRenderWindow.h"
+#elif VTK_MAJOR_VERSION>=8
#include "QVTKOpenGLWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#else
@@ -99,7 +102,10 @@
iResolution=32;
AllowUpdate=true;
-#if VTK_MAJOR_VERSION>=8
+#if VTK_MAJOR_VERSION>=9
+ VTKWidget = new QVTKOpenGLNativeWidget();
+ VTKWidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New());
+#elif VTK_MAJOR_VERSION>=8
VTKWidget = new QVTKOpenGLWidget();
VTKWidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New());
#else
--- a/QCSXCAD/export_x3d.cpp
+++ b/QCSXCAD/export_x3d.cpp
@@ -17,7 +17,7 @@
#include <QMessageBox>
-#include <QVTKWidget.h>
+#include <QVTKOpenGLNativeWidget.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
@@ -70,7 +70,7 @@
export_properties( Scene, properties, Material );
// create camera
- vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
+ vtkRendererCollection* collection = ((QVTKOpenGLNativeWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return;
--- a/QCSXCAD/export_pov.cpp
+++ b/QCSXCAD/export_pov.cpp
@@ -18,7 +18,7 @@
#include <QMessageBox>
#include <QtXml>
-#include <QVTKWidget.h>
+#include <QVTKOpenGLNativeWidget.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
@@ -201,7 +201,7 @@
QString export_pov::get_camera()
{
- vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
+ vtkRendererCollection* collection = ((QVTKOpenGLNativeWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return QString();
@@ -231,7 +231,7 @@
QString export_pov::get_light()
{
- vtkRendererCollection* collection = ((QVTKWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
+ vtkRendererCollection* collection = ((QVTKOpenGLNativeWidget*)(m_CSX->StructureVTK->GetVTKWidget()))->GetRenderWindow()->GetRenderers();
vtkRenderer *r = collection->GetFirstRenderer();
if (!r)
return QString();
More information about the debian-science-maintainers
mailing list