diff --git a/.github/workflows/build_qt6.yml b/.github/workflows/build_qt6.yml new file mode 100644 index 0000000000..5efb2dccf3 --- /dev/null +++ b/.github/workflows/build_qt6.yml @@ -0,0 +1,151 @@ +name: Qt6 Build Matrix +# Many thanks to Cristian Adam for examples +# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml +# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/ + + +on: [push, pull_request, workflow_dispatch] + +env: + QT_VERSION: 6.5.3 + # this is different from MACOSX_DEPLOYMENT_TARGET to prevent build problems + # we set MACOSX_DEPLOYMENT_TARGET later + MACOS_TARGET: 10.15 + FEATURES: -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DUSE_VTK=ON -DQT_VERSION=6 + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Ubuntu Qt6", artifact: "", + os: ubuntu-latest, + cc: "gcc", cxx: "g++", + build_type: "Release", + cmake_flags: "-G Ninja", + cpack: "", + } + - { + name: "Ubuntu Qt6 AppImage", artifact: "", + os: ubuntu-20.04, + cc: "gcc", cxx: "g++", + build_type: "Release", + cmake_flags: "-G Ninja -DINSTALL_BUNDLE_FILES=ON", + cpack: "", + } + - { + name: "macOS Qt6", artifact: "", + os: macos-latest, + cc: "clang", cxx: "clang++", + build_type: "Release", + cmake_flags: "-G Ninja", + cpack_flags: "-G DragNDrop", + } + - { + name: "Windows Qt6", artifact: "", + os: windows-latest, + cc: "cl", cxx: "cl", + build_type: "Release", + cmake_flags: "", + build_flags: "-j 2", + cpack_flags: "-G NSIS", + } + + steps: + + - name: Install Dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get -qq update + sudo apt-get -qq install ninja-build libeigen3-dev libboost-all-dev libglew-dev libxml2-dev + - name: Install Dependencies (macOS) + if: runner.os == 'macOS' + run: | + if uname -p | grep -q "arm" ; then + export PATH=/opt/homebrew/bin:$PATH + else # not self-hosted runner + brew install ninja eigen glew + fi + - name: Install Dependencies (Windows) + if: runner.os == 'Windows' + run: choco install ninja + + - name: Checkout openchemistry + uses: actions/checkout@v3 + with: + repository: openchemistry/openchemistry + submodules: recursive + + - name: Checkout avogadroapp + uses: actions/checkout@v3 + with: + repository: openchemistry/avogadroapp + path: avogadroapp + + - name: Checkout avogadrolibs + uses: actions/checkout@v3 + with: + path: avogadrolibs + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + cache: true + version: ${{ env.QT_VERSION }} + aqtversion: '==3.1.*' + modules: 'qt5compat' + + - name: Configure MSVC Command Prompt + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Grab cache files + uses: actions/cache@v3 + if: runner.os != 'Windows' + with: + path: | + ${{ runner.workspace }}/build/thirdparty + ${{ runner.workspace }}/build/Downloads + key: ${{ matrix.config.name }}-thirdparty + + - name: Configure + run: | + if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi + cd "${{ runner.workspace }}/build" + # won't have any effect except on Mac + echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV + CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}} + shell: bash + + - name: Build + run: | + CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}} + shell: bash + working-directory: ${{ runner.workspace }}/build + + - name: Run tests + if: matrix.config.os == 'ubuntu-latest' + shell: cmake -P {0} + run: | + include(ProcessorCount) + ProcessorCount(N) + set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") + set(ENV{ASAN_OPTIONS} "new_delete_type_mismatch=0") + execute_process( + COMMAND ctest -j ${N} + WORKING_DIRECTORY ${{ runner.workspace }}/build/avogadrolibs + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Running tests failed!") + endif() + + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 diff --git a/avogadro/qtgui/insertfragmentdialog.cpp b/avogadro/qtgui/insertfragmentdialog.cpp index b1b514c3b0..dfa0856c1a 100644 --- a/avogadro/qtgui/insertfragmentdialog.cpp +++ b/avogadro/qtgui/insertfragmentdialog.cpp @@ -22,11 +22,11 @@ #include +#include #include #include #include #include -#include #include #include @@ -52,8 +52,7 @@ class InsertFragmentDialog::Private } }; -InsertFragmentDialog::InsertFragmentDialog(QWidget* aParent, QString directory, - Qt::WindowFlags) +InsertFragmentDialog::InsertFragmentDialog(QWidget* aParent, QString directory) : QDialog(aParent), m_ui(new Ui::InsertFragmentDialog), m_implementation(new Private) { @@ -213,8 +212,8 @@ void InsertFragmentDialog::filterTextChanged(const QString& newFilter) return; // no dialog or proxy model to set // Allow things like "ti" to match "Ti" etc. - QRegExp reg(newFilter, Qt::CaseInsensitive, QRegExp::WildcardUnix); - m_implementation->proxy->setFilterRegExp(reg); + QRegularExpression reg(newFilter, QRegularExpression::CaseInsensitiveOption); + m_implementation->proxy->setFilterRegularExpression(reg); if (!newFilter.isEmpty()) { // user interface niceness -- show any file match diff --git a/avogadro/qtgui/insertfragmentdialog.h b/avogadro/qtgui/insertfragmentdialog.h index 9655fd3053..a54018e76d 100644 --- a/avogadro/qtgui/insertfragmentdialog.h +++ b/avogadro/qtgui/insertfragmentdialog.h @@ -26,8 +26,7 @@ class AVOGADROQTGUI_EXPORT InsertFragmentDialog : public QDialog public: explicit InsertFragmentDialog(QWidget* parent = nullptr, - QString directory = "molecules", - Qt::WindowFlags f = 0); + QString directory = "molecules"); ~InsertFragmentDialog() override; QString fileName(); diff --git a/avogadro/qtgui/sortfiltertreeproxymodel.cpp b/avogadro/qtgui/sortfiltertreeproxymodel.cpp index 54786153f5..9ee1b02d6b 100644 --- a/avogadro/qtgui/sortfiltertreeproxymodel.cpp +++ b/avogadro/qtgui/sortfiltertreeproxymodel.cpp @@ -35,7 +35,8 @@ bool SortFilterTreeProxyModel::filterAcceptsRow( bool childOfRoot = false; QModelIndex parent = sourceParent; for (int depth = 3; depth > 0; depth--) { - if (sourceModel()->data(parent).toString().contains(filterRegExp())) + if (sourceModel()->data(parent).toString().contains( + filterRegularExpression())) return true; // a parent matches the pattern parent = parent.parent(); @@ -53,7 +54,7 @@ bool SortFilterTreeProxyModel::filterAcceptsRow( // else, sourceParent is a root, so we're good to filter // Check if the data for this row matches. If so, the default is to accept - if (data.contains(filterRegExp())) + if (data.contains(filterRegularExpression())) return true; // Now we have to check the child nodes @@ -67,7 +68,7 @@ bool SortFilterTreeProxyModel::filterAcceptsRow( continue; QString rowData = sourceModel()->data(subRow).toString(); - if (rowData.contains(filterRegExp())) + if (rowData.contains(filterRegularExpression())) return true; } return false; // nothing matched diff --git a/avogadro/qtplugins/CMakeLists.txt b/avogadro/qtplugins/CMakeLists.txt index 4666ea6716..4709d2ff04 100644 --- a/avogadro/qtplugins/CMakeLists.txt +++ b/avogadro/qtplugins/CMakeLists.txt @@ -108,7 +108,6 @@ add_subdirectory(customelements) add_subdirectory(editor) add_subdirectory(fetchpdb) add_subdirectory(focus) -add_subdirectory(forcefield) add_subdirectory(hydrogens) add_subdirectory(importpqr) add_subdirectory(insertdna) @@ -141,6 +140,7 @@ if(QT_VERSION EQUAL 5) add_subdirectory(apbs) add_subdirectory(coordinateeditor) add_subdirectory(cp2kinput) + add_subdirectory(forcefield) add_subdirectory(gamessinput) add_subdirectory(insertfragment) add_subdirectory(molecularproperties) @@ -191,7 +191,7 @@ if (USE_OPENGL) endif() # other optional plugins -if(BUILD_GPL_PLUGINS) +if(BUILD_GPL_PLUGINS AND QT_VERSION EQUAL 5) # qtaimcurvature.h/cpp contains GPL licensed code: add_subdirectory(qtaim) endif() diff --git a/avogadro/qtplugins/aligntool/aligntool.cpp b/avogadro/qtplugins/aligntool/aligntool.cpp index 3f12399de9..18192b77eb 100644 --- a/avogadro/qtplugins/aligntool/aligntool.cpp +++ b/avogadro/qtplugins/aligntool/aligntool.cpp @@ -21,12 +21,12 @@ #include #include +#include #include #include #include #include #include -#include #include #include #include diff --git a/avogadro/qtplugins/forcefield/forcefield.cpp b/avogadro/qtplugins/forcefield/forcefield.cpp index fd12fdfbb0..31c7095ee1 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/openbabel/conformersearchdialog.cpp b/avogadro/qtplugins/openbabel/conformersearchdialog.cpp index af7e0769b9..23b7c13060 100644 --- a/avogadro/qtplugins/openbabel/conformersearchdialog.cpp +++ b/avogadro/qtplugins/openbabel/conformersearchdialog.cpp @@ -11,8 +11,7 @@ namespace Avogadro { -ConformerSearchDialog::ConformerSearchDialog(QWidget* parent, Qt::WindowFlags f) - : QDialog(parent, f) +ConformerSearchDialog::ConformerSearchDialog(QWidget* parent) : QDialog(parent) { ui.setupUi(this); diff --git a/avogadro/qtplugins/openbabel/conformersearchdialog.h b/avogadro/qtplugins/openbabel/conformersearchdialog.h index 82742db83d..c31830bb47 100644 --- a/avogadro/qtplugins/openbabel/conformersearchdialog.h +++ b/avogadro/qtplugins/openbabel/conformersearchdialog.h @@ -17,8 +17,8 @@ class ConformerSearchDialog : public QDialog public: //! Constructor - explicit ConformerSearchDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); - //! Desconstructor + explicit ConformerSearchDialog(QWidget* parent = 0); + //! Deconstructor ~ConformerSearchDialog(); int method();