[arch-commits] Commit in avogadrolibs/repos/extra-x86_64 (4 files)

Antonio Rojas arojas at gemini.archlinux.org
Thu Nov 11 18:49:57 UTC 2021


    Date: Thursday, November 11, 2021 @ 18:49:57
  Author: arojas
Revision: 427900

archrelease: copy trunk to extra-x86_64

Added:
  avogadrolibs/repos/extra-x86_64/PKGBUILD
    (from rev 427899, avogadrolibs/trunk/PKGBUILD)
  avogadrolibs/repos/extra-x86_64/vtk9.patch
    (from rev 427899, avogadrolibs/trunk/vtk9.patch)
Deleted:
  avogadrolibs/repos/extra-x86_64/PKGBUILD
  avogadrolibs/repos/extra-x86_64/vtk9.patch

------------+
 PKGBUILD   |  102 +++++++-----
 vtk9.patch |  484 +++++++++++++++++++++++++++++------------------------------
 2 files changed, 302 insertions(+), 284 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2021-11-11 18:49:42 UTC (rev 427899)
+++ PKGBUILD	2021-11-11 18:49:57 UTC (rev 427900)
@@ -1,42 +0,0 @@
-# Maintainer: Antonio Rojas <arojas at archlinux.org>
-
-pkgname=avogadrolibs
-pkgver=1.95.1
-pkgrel=4
-pkgdesc='Libraries that provide 3D rendering, visualization, analysis and data processing useful in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas'
-arch=(x86_64)
-url='https://www.openchemistry.org/'
-license=(custom)
-depends=(molequeue glew spglib libmsym libarchive hdf5 qt5-svg avogadro-molecules avogadro-crystals)
-makedepends=(cmake eigen boost python mmtf-cpp pybind11 vtk qt5-tools genxrdpattern tbb openmpi)
-optdepends=('vtk: For the Qt plugins')
-source=(https://github.com/OpenChemistry/avogadrolibs/archive/$pkgver/$pkgname-$pkgver.tar.gz
-        vtk9.patch)
-sha256sums=('52817eebfc0cf700e5f6c0c4455b460618ec0dd7cb4ede5d8fabc5a2d73a7816'
-            'a2272c456f1a5dd85bb98fbf5ed9aa5aabaa3fbd8b191bb6d14e6ee57c2789f4')
-
-prepare() {
-  mkdir crystals molecules # Dummy dirs to trick cmake, actually provided by avogadro-molecules and avogadro-crystals
-  patch -d $pkgname-$pkgver -p1 < vtk9.patch # Fix build with VTK 9
-}
-
-build() {
-  cmake -B build -S $pkgname-$pkgver \
-    -DCMAKE_INSTALL_PREFIX=/usr \
-    -DENABLE_TRANSLATIONS=ON \
-    -DUSE_HDF5=ON \
-    -DUSE_VTK=ON \
-    -DUSE_PYTHON=ON \
-    -DUSE_SYSTEM_GENXRDPATTERN=ON
-  cmake --build build
-}
-
-package() {
-  DESTDIR="$pkgdir" cmake --install build
-  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
-
-# Move python module to the correct place
-  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
-  mkdir -p "$pkgdir${site_packages}"
-  mv "$pkgdir"/usr/lib/avogadro "$pkgdir${site_packages}"
-}

Copied: avogadrolibs/repos/extra-x86_64/PKGBUILD (from rev 427899, avogadrolibs/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2021-11-11 18:49:57 UTC (rev 427900)
@@ -0,0 +1,60 @@
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+
+pkgbase=avogadrolibs
+pkgname=(avogadrolibs avogadrolibs-qt5)
+pkgver=1.95.1
+pkgrel=5
+pkgdesc='Libraries that provide 3D rendering, visualization, analysis and data processing useful in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas'
+arch=(x86_64)
+url='https://www.openchemistry.org/'
+license=(custom)
+depends=(molequeue glew spglib hdf5 avogadro-molecules avogadro-crystals)
+makedepends=(cmake eigen boost python mmtf-cpp libmsym pybind11 vtk qt5-tools qt5-svg genxrdpattern tbb openmpi)
+optdepends=('avogadrolibs-qt5: For the VTK and Qt plugins')
+source=(https://github.com/OpenChemistry/avogadrolibs/archive/$pkgver/$pkgname-$pkgver.tar.gz
+        vtk9.patch)
+sha256sums=('52817eebfc0cf700e5f6c0c4455b460618ec0dd7cb4ede5d8fabc5a2d73a7816'
+            'a2272c456f1a5dd85bb98fbf5ed9aa5aabaa3fbd8b191bb6d14e6ee57c2789f4')
+
+prepare() {
+  mkdir crystals molecules # Dummy dirs to trick cmake, actually provided by avogadro-molecules and avogadro-crystals
+  patch -d $pkgname-$pkgver -p1 < vtk9.patch # Fix build with VTK 9
+}
+
+build() {
+  cmake -B build -S $pkgname-$pkgver \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DENABLE_TRANSLATIONS=ON \
+    -DUSE_HDF5=ON \
+    -DUSE_VTK=ON \
+    -DUSE_PYTHON=ON \
+    -DUSE_SYSTEM_GENXRDPATTERN=ON
+  cmake --build build
+}
+
+package_avogadrolibs() {
+  DESTDIR="$pkgdir" cmake --install build
+  rm -r "$pkgdir"/usr/lib/libAvogadroQt* \
+        "$pkgdir"/usr/lib/libAvogadroMoleQueue* \
+        "$pkgdir"/usr/lib/libAvogadroVtk* \
+        "$pkgdir"/usr/include/avogadro/{molequeue,qt*,vtk} \
+        "$pkgdir"/usr/lib/avogadro2/{scripts,staticplugins}
+
+  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
+
+# Move python module to the correct place
+  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
+  mkdir -p "$pkgdir${site_packages}"
+  mv "$pkgdir"/usr/lib/avogadro "$pkgdir${site_packages}"
+}
+
+package_avogadrolibs-qt5() {
+  pkgdesc="Qt 5 modules for Avogadro"
+  depends=(qt5-svg libarchive libmsym avogadrolibs vtk openmpi pugixml fmt tbb)
+
+  DESTDIR="$pkgdir" cmake --install build/avogadro/molequeue
+  DESTDIR="$pkgdir" cmake --install build/avogadro/qtgui
+  DESTDIR="$pkgdir" cmake --install build/avogadro/qtopengl
+  DESTDIR="$pkgdir" cmake --install build/avogadro/qtplugins
+  DESTDIR="$pkgdir" cmake --install build/avogadro/vtk
+}

Deleted: vtk9.patch
===================================================================
--- vtk9.patch	2021-11-11 18:49:42 UTC (rev 427899)
+++ vtk9.patch	2021-11-11 18:49:57 UTC (rev 427900)
@@ -1,242 +0,0 @@
-diff --git a/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp b/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
-index 2ec4ea3a..ff412948 100644
---- a/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
-+++ b/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
-@@ -180,7 +180,7 @@ void ColorOpacityMap::render()
-   auto widget = ActiveObjects::instance().activeWidget();
-   auto vtkWidget = qobject_cast<VTK::vtkGLWidget*>(widget);
-   if (vtkWidget) {
--    vtkWidget->GetRenderWindow()->Render();
-+    vtkWidget->renderWindow()->Render();
-     vtkWidget->update();
-   }
- }
-diff --git a/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp b/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
-index de4c36ad..dc647145 100644
---- a/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
-+++ b/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
-@@ -42,8 +42,8 @@ HistogramWidget::HistogramWidget(QWidget* parent)
-   : QWidget(parent), m_qvtk(new QVTKGLWidget(this))
- {
-   // Set up our little chart.
--  m_histogramView->SetRenderWindow(m_qvtk->GetRenderWindow());
--  m_histogramView->SetInteractor(m_qvtk->GetInteractor());
-+  m_histogramView->SetRenderWindow(m_qvtk->renderWindow());
-+  m_histogramView->SetInteractor(m_qvtk->interactor());
-   m_histogramView->GetScene()->AddItem(m_histogramColorOpacityEditor);
- 
-   // Connect events from the histogram color/opacity editor.
-diff --git a/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp b/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
-index 95afd55c..a8936112 100644
---- a/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
-+++ b/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
-@@ -12,12 +12,12 @@
- namespace Avogadro {
- 
- QVTKGLWidget::QVTKGLWidget(QWidget* parent, Qt::WindowFlags f)
--  : QVTKOpenGLWidget(parent, f)
-+  : QVTKOpenGLStereoWidget(parent, f)
- {
-   // Set some defaults for our render window.
-   vtkNew<vtkGenericOpenGLRenderWindow> window;
--  SetRenderWindow(window);
--  auto glFormat = QVTKOpenGLWidget::defaultFormat();
-+  setRenderWindow(window);
-+  auto glFormat = QVTKOpenGLStereoWidget::defaultFormat();
-   glFormat.setSamples(8);
-   setFormat(glFormat);
- }
-diff --git a/avogadro/qtplugins/coloropacitymap/qvtkwidget.h b/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
-index a3a6ca42..32d43d4a 100644
---- a/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
-+++ b/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
-@@ -4,11 +4,11 @@
- #ifndef AVOGADRO_QTPLUGINS_QVTKGLWidget_H
- #define AVOGADRO_QTPLUGINS_QVTKGLWidget_H
- 
--#include <QVTKOpenGLWidget.h>
-+#include <QVTKOpenGLStereoWidget.h>
- 
- namespace Avogadro {
- 
--class QVTKGLWidget : public QVTKOpenGLWidget
-+class QVTKGLWidget : public QVTKOpenGLStereoWidget
- {
-   Q_OBJECT
- 
-@@ -17,7 +17,7 @@ class QVTKGLWidget : public QVTKOpenGLWidget
-                Qt::WindowFlags f = Qt::WindowFlags());
-   ~QVTKGLWidget() override;
- 
--  void setEnableHiDPI(bool enable) override;
-+  void setEnableHiDPI(bool enable);
- };
- } // namespace Avogadro
- 
-diff --git a/avogadro/vtk/CMakeLists.txt b/avogadro/vtk/CMakeLists.txt
-index 3c567d489..afcf59375 100644
---- a/avogadro/vtk/CMakeLists.txt
-+++ b/avogadro/vtk/CMakeLists.txt
-@@ -11,13 +11,21 @@ endif()
- 
- find_package(Qt5 COMPONENTS Widgets REQUIRED)
- 
-+find_package(VTK QUIET COMPONENTS CommonCore)
-+if(VTK_MAJOR_VERSION GREATER 8)
-+  set(VCP "") # shorthand for VTK_COMPONENT_PREFIX
-+  set(VMP "VTK::") # shorthand for VTK_MODULE_PREFIX
-+else()
-+  set(VCP "vtk")
-+  set(VMP "vtk")
-+  include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
-+endif()
-+
- find_package(VTK
--  COMPONENTS
--    vtkRenderingOpenGL2 vtkGUISupportQt vtkDomainsChemistry
--    vtkRenderingVolumeOpenGL2 vtkViewsCore vtkRenderingFreeType
--    vtkChartsCore vtkViewsContext2D vtkRenderingContextOpenGL2
--  REQUIRED)
--include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
-+  REQUIRED COMPONENTS
-+    ${VCP}RenderingOpenGL2 ${VCP}GUISupportQt ${VCP}DomainsChemistry
-+    ${VCP}RenderingVolumeOpenGL2 ${VCP}ViewsCore ${VCP}RenderingFreeType
-+    ${VCP}ChartsCore ${VCP}ViewsContext2D ${VCP}RenderingContextOpenGL2)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
- 
- set(HEADERS
-@@ -35,6 +43,6 @@ set(SOURCES
- avogadro_add_library(AvogadroVtk ${HEADERS} ${SOURCES})
- set_target_properties(AvogadroVtk PROPERTIES AUTOMOC TRUE)
- target_link_libraries(AvogadroVtk AvogadroRendering AvogadroQtGui
--  vtkRenderingOpenGL2 vtkGUISupportQt vtkRenderingVolumeOpenGL2
--  vtkRenderingFreeType vtkInteractionStyle vtkChartsCore vtkViewsContext2D
--  vtkRenderingContextOpenGL2 vtkDomainsChemistryOpenGL2 Qt5::Widgets)
-+  ${VMP}RenderingOpenGL2 ${VMP}GUISupportQt ${VMP}RenderingVolumeOpenGL2
-+  ${VMP}RenderingFreeType ${VMP}InteractionStyle ${VMP}ChartsCore ${VMP}ViewsContext2D
-+  ${VMP}RenderingContextOpenGL2 ${VMP}DomainsChemistryOpenGL2 Qt5::Widgets)
-diff --git a/avogadro/vtk/vtkglwidget.cpp b/avogadro/vtk/vtkglwidget.cpp
-index 7ce08991..0192a2cf 100644
---- a/avogadro/vtk/vtkglwidget.cpp
-+++ b/avogadro/vtk/vtkglwidget.cpp
-@@ -123,7 +123,7 @@ void vtkGLWidget::cubeVolume(Core::Cube* cube)
- }
- 
- vtkGLWidget::vtkGLWidget(QWidget* p, Qt::WindowFlags f)
--  : QVTKOpenGLWidget(p, f), m_activeTool(nullptr), m_defaultTool(nullptr)
-+  : QVTKOpenGLStereoWidget(p, f), m_activeTool(nullptr), m_defaultTool(nullptr)
- {
-   setFocusPolicy(Qt::ClickFocus);
-   connect(&m_scenePlugins,
-@@ -131,13 +131,13 @@ vtkGLWidget::vtkGLWidget(QWidget* p, Qt::WindowFlags f)
-           SLOT(updateScene()));
- 
-   // Set up our renderer, window, scene, etc.
--  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
--  SetRenderWindow(renderWindow);
--  GetRenderWindow()->AddRenderer(m_vtkRenderer);
--  setFormat(QVTKOpenGLWidget::defaultFormat());
--  vtkNew<vtkInteractorStyleTrackballCamera> interactor;
--  GetInteractor()->SetInteractorStyle(interactor);
--  GetInteractor()->Initialize();
-+  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow_;
-+  setRenderWindow(renderWindow_);
-+  renderWindow()->AddRenderer(m_vtkRenderer);
-+  setFormat(QVTKOpenGLStereoWidget::defaultFormat());
-+  vtkNew<vtkInteractorStyleTrackballCamera> interactor_;
-+  interactor()->SetInteractorStyle(interactor_);
-+  interactor()->Initialize();
-   m_vtkRenderer->SetBackground(1.0, 1.0, 1.0);
- 
-   // m_actor->setScene(&this->renderer().scene());
-@@ -175,7 +175,7 @@ void vtkGLWidget::setMolecule(QtGui::Molecule* mol)
-   updateCube();
-   // Reset the camera, re-render.
-   m_vtkRenderer->ResetCamera();
--  GetRenderWindow()->Render();
-+  renderWindow()->Render();
- }
- 
- void vtkGLWidget::updateCube()
-@@ -205,7 +205,7 @@ void vtkGLWidget::moleculeChanged(unsigned int c)
-   auto changes = static_cast<Molecule::MoleculeChanges>(c);
-   if (changes & Molecule::Added || changes & Molecule::Removed) {
-     updateCube();
--    GetRenderWindow()->Render();
-+    renderWindow()->Render();
-   }
- }
- 
-diff --git a/avogadro/vtk/vtkglwidget.h b/avogadro/vtk/vtkglwidget.h
-index 3c3e6046f..93e2e00e8 100644
---- a/avogadro/vtk/vtkglwidget.h
-+++ b/avogadro/vtk/vtkglwidget.h
-@@ -19,7 +19,7 @@
- 
- #include "avogadrovtkexport.h"
- 
--#include <QVTKOpenGLWidget.h>
-+#include <QVTKOpenGLStereoWidget.h>
- #include <vtkNew.h>
- #include <vtkSmartPointer.h>
- 
-@@ -50,7 +50,7 @@ class ToolPlugin;
- 
- namespace VTK {
- 
--class AVOGADROVTK_EXPORT vtkGLWidget : public QVTKOpenGLWidget
-+class AVOGADROVTK_EXPORT vtkGLWidget : public QVTKOpenGLStereoWidget
- {
-   Q_OBJECT
- 
-diff --git a/avogadro/vtk/vtkplot.cpp b/avogadro/vtk/vtkplot.cpp
-index c76a5bf6..a0ec8f75 100644
---- a/avogadro/vtk/vtkplot.cpp
-+++ b/avogadro/vtk/vtkplot.cpp
-@@ -34,7 +34,7 @@
- #include <vtkTextProperty.h>
- 
- #include <QSurfaceFormat>
--#include <QVTKOpenGLWidget.h>
-+#include <QVTKOpenGLStereoWidget.h>
- 
- #include "vtkplot.h"
- 
-@@ -45,12 +45,12 @@ using std::vector;
- namespace Avogadro {
- namespace VTK {
- 
--VtkPlot::VtkPlot() : m_widget(new QVTKOpenGLWidget)
-+VtkPlot::VtkPlot() : m_widget(new QVTKOpenGLStereoWidget)
- {
--  m_widget->SetRenderWindow(m_renderWindow);
-+  m_widget->setRenderWindow(m_renderWindow);
- 
-   // Set up the view
--  m_widget->setFormat(QVTKOpenGLWidget::defaultFormat());
-+  m_widget->setFormat(QVTKOpenGLStereoWidget::defaultFormat());
-   m_view->SetRenderWindow(m_renderWindow);
-   m_view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
-   m_view->GetRenderWindow()->SetSize(600, 600);
-diff --git a/avogadro/vtk/vtkplot.h b/avogadro/vtk/vtkplot.h
-index ef2150ac4..a39508376 100644
---- a/avogadro/vtk/vtkplot.h
-+++ b/avogadro/vtk/vtkplot.h
-@@ -26,7 +26,7 @@
- #include <string>
- #include <vector>
- 
--class QVTKOpenGLWidget;
-+class QVTKOpenGLStereoWidget;
- class vtkAxis;
- class vtkChartXY;
- class vtkContextView;
-@@ -99,7 +99,7 @@ private:
-   // Get a pointer to a particular axis. Returns nullptr if invalid.
-   vtkAxis* getAxis(Axis axis);
- 
--  std::unique_ptr<QVTKOpenGLWidget> m_widget;
-+  std::unique_ptr<QVTKOpenGLStereoWidget> m_widget;
-   vtkNew<vtkTable> m_table;
-   vtkNew<vtkGenericOpenGLRenderWindow> m_renderWindow;
-   vtkNew<vtkContextView> m_view;

Copied: avogadrolibs/repos/extra-x86_64/vtk9.patch (from rev 427899, avogadrolibs/trunk/vtk9.patch)
===================================================================
--- vtk9.patch	                        (rev 0)
+++ vtk9.patch	2021-11-11 18:49:57 UTC (rev 427900)
@@ -0,0 +1,242 @@
+diff --git a/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp b/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
+index 2ec4ea3a..ff412948 100644
+--- a/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
++++ b/avogadro/qtplugins/coloropacitymap/coloropacitymap.cpp
+@@ -180,7 +180,7 @@ void ColorOpacityMap::render()
+   auto widget = ActiveObjects::instance().activeWidget();
+   auto vtkWidget = qobject_cast<VTK::vtkGLWidget*>(widget);
+   if (vtkWidget) {
+-    vtkWidget->GetRenderWindow()->Render();
++    vtkWidget->renderWindow()->Render();
+     vtkWidget->update();
+   }
+ }
+diff --git a/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp b/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
+index de4c36ad..dc647145 100644
+--- a/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
++++ b/avogadro/qtplugins/coloropacitymap/histogramwidget.cpp
+@@ -42,8 +42,8 @@ HistogramWidget::HistogramWidget(QWidget* parent)
+   : QWidget(parent), m_qvtk(new QVTKGLWidget(this))
+ {
+   // Set up our little chart.
+-  m_histogramView->SetRenderWindow(m_qvtk->GetRenderWindow());
+-  m_histogramView->SetInteractor(m_qvtk->GetInteractor());
++  m_histogramView->SetRenderWindow(m_qvtk->renderWindow());
++  m_histogramView->SetInteractor(m_qvtk->interactor());
+   m_histogramView->GetScene()->AddItem(m_histogramColorOpacityEditor);
+ 
+   // Connect events from the histogram color/opacity editor.
+diff --git a/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp b/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
+index 95afd55c..a8936112 100644
+--- a/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
++++ b/avogadro/qtplugins/coloropacitymap/qvtkwidget.cpp
+@@ -12,12 +12,12 @@
+ namespace Avogadro {
+ 
+ QVTKGLWidget::QVTKGLWidget(QWidget* parent, Qt::WindowFlags f)
+-  : QVTKOpenGLWidget(parent, f)
++  : QVTKOpenGLStereoWidget(parent, f)
+ {
+   // Set some defaults for our render window.
+   vtkNew<vtkGenericOpenGLRenderWindow> window;
+-  SetRenderWindow(window);
+-  auto glFormat = QVTKOpenGLWidget::defaultFormat();
++  setRenderWindow(window);
++  auto glFormat = QVTKOpenGLStereoWidget::defaultFormat();
+   glFormat.setSamples(8);
+   setFormat(glFormat);
+ }
+diff --git a/avogadro/qtplugins/coloropacitymap/qvtkwidget.h b/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
+index a3a6ca42..32d43d4a 100644
+--- a/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
++++ b/avogadro/qtplugins/coloropacitymap/qvtkwidget.h
+@@ -4,11 +4,11 @@
+ #ifndef AVOGADRO_QTPLUGINS_QVTKGLWidget_H
+ #define AVOGADRO_QTPLUGINS_QVTKGLWidget_H
+ 
+-#include <QVTKOpenGLWidget.h>
++#include <QVTKOpenGLStereoWidget.h>
+ 
+ namespace Avogadro {
+ 
+-class QVTKGLWidget : public QVTKOpenGLWidget
++class QVTKGLWidget : public QVTKOpenGLStereoWidget
+ {
+   Q_OBJECT
+ 
+@@ -17,7 +17,7 @@ class QVTKGLWidget : public QVTKOpenGLWidget
+                Qt::WindowFlags f = Qt::WindowFlags());
+   ~QVTKGLWidget() override;
+ 
+-  void setEnableHiDPI(bool enable) override;
++  void setEnableHiDPI(bool enable);
+ };
+ } // namespace Avogadro
+ 
+diff --git a/avogadro/vtk/CMakeLists.txt b/avogadro/vtk/CMakeLists.txt
+index 3c567d489..afcf59375 100644
+--- a/avogadro/vtk/CMakeLists.txt
++++ b/avogadro/vtk/CMakeLists.txt
+@@ -11,13 +11,21 @@ endif()
+ 
+ find_package(Qt5 COMPONENTS Widgets REQUIRED)
+ 
++find_package(VTK QUIET COMPONENTS CommonCore)
++if(VTK_MAJOR_VERSION GREATER 8)
++  set(VCP "") # shorthand for VTK_COMPONENT_PREFIX
++  set(VMP "VTK::") # shorthand for VTK_MODULE_PREFIX
++else()
++  set(VCP "vtk")
++  set(VMP "vtk")
++  include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
++endif()
++
+ find_package(VTK
+-  COMPONENTS
+-    vtkRenderingOpenGL2 vtkGUISupportQt vtkDomainsChemistry
+-    vtkRenderingVolumeOpenGL2 vtkViewsCore vtkRenderingFreeType
+-    vtkChartsCore vtkViewsContext2D vtkRenderingContextOpenGL2
+-  REQUIRED)
+-include_directories(SYSTEM ${VTK_INCLUDE_DIRS})
++  REQUIRED COMPONENTS
++    ${VCP}RenderingOpenGL2 ${VCP}GUISupportQt ${VCP}DomainsChemistry
++    ${VCP}RenderingVolumeOpenGL2 ${VCP}ViewsCore ${VCP}RenderingFreeType
++    ${VCP}ChartsCore ${VCP}ViewsContext2D ${VCP}RenderingContextOpenGL2)
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
+ 
+ set(HEADERS
+@@ -35,6 +43,6 @@ set(SOURCES
+ avogadro_add_library(AvogadroVtk ${HEADERS} ${SOURCES})
+ set_target_properties(AvogadroVtk PROPERTIES AUTOMOC TRUE)
+ target_link_libraries(AvogadroVtk AvogadroRendering AvogadroQtGui
+-  vtkRenderingOpenGL2 vtkGUISupportQt vtkRenderingVolumeOpenGL2
+-  vtkRenderingFreeType vtkInteractionStyle vtkChartsCore vtkViewsContext2D
+-  vtkRenderingContextOpenGL2 vtkDomainsChemistryOpenGL2 Qt5::Widgets)
++  ${VMP}RenderingOpenGL2 ${VMP}GUISupportQt ${VMP}RenderingVolumeOpenGL2
++  ${VMP}RenderingFreeType ${VMP}InteractionStyle ${VMP}ChartsCore ${VMP}ViewsContext2D
++  ${VMP}RenderingContextOpenGL2 ${VMP}DomainsChemistryOpenGL2 Qt5::Widgets)
+diff --git a/avogadro/vtk/vtkglwidget.cpp b/avogadro/vtk/vtkglwidget.cpp
+index 7ce08991..0192a2cf 100644
+--- a/avogadro/vtk/vtkglwidget.cpp
++++ b/avogadro/vtk/vtkglwidget.cpp
+@@ -123,7 +123,7 @@ void vtkGLWidget::cubeVolume(Core::Cube* cube)
+ }
+ 
+ vtkGLWidget::vtkGLWidget(QWidget* p, Qt::WindowFlags f)
+-  : QVTKOpenGLWidget(p, f), m_activeTool(nullptr), m_defaultTool(nullptr)
++  : QVTKOpenGLStereoWidget(p, f), m_activeTool(nullptr), m_defaultTool(nullptr)
+ {
+   setFocusPolicy(Qt::ClickFocus);
+   connect(&m_scenePlugins,
+@@ -131,13 +131,13 @@ vtkGLWidget::vtkGLWidget(QWidget* p, Qt::WindowFlags f)
+           SLOT(updateScene()));
+ 
+   // Set up our renderer, window, scene, etc.
+-  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
+-  SetRenderWindow(renderWindow);
+-  GetRenderWindow()->AddRenderer(m_vtkRenderer);
+-  setFormat(QVTKOpenGLWidget::defaultFormat());
+-  vtkNew<vtkInteractorStyleTrackballCamera> interactor;
+-  GetInteractor()->SetInteractorStyle(interactor);
+-  GetInteractor()->Initialize();
++  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow_;
++  setRenderWindow(renderWindow_);
++  renderWindow()->AddRenderer(m_vtkRenderer);
++  setFormat(QVTKOpenGLStereoWidget::defaultFormat());
++  vtkNew<vtkInteractorStyleTrackballCamera> interactor_;
++  interactor()->SetInteractorStyle(interactor_);
++  interactor()->Initialize();
+   m_vtkRenderer->SetBackground(1.0, 1.0, 1.0);
+ 
+   // m_actor->setScene(&this->renderer().scene());
+@@ -175,7 +175,7 @@ void vtkGLWidget::setMolecule(QtGui::Molecule* mol)
+   updateCube();
+   // Reset the camera, re-render.
+   m_vtkRenderer->ResetCamera();
+-  GetRenderWindow()->Render();
++  renderWindow()->Render();
+ }
+ 
+ void vtkGLWidget::updateCube()
+@@ -205,7 +205,7 @@ void vtkGLWidget::moleculeChanged(unsigned int c)
+   auto changes = static_cast<Molecule::MoleculeChanges>(c);
+   if (changes & Molecule::Added || changes & Molecule::Removed) {
+     updateCube();
+-    GetRenderWindow()->Render();
++    renderWindow()->Render();
+   }
+ }
+ 
+diff --git a/avogadro/vtk/vtkglwidget.h b/avogadro/vtk/vtkglwidget.h
+index 3c3e6046f..93e2e00e8 100644
+--- a/avogadro/vtk/vtkglwidget.h
++++ b/avogadro/vtk/vtkglwidget.h
+@@ -19,7 +19,7 @@
+ 
+ #include "avogadrovtkexport.h"
+ 
+-#include <QVTKOpenGLWidget.h>
++#include <QVTKOpenGLStereoWidget.h>
+ #include <vtkNew.h>
+ #include <vtkSmartPointer.h>
+ 
+@@ -50,7 +50,7 @@ class ToolPlugin;
+ 
+ namespace VTK {
+ 
+-class AVOGADROVTK_EXPORT vtkGLWidget : public QVTKOpenGLWidget
++class AVOGADROVTK_EXPORT vtkGLWidget : public QVTKOpenGLStereoWidget
+ {
+   Q_OBJECT
+ 
+diff --git a/avogadro/vtk/vtkplot.cpp b/avogadro/vtk/vtkplot.cpp
+index c76a5bf6..a0ec8f75 100644
+--- a/avogadro/vtk/vtkplot.cpp
++++ b/avogadro/vtk/vtkplot.cpp
+@@ -34,7 +34,7 @@
+ #include <vtkTextProperty.h>
+ 
+ #include <QSurfaceFormat>
+-#include <QVTKOpenGLWidget.h>
++#include <QVTKOpenGLStereoWidget.h>
+ 
+ #include "vtkplot.h"
+ 
+@@ -45,12 +45,12 @@ using std::vector;
+ namespace Avogadro {
+ namespace VTK {
+ 
+-VtkPlot::VtkPlot() : m_widget(new QVTKOpenGLWidget)
++VtkPlot::VtkPlot() : m_widget(new QVTKOpenGLStereoWidget)
+ {
+-  m_widget->SetRenderWindow(m_renderWindow);
++  m_widget->setRenderWindow(m_renderWindow);
+ 
+   // Set up the view
+-  m_widget->setFormat(QVTKOpenGLWidget::defaultFormat());
++  m_widget->setFormat(QVTKOpenGLStereoWidget::defaultFormat());
+   m_view->SetRenderWindow(m_renderWindow);
+   m_view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
+   m_view->GetRenderWindow()->SetSize(600, 600);
+diff --git a/avogadro/vtk/vtkplot.h b/avogadro/vtk/vtkplot.h
+index ef2150ac4..a39508376 100644
+--- a/avogadro/vtk/vtkplot.h
++++ b/avogadro/vtk/vtkplot.h
+@@ -26,7 +26,7 @@
+ #include <string>
+ #include <vector>
+ 
+-class QVTKOpenGLWidget;
++class QVTKOpenGLStereoWidget;
+ class vtkAxis;
+ class vtkChartXY;
+ class vtkContextView;
+@@ -99,7 +99,7 @@ private:
+   // Get a pointer to a particular axis. Returns nullptr if invalid.
+   vtkAxis* getAxis(Axis axis);
+ 
+-  std::unique_ptr<QVTKOpenGLWidget> m_widget;
++  std::unique_ptr<QVTKOpenGLStereoWidget> m_widget;
+   vtkNew<vtkTable> m_table;
+   vtkNew<vtkGenericOpenGLRenderWindow> m_renderWindow;
+   vtkNew<vtkContextView> m_view;



More information about the arch-commits mailing list