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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-01-08 12:53:27 -08:00
parent eb2b0f0a3e
commit b40354c7f2
23 changed files with 40 additions and 35 deletions

View file

@ -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

View file

@ -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: |

View file

@ -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: |

View file

@ -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: |

View file

@ -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: |

View file

@ -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

View file

@ -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)")

View file

@ -75,7 +75,7 @@ As of this writing, there is thankfully a thirdparty offline installer still
available:
pip3 install aqtinstall
aqt install -O <Qt Location> 5.15.2 mac desktop -m qtcharts
aqt install -O <Qt Location> 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

View file

@ -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 \

View file

@ -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}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -35,7 +35,6 @@ LOCAL_PKG_LIST := gcc \
qtmultimedia \
qtquickcontrols \
qtquickcontrols2 \
qtcharts \
qtsvg \
qttools \
qttranslations \

View file

@ -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

View file

@ -7,7 +7,6 @@
#include "zvalues.h"
#include <math.h> // for lrint()
#include <QChart>
#include <QLocale>
// Constants that control the bar layout

View file

@ -6,7 +6,6 @@
#include "statstranslations.h"
#include "zvalues.h"
#include <QChart>
#include <QLocale>
// Constants that control the bar layout

View file

@ -2,7 +2,6 @@
#include "statscolors.h"
#include "zvalues.h"
#include <QChart>
#include <QFontMetrics>
#include <QGraphicsScene>

View file

@ -8,7 +8,6 @@
#include <numeric>
#include <math.h>
#include <QChart>
#include <QGraphicsEllipseItem>
#include <QLocale>

View file

@ -10,7 +10,6 @@
#include "core/divelist.h"
#include "core/qthelper.h"
#include <QChart>
#include <QGraphicsPixmapItem>
#include <QPainter>

View file

@ -9,7 +9,6 @@
#include "core/subsurface-time.h"
#include <math.h> // for lrint
#include <numeric>
#include <QChart>
#include <QFontMetrics>
#include <QLocale>
@ -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();

View file

@ -4,12 +4,9 @@
#include <memory>
#include <vector>
#include <QBarCategoryAxis>
#include <QCategoryAxis>
#include <QFont>
#include <QGraphicsSimpleTextItem>
#include <QGraphicsLineItem>
#include <QValueAxis>
class QGraphicsScene;

View file

@ -5,7 +5,6 @@
#include "statshelper.h"
#include "zvalues.h"
#include <QChart>
#include <QGraphicsLineItem>
static const double gridWidth = 1.0;