Skip to content

Commit

Permalink
Merge pull request #1547 from ghutchis/qt6-builds-again
Browse files Browse the repository at this point in the history
Add Qt6 build tests again
  • Loading branch information
ghutchis authored Dec 25, 2023
2 parents 122455a + 0027641 commit 9edc720
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 18 deletions.
151 changes: 151 additions & 0 deletions .github/workflows/build_qt6.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 4 additions & 5 deletions avogadro/qtgui/insertfragmentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

#include <QtCore/QSettings>

#include <QFileSystemModel>
#include <QtCore/QDir>
#include <QtCore/QSortFilterProxyModel>
#include <QtCore/QStandardPaths>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QFileSystemModel>
#include <QtWidgets/QMessageBox>

#include <QCloseEvent>
Expand All @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions avogadro/qtgui/insertfragmentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 4 additions & 3 deletions avogadro/qtgui/sortfiltertreeproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions avogadro/qtplugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/aligntool/aligntool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include <avogadro/rendering/textlabel3d.h>
#include <avogadro/rendering/textproperties.h>

#include <QAction>
#include <QtCore/QDebug>
#include <QtGui/QIcon>
#include <QtGui/QKeyEvent>
#include <QtGui/QMouseEvent>
#include <QtGui/QWheelEvent>
#include <QtWidgets/QAction>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
Expand Down
2 changes: 1 addition & 1 deletion avogadro/qtplugins/forcefield/forcefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <QtCore/QDebug>
#include <QtCore/QSettings>

#include <QtWidgets/QAction>
#include <QAction>
#include <QtWidgets/QMessageBox>

#include <QMutex>
Expand Down
3 changes: 1 addition & 2 deletions avogadro/qtplugins/openbabel/conformersearchdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions avogadro/qtplugins/openbabel/conformersearchdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9edc720

Please sign in to comment.