From b40354c7f28676d011de35e49b178d9aa789bbc7 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Jan 2021 12:53:27 -0800 Subject: [PATCH] build-system: compile stats code on mobile OSs Android and iOS use qmake, so add the code to the .pro file. This also removes all remnants of QCharts includes and uses and all the references to QCharts in our various build systems. That was a brief but extremely useful detour. Signed-off-by: Dirk Hohndel --- .github/workflows/codeql-analysis.yml | 4 +-- .github/workflows/coverity-scan.yml | 3 +- .github/workflows/linux-bionic-5.9.yml | 3 +- .github/workflows/linux-focal-5.12.yml | 3 +- .github/workflows/linux-groovy-5.14.yml | 3 +- .../workflows/linux-tumbleweed-qt-latest.yml | 3 +- CMakeLists.txt | 3 +- INSTALL | 2 +- Subsurface-mobile.pro | 30 +++++++++++++++++++ packaging/OBS/subsurfacedaily.spec | 2 -- packaging/android/android-build-setup.sh | 2 +- packaging/ubuntu/debian/control | 2 -- packaging/windows/mxe-based-build.sh | 1 - .../docker/mxe-build-container/settings.mk | 1 - scripts/docker/trusty-qt512/Dockerfile | 2 +- stats/barseries.cpp | 1 - stats/boxseries.cpp | 1 - stats/informationbox.cpp | 1 - stats/pieseries.cpp | 1 - stats/scatterseries.cpp | 1 - stats/statsaxis.cpp | 2 -- stats/statsaxis.h | 3 -- stats/statsgrid.cpp | 1 - 23 files changed, 40 insertions(+), 35 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7840c7a43..f48697cfa 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -47,9 +47,7 @@ jobs: qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \ qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \ qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \ - qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \ - libqt5charts5-dev qml-module-qtcharts - + qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml index 482581738..bec98386d 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity-scan.yml @@ -26,8 +26,7 @@ jobs: qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \ qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \ qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \ - qtquickcontrols2-5-dev libbluetooth-dev libmtp-dev \ - libqt5charts5-dev qml-module-qtcharts + qtquickcontrols2-5-dev libbluetooth-dev libmtp-dev - name: Download Coverity Build Tool run: | diff --git a/.github/workflows/linux-bionic-5.9.yml b/.github/workflows/linux-bionic-5.9.yml index 910ecdefb..9c845772a 100644 --- a/.github/workflows/linux-bionic-5.9.yml +++ b/.github/workflows/linux-bionic-5.9.yml @@ -29,8 +29,7 @@ jobs: qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \ qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \ qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \ - qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \ - libqt5charts5-dev qml-module-qtcharts + qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev - name: build Subsurface run: | diff --git a/.github/workflows/linux-focal-5.12.yml b/.github/workflows/linux-focal-5.12.yml index d3a3d7cce..f43af2b29 100644 --- a/.github/workflows/linux-focal-5.12.yml +++ b/.github/workflows/linux-focal-5.12.yml @@ -33,8 +33,7 @@ jobs: qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \ qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \ qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \ - qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \ - libqt5charts5-dev qml-module-qtcharts + qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev - name: build Subsurface-mobile run: | diff --git a/.github/workflows/linux-groovy-5.14.yml b/.github/workflows/linux-groovy-5.14.yml index 34ddafd6f..ce13a4287 100644 --- a/.github/workflows/linux-groovy-5.14.yml +++ b/.github/workflows/linux-groovy-5.14.yml @@ -33,8 +33,7 @@ jobs: qml-module-qtquick2 qt5-default qt5-qmake qtchooser qtconnectivity5-dev \ qtdeclarative5-dev qtdeclarative5-private-dev qtlocation5-dev \ qtpositioning5-dev qtscript5-dev qttools5-dev qttools5-dev-tools \ - qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev \ - libqt5charts5-dev qml-module-qtcharts + qtquickcontrols2-5-dev xvfb libbluetooth-dev libmtp-dev - name: build Subsurface-mobile run: | diff --git a/.github/workflows/linux-tumbleweed-qt-latest.yml b/.github/workflows/linux-tumbleweed-qt-latest.yml index cd946d0ac..a533412b5 100644 --- a/.github/workflows/linux-tumbleweed-qt-latest.yml +++ b/.github/workflows/linux-tumbleweed-qt-latest.yml @@ -28,8 +28,7 @@ jobs: libqt5-qtscript-devel libqt5-qtdeclarative-devel \ libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel \ libQt5QuickControls2-devel bluez-devel \ - which libgit2-devel libssh2-devel libmtp-devel \ - libQt5Charts5-devel + which libgit2-devel libssh2-devel libmtp-devel # if we want to run the tests below, add xvfb-run diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fa9032ec..49a9ef092 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,7 +276,7 @@ if(ANDROID) # our Qt installation. This is ugly, but it works. set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}") endif() -set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick Location Charts ${QT_EXTRA_COMPONENTS}) +set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick Location ${QT_EXTRA_COMPONENTS}) if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable") find_package(Qt5 5.9.1 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest) elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") @@ -500,7 +500,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") - install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtCharts ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0) # and with Qt 5.11 we need another library that isn't copied by macdeployqt install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)") diff --git a/INSTALL b/INSTALL index 6b12a10f0..749468049 100644 --- a/INSTALL +++ b/INSTALL @@ -75,7 +75,7 @@ As of this writing, there is thankfully a thirdparty offline installer still available: pip3 install aqtinstall - aqt install -O 5.15.2 mac desktop -m qtcharts + aqt install -O 5.15.2 mac desktop (or whatever version / OS you need). This installer is surprisingly fast and seems well maintained - note that we don't use this for Windows as diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 959af95c8..19d69c2f2 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -127,6 +127,20 @@ SOURCES += subsurface-mobile-main.cpp \ backend-shared/exportfuncs.cpp \ backend-shared/plannershared.cpp \ backend-shared/roundrectitem.cpp \ + stats/statsvariables.cpp \ + stats/statsview.cpp \ + stats/barseries.cpp \ + stats/boxseries.cpp \ + stats/chartlistmodel.cpp \ + stats/informationbox.cpp \ + stats/legend.cpp \ + stats/pieseries.cpp \ + stats/scatterseries.cpp \ + stats/statsaxis.cpp \ + stats/statscolors.cpp \ + stats/statsgrid.cpp \ + stats/statsseries.cpp \ + stats/statsstate.cpp \ mobile-widgets/qmlinterface.cpp \ mobile-widgets/qmlmanager.cpp \ mobile-widgets/statsmanager.cpp \ @@ -263,6 +277,22 @@ HEADERS += \ backend-shared/exportfuncs.h \ backend-shared/plannershared.h \ backend-shared/roundrectitem.h \ + stats/barseries.h \ + stats/boxseries.h \ + stats/chartlistmodel.h \ + stats/informationbox.h \ + stats/legend.h \ + stats/pieseries.h \ + stats/scatterseries.h \ + stats/statsaxis.h \ + stats/statscolors.h \ + stats/statsgrid.h \ + stats/statsseries.h \ + stats/statsstate.h \ + stats/statstranslations.h \ + stats/statsvariables.h \ + stats/statsview.h \ + stats/zvalues.h \ mobile-widgets/qmlinterface.h \ mobile-widgets/qmlmanager.h \ mobile-widgets/statsmanager.h \ diff --git a/packaging/OBS/subsurfacedaily.spec b/packaging/OBS/subsurfacedaily.spec index c2e7b2ae8..f54a363a7 100644 --- a/packaging/OBS/subsurfacedaily.spec +++ b/packaging/OBS/subsurfacedaily.spec @@ -57,7 +57,6 @@ BuildRequires: qt5-qtbase-odbc BuildRequires: qt5-qtbase-tds BuildRequires: qt5-qtconnectivity-devel BuildRequires: qt5-qtlocation-devel -BuildRequires: qt5-qtcharts-devel BuildRequires: libappstream-glib %else BuildRequires: update-desktop-files @@ -77,7 +76,6 @@ BuildRequires: libqt5-qtdeclarative-devel BuildRequires: libqt5-qtconnectivity-devel BuildRequires: libqt5-qtlocation-devel BuildRequires: libqt5-qtlocation-private-headers-devel -BuildRequires: libQt5Charts5-devel %endif # Recommends Qt5 translations package %if 0%{?suse_version} diff --git a/packaging/android/android-build-setup.sh b/packaging/android/android-build-setup.sh index 572eda22d..2df1c7b41 100755 --- a/packaging/android/android-build-setup.sh +++ b/packaging/android/android-build-setup.sh @@ -52,7 +52,7 @@ yes | sdkmanager --sdk_root=/android --licenses # next check that Qt is installed if [ ! -d "$LATEST_QT" ] ; then pip3 install aqtinstall - $HOME/.local/bin/aqt install -O /android "$LATEST_QT" linux android -m qtcharts + $HOME/.local/bin/aqt install -O /android "$LATEST_QT" linux android fi # now that we have an NDK, copy the font that we need for OnePlus phones diff --git a/packaging/ubuntu/debian/control b/packaging/ubuntu/debian/control index b0cd49c40..60b36e62e 100644 --- a/packaging/ubuntu/debian/control +++ b/packaging/ubuntu/debian/control @@ -39,8 +39,6 @@ Build-Depends: asciidoc, qml-module-qtquick2, libcurl4-openssl-dev, qtconnectivity5-dev, - libqt5charts5-dev, - qml-module-qtcharts, subsurface-qt-private-headers Standards-Version: 3.9.7 Homepage: http://subsurface-divelog.org diff --git a/packaging/windows/mxe-based-build.sh b/packaging/windows/mxe-based-build.sh index 99d6a7052..7f4c809b2 100755 --- a/packaging/windows/mxe-based-build.sh +++ b/packaging/windows/mxe-based-build.sh @@ -260,7 +260,6 @@ done # next we need the QML modules QT_QML_MODULES="$BASEDIR/"$MXEDIR"/usr/"$MXEBUILDTYPE"/qt5/qml/QtQuick.2 \ $BASEDIR/"$MXEDIR"/usr/"$MXEBUILDTYPE"/qt5/qml/QtLocation \ -$BASEDIR/"$MXEDIR"/usr/"$MXEBUILDTYPE"/qt5/qml/QtCharts \ $BASEDIR/"$MXEDIR"/usr/"$MXEBUILDTYPE"/qt5/qml/QtPositioning" mkdir -p $STAGING_DIR/qml diff --git a/scripts/docker/mxe-build-container/settings.mk b/scripts/docker/mxe-build-container/settings.mk index dfd391b1d..e3f0746af 100644 --- a/scripts/docker/mxe-build-container/settings.mk +++ b/scripts/docker/mxe-build-container/settings.mk @@ -35,7 +35,6 @@ LOCAL_PKG_LIST := gcc \ qtmultimedia \ qtquickcontrols \ qtquickcontrols2 \ - qtcharts \ qtsvg \ qttools \ qttranslations \ diff --git a/scripts/docker/trusty-qt512/Dockerfile b/scripts/docker/trusty-qt512/Dockerfile index 44000dd9a..62ead14f7 100644 --- a/scripts/docker/trusty-qt512/Dockerfile +++ b/scripts/docker/trusty-qt512/Dockerfile @@ -45,7 +45,7 @@ RUN apt-get update && sudo apt-get install -y python3.6 RUN curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" && python3.6 get-pip.py RUN pip3 install aqtinstall RUN find /usr /home -name aqt -ls -RUN /usr/local/bin/aqt install -O /usr/local/Qt 5.12.10 linux desktop -m qtcharts +RUN /usr/local/bin/aqt install -O /usr/local/Qt 5.12.10 linux desktop RUN rm -rf /usr/local/Qt/Tools /usr/local/Qt/Docs /usr/local/Qt/Examples /usr/local/Qt/Maintenance* \ /usr/local/Qt/5.12.10/gcc_64/bin/qgltf /usr/local/Qt/5.12.10/gcc_64/bin/qdoc ENV QT_ROOT /usr/local/Qt/5.12.10/gcc_64 diff --git a/stats/barseries.cpp b/stats/barseries.cpp index 986aa7e0d..49170bf80 100644 --- a/stats/barseries.cpp +++ b/stats/barseries.cpp @@ -7,7 +7,6 @@ #include "zvalues.h" #include // for lrint() -#include #include // Constants that control the bar layout diff --git a/stats/boxseries.cpp b/stats/boxseries.cpp index c684eff8b..08a421205 100644 --- a/stats/boxseries.cpp +++ b/stats/boxseries.cpp @@ -6,7 +6,6 @@ #include "statstranslations.h" #include "zvalues.h" -#include #include // Constants that control the bar layout diff --git a/stats/informationbox.cpp b/stats/informationbox.cpp index c11104333..189fd1ab1 100644 --- a/stats/informationbox.cpp +++ b/stats/informationbox.cpp @@ -2,7 +2,6 @@ #include "statscolors.h" #include "zvalues.h" -#include #include #include diff --git a/stats/pieseries.cpp b/stats/pieseries.cpp index ac43b6d3a..fe7de17f7 100644 --- a/stats/pieseries.cpp +++ b/stats/pieseries.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/stats/scatterseries.cpp b/stats/scatterseries.cpp index 67687de72..8e2399008 100644 --- a/stats/scatterseries.cpp +++ b/stats/scatterseries.cpp @@ -10,7 +10,6 @@ #include "core/divelist.h" #include "core/qthelper.h" -#include #include #include diff --git a/stats/statsaxis.cpp b/stats/statsaxis.cpp index 4d70488da..8b8694964 100644 --- a/stats/statsaxis.cpp +++ b/stats/statsaxis.cpp @@ -9,7 +9,6 @@ #include "core/subsurface-time.h" #include // for lrint #include -#include #include #include @@ -228,7 +227,6 @@ ValueAxis::ValueAxis(const QString &title, double min, double max, int decimals, void ValueAxis::updateLabels() { - using QtCharts::QValueAxis; labels.clear(); ticks.clear(); diff --git a/stats/statsaxis.h b/stats/statsaxis.h index dbcfb6fbd..72a191963 100644 --- a/stats/statsaxis.h +++ b/stats/statsaxis.h @@ -4,12 +4,9 @@ #include #include -#include -#include #include #include #include -#include class QGraphicsScene; diff --git a/stats/statsgrid.cpp b/stats/statsgrid.cpp index 11b05882b..66c720c33 100644 --- a/stats/statsgrid.cpp +++ b/stats/statsgrid.cpp @@ -5,7 +5,6 @@ #include "statshelper.h" #include "zvalues.h" -#include #include static const double gridWidth = 1.0;