mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
build-system: make map support its own thing
Making this simply depend on Qt5 or Qt6 was short-sighted as work on QtLocation upstream continues. Instead break this out as its own option. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
890f21bd58
commit
2241a28499
8 changed files with 33 additions and 20 deletions
|
@ -202,6 +202,8 @@ else()
|
||||||
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
||||||
# for Qt5 we want the Location component (which is missing so far in Qt6)
|
# for Qt5 we want the Location component (which is missing so far in Qt6)
|
||||||
LIST(APPEND QT_EXTRA_COMPONENTS Location)
|
LIST(APPEND QT_EXTRA_COMPONENTS Location)
|
||||||
|
add_definitions(-DMAP_SUPPORT)
|
||||||
|
set(MAPSUPPORT ON)
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "building with Qt ${QT_VERSION}")
|
message(STATUS "building with Qt ${QT_VERSION}")
|
||||||
|
|
||||||
|
@ -343,6 +345,10 @@ endif()
|
||||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
|
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
|
||||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||||
if(USINGQT6)
|
if(USINGQT6)
|
||||||
|
if(MAPSUPPORT)
|
||||||
|
qt_add_resources(SUBSURFACE_RESOURCES map-widget/qml/map-widget.qrc)
|
||||||
|
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
|
||||||
|
endif()
|
||||||
qt_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc desktop-widgets/qml/statsview2.qrc)
|
qt_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc desktop-widgets/qml/statsview2.qrc)
|
||||||
else()
|
else()
|
||||||
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
|
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc profile.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
|
||||||
|
@ -364,7 +370,7 @@ add_subdirectory(qt-models)
|
||||||
add_subdirectory(commands)
|
add_subdirectory(commands)
|
||||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||||
add_subdirectory(profile-widget)
|
add_subdirectory(profile-widget)
|
||||||
if(NOT USINGQT6)
|
if(MAPSUPPORT)
|
||||||
add_subdirectory(map-widget)
|
add_subdirectory(map-widget)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(mobile-widgets)
|
add_subdirectory(mobile-widgets)
|
||||||
|
@ -547,13 +553,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
|
||||||
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
|
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
|
||||||
if(QT_VERSION VERSION_LESS 6.0.0)
|
if(USINGQT6)
|
||||||
|
set(QT_INSTALL_PREFIX ${QT6_INSTALL_PREFIX})
|
||||||
|
else()
|
||||||
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
||||||
|
endif()
|
||||||
|
if(MAPSUPPORT)
|
||||||
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
||||||
install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||||
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||||
else()
|
|
||||||
set(QT_INSTALL_PREFIX ${QT6_INSTALL_PREFIX})
|
|
||||||
endif()
|
endif()
|
||||||
# this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently
|
# this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently
|
||||||
# also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer
|
# also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer
|
||||||
|
@ -564,9 +572,14 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
|
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
|
||||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
|
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
|
||||||
# and another hack to get the QML Components in the right place
|
# and another hack to get the QML Components in the right place
|
||||||
if(QT_VERSION VERSION_LESS 6.0.0)
|
if(MAPSUPPORT)
|
||||||
|
if (USINGQT6)
|
||||||
|
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick,QtLocation,QtPositioning})")
|
||||||
|
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
|
else()
|
||||||
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
|
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
|
||||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
|
endif()
|
||||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
endif()
|
endif()
|
||||||
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||||
|
|
|
@ -148,7 +148,7 @@ void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
|
||||||
dive_sites = ds;
|
dive_sites = ds;
|
||||||
// When switching into dive site mode, reload the dive sites.
|
// When switching into dive site mode, reload the dive sites.
|
||||||
// TODO: why here? why not catch the filterReset signal in the map widget
|
// TODO: why here? why not catch the filterReset signal in the map widget
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
#endif
|
#endif
|
||||||
emit diveListNotifier.filterReset();
|
emit diveListNotifier.filterReset();
|
||||||
|
@ -161,7 +161,7 @@ void DiveFilter::stopFilterDiveSites()
|
||||||
return;
|
return;
|
||||||
dive_sites.clear();
|
dive_sites.clear();
|
||||||
emit diveListNotifier.filterReset();
|
emit diveListNotifier.filterReset();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
|
||||||
dive_sites = ds;
|
dive_sites = ds;
|
||||||
|
|
||||||
emit diveListNotifier.filterReset();
|
emit diveListNotifier.filterReset();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->setSelected(dive_sites);
|
MapWidget::instance()->setSelected(dive_sites);
|
||||||
MapWidget::instance()->selectionChanged();
|
MapWidget::instance()->selectionChanged();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -143,7 +143,7 @@ set(SUBSURFACE_INTERFACE
|
||||||
updatemanager.cpp
|
updatemanager.cpp
|
||||||
updatemanager.h
|
updatemanager.h
|
||||||
)
|
)
|
||||||
if(NOT USINGQT6)
|
if(MAPSUPPORT)
|
||||||
LIST(APPEND SUBSURFACE_INTERFACE
|
LIST(APPEND SUBSURFACE_INTERFACE
|
||||||
mapwidget.cpp
|
mapwidget.cpp
|
||||||
mapwidget.h
|
mapwidget.h
|
||||||
|
|
|
@ -523,7 +523,7 @@ void DiveListView::selectionChangeDone()
|
||||||
if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site))
|
if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site))
|
||||||
selectedSites.push_back(d->dive_site);
|
selectedSites.push_back(d->dive_site);
|
||||||
}
|
}
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->setSelected(selectedSites);
|
MapWidget::instance()->setSelected(selectedSites);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ MainWindow::MainWindow() :
|
||||||
// for the "default" mode
|
// for the "default" mode
|
||||||
mainTab.reset(new MainTab);
|
mainTab.reset(new MainTab);
|
||||||
diveList.reset(new DiveListView);
|
diveList.reset(new DiveListView);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
mapWidget.reset(MapWidget::instance()); // Yes, this is ominous see comment in mapwidget.cpp.
|
mapWidget.reset(MapWidget::instance()); // Yes, this is ominous see comment in mapwidget.cpp.
|
||||||
#endif
|
#endif
|
||||||
plannerWidgets.reset(new PlannerWidgets);
|
plannerWidgets.reset(new PlannerWidgets);
|
||||||
|
@ -200,7 +200,7 @@ MainWindow::MainWindow() :
|
||||||
initialUiSetup();
|
initialUiSetup();
|
||||||
readSettings();
|
readSettings();
|
||||||
diveList->setFocus();
|
diveList->setFocus();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
#endif
|
#endif
|
||||||
diveList->expand(diveList->model()->index(0, 0));
|
diveList->expand(diveList->model()->index(0, 0));
|
||||||
|
@ -329,7 +329,7 @@ void MainWindow::selectionChanged()
|
||||||
if (current_dive)
|
if (current_dive)
|
||||||
enableDisableOtherDCsActions();
|
enableDisableOtherDCsActions();
|
||||||
profile->plotCurrentDive();
|
profile->plotCurrentDive();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->selectionChanged();
|
MapWidget::instance()->selectionChanged();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ void MainWindow::closeCurrentFile()
|
||||||
clear_dive_file_data(); // this clears all the core data structures and resets the models
|
clear_dive_file_data(); // this clears all the core data structures and resets the models
|
||||||
setCurrentFile(nullptr);
|
setCurrentFile(nullptr);
|
||||||
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
|
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
MapWidget::instance()->reload();
|
MapWidget::instance()->reload();
|
||||||
#endif
|
#endif
|
||||||
if (!existing_filename)
|
if (!existing_filename)
|
||||||
|
|
|
@ -34,7 +34,7 @@ TabDiveNotes::TabDiveNotes(QWidget *parent) : TabBase(parent),
|
||||||
connect(&diveListNotifier, &DiveListNotifier::commandExecuted, this, &TabDiveNotes::closeWarning);
|
connect(&diveListNotifier, &DiveListNotifier::commandExecuted, this, &TabDiveNotes::closeWarning);
|
||||||
|
|
||||||
connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit);
|
connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex);
|
connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex);
|
||||||
connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex);
|
connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,7 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
||||||
weightsysteminfomodel.h
|
weightsysteminfomodel.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT USINGQT6)
|
if(MAPSUPPORT)
|
||||||
LIST(APPEND SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
LIST(APPEND SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
||||||
maplocationmodel.cpp
|
maplocationmodel.cpp
|
||||||
maplocationmodel.h
|
maplocationmodel.h
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
#include "map-widget/qmlmapwidgethelper.h"
|
#include "map-widget/qmlmapwidgethelper.h"
|
||||||
#include "qt-models/maplocationmodel.h"
|
#include "qt-models/maplocationmodel.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -224,7 +224,7 @@ static void register_qml_types(QQmlEngine *engine)
|
||||||
register_qml_type<ChartListModel>("ChartListModel");
|
register_qml_type<ChartListModel>("ChartListModel");
|
||||||
#endif // not SUBSURFACE_MOBILE
|
#endif // not SUBSURFACE_MOBILE
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#ifdef MAP_SUPPORT
|
||||||
register_qml_type<MapWidgetHelper>("MapWidgetHelper");
|
register_qml_type<MapWidgetHelper>("MapWidgetHelper");
|
||||||
register_qml_type<MapLocationModel>("MapLocationModel");
|
register_qml_type<MapLocationModel>("MapLocationModel");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue