From 17ed5e751814ef7bba4636afd15d117682e8dc44 Mon Sep 17 00:00:00 2001 From: "Matthew J. Milner" Date: Thu, 16 Nov 2023 16:47:09 +0100 Subject: [PATCH] Fixes so that compiling with Qt5 still works --- avogadro/qtopengl/glwidget.h | 7 ++++++- avogadro/qtplugins/aligntool/CMakeLists.txt | 12 ++++++++++++ avogadro/qtplugins/aligntool/aligntool.cpp | 2 +- avogadro/qtplugins/forcefield/CMakeLists.txt | 12 ++++++++++++ avogadro/qtplugins/forcefield/forcefield.cpp | 2 +- avogadro/qtplugins/svg/CMakeLists.txt | 4 ++++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/avogadro/qtopengl/glwidget.h b/avogadro/qtopengl/glwidget.h index 57c0d94172..a4a10bf289 100644 --- a/avogadro/qtopengl/glwidget.h +++ b/avogadro/qtopengl/glwidget.h @@ -13,7 +13,12 @@ #include #include -#include + +#if QT_VERSION >= 0x060000 + #include +#else + #include +#endif class QTimer; diff --git a/avogadro/qtplugins/aligntool/CMakeLists.txt b/avogadro/qtplugins/aligntool/CMakeLists.txt index f57b31c7df..b4a944cdd5 100644 --- a/avogadro/qtplugins/aligntool/CMakeLists.txt +++ b/avogadro/qtplugins/aligntool/CMakeLists.txt @@ -1,3 +1,9 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 COMPONENTS Gui REQUIRED) +else() + find_package(Qt5 COMPONENTS Widgets REQUIRED) +endif() + set(aligntool_srcs aligntool.cpp ) @@ -21,6 +27,12 @@ avogadro_plugin(AlignTool target_link_libraries(AlignTool PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) +if(QT_VERSION EQUAL 6) + target_link_libraries(AlignTool PRIVATE Qt6::Gui) +else() + target_link_libraries(AlignTool PRIVATE Qt5::Widgets) +endif() + target_include_directories(AlignTool PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../../rendering) diff --git a/avogadro/qtplugins/aligntool/aligntool.cpp b/avogadro/qtplugins/aligntool/aligntool.cpp index 4a1e9cf1b2..c053be68fd 100644 --- a/avogadro/qtplugins/aligntool/aligntool.cpp +++ b/avogadro/qtplugins/aligntool/aligntool.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/avogadro/qtplugins/forcefield/CMakeLists.txt b/avogadro/qtplugins/forcefield/CMakeLists.txt index 62079d56a2..8e5d09cfa7 100644 --- a/avogadro/qtplugins/forcefield/CMakeLists.txt +++ b/avogadro/qtplugins/forcefield/CMakeLists.txt @@ -1,3 +1,9 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 COMPONENTS Gui REQUIRED) +else() + find_package(Qt5 COMPONENTS Widgets REQUIRED) +endif() + set(forcefield_srcs forcefield.cpp forcefielddialog.cpp @@ -16,6 +22,12 @@ avogadro_plugin(Forcefield target_link_libraries(Forcefield PRIVATE Avogadro::Calc) +if(QT_VERSION EQUAL 6) + target_link_libraries(Forcefield PRIVATE Qt6::Gui) +else() + target_link_libraries(Forcefield PRIVATE Qt5::Widgets) +endif() + # Bundled forcefield scripts set(forcefields scripts/ani2x.py diff --git a/avogadro/qtplugins/forcefield/forcefield.cpp b/avogadro/qtplugins/forcefield/forcefield.cpp index 42d8682af4..be099ee970 100644 --- a/avogadro/qtplugins/forcefield/forcefield.cpp +++ b/avogadro/qtplugins/forcefield/forcefield.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/avogadro/qtplugins/svg/CMakeLists.txt b/avogadro/qtplugins/svg/CMakeLists.txt index d3f8c668a3..f1ad4f67e7 100644 --- a/avogadro/qtplugins/svg/CMakeLists.txt +++ b/avogadro/qtplugins/svg/CMakeLists.txt @@ -10,3 +10,7 @@ avogadro_plugin(SVG ) target_link_libraries(SVG PRIVATE Avogadro::QtOpenGL Qt::Svg) + +target_include_directories(SVG + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering) \ No newline at end of file