Compare commits

...

11 Commits

Author SHA1 Message Date
Dirk Hohndel
6a83129e57 macOS: build googlemaps plugin as fat binary
I couldn't make this to work as a single pass build, so we again do a dual pass
and manually assemble the dylib. This is then copied to a sane spot which
required another attempt to copy it in the CMakeLists.txt - which I added
comments to in order to make sense of the weirdness.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 19:52:32 -10:00
Dirk Hohndel
6cb34cb7f5 Qt6: update the connect calls for QNetworkReply
Because of the old connect syntax used the incorrect signal names weren't
caught at compile time. To switch to the new syntax we had to make two
functions pure virtual in the WebServices class - let's hope I got that right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 18:49:13 -10:00
Dirk Hohndel
ebb7d97474 macOS: update package build script
The create-dmg script changed repo name - let's support either version.
On newer Macs the SDKs are elsewhere - let's look there, too.
Let's be far more flexible when finding SDK versions.
Let's not assume that we are linking against QtWebKit (we're not with Qt6).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 18:47:04 -10:00
Dirk Hohndel
e37babefa7 build-system: make CMakeLists.txt more consistent
We used two different ways to add to the end of a list. Let's stick with
the more idiomatic one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
db46d23743 build-system: remove obsolete warning
Apparently Qt 6.3.0 already fixes this problem, so... never mind.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
4247a4ec79 macOS: use software backend by default with Qt6
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
f076c466ca macOS: add the ability to create fat binaries
This also does some cleanup for some of the variable names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
336ddf633e build-system: more Qt6 / QtLocation updates
This adds a flag to explicitly enable a build against maps, which is
only needed for Qt6 (as we always assume that Qt5 has maps installed).

It also includes a quick fix to fail gracefully if libmtp was already
patched.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
0a843b4ca0 Qt6: first steps towards map support
There is an initial build of the C++ classes that seems to work, but the QML
integration is still missing. Still, progress is being made.

Unfortunately with Qt6 we can't forward declare the MapLocationModel class (one
of the operators needs to be able to determine the size of the class), so we
need to include the header file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-10 13:58:43 -10:00
Dirk Hohndel
e1a0319968 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>
2022-04-08 14:26:40 -10:00
Dirk Hohndel
2e5541b338 whitespace cleanup
Random, I know. But it bugged me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-08 14:21:37 -10:00
17 changed files with 214 additions and 71 deletions

View File

@ -151,7 +151,7 @@ include(cmake_variables_helper)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include_directories(${CMAKE_OSX_SYSROOT}/usr/include/libxml2) include_directories(${CMAKE_OSX_SYSROOT}/usr/include/libxml2)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lxml2 -lxslt -lsqlite3) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lxml2 -lxslt -lsqlite3)
else() else()
pkg_config_library(LIBXML libxml-2.0 REQUIRED) pkg_config_library(LIBXML libxml-2.0 REQUIRED)
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED) pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
@ -192,6 +192,26 @@ if(QT_VERSION_MAJOR STREQUAL "6")
# QtWebKit doesn't work with Qt6, so no printing, no manual # QtWebKit doesn't work with Qt6, so no printing, no manual
set(NO_PRINTING ON) set(NO_PRINTING ON)
set(NO_USERMANUAL ON) set(NO_USERMANUAL ON)
# as of Qt 6.3 by default QtLocation isn't included, but one can
# build the module from source; so let's look if the user has installed
# it (or if a newer version is out that includes it, anyway)
find_package(Qt6 COMPONENTS Location)
if(Qt6Location_FOUND)
message(STATUS "Found Qt6Location")
LIST(APPEND QT_EXTRA_COMPONENTS Location)
add_definitions(-DMAP_SUPPORT)
set(MAPSUPPORT ON)
# at least on macOS something goes sideways and we fail to load the
# QML files with a weird error about Qml.WorkerScript missing
# linking Subsurface against that component appears enough to hack
# around that, but that feels... wrong
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Qt6 COMPONENTS QmlWorkerScript)
LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt6::QmlWorkerScript)
endif()
endif()
else() else()
# as mentioned above, since some variables appear to fail to populate # as mentioned above, since some variables appear to fail to populate
# on some platforms, simply run this again the 'old' way # on some platforms, simply run this again the 'old' way
@ -202,6 +222,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}")
@ -223,7 +245,7 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport) LIST(APPEND QT_EXTRA_COMPONENTS PrintSupport)
# Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way # Because Qt5WebKitWidgets isn't a part of the "regular" Qt5, we can't get it the normal way
find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5WebKitWidgets REQUIRED)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} Qt5::WebKitWidgets) LIST(APPEND SUBSURFACE_LINK_LIBRARIES Qt5::WebKitWidgets)
endif() endif()
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -256,18 +278,18 @@ if(ANDROID)
set(NO_USERMANUAL ON) set(NO_USERMANUAL ON)
set(MAKE_TESTS OFF) set(MAKE_TESTS OFF)
list(APPEND QT_EXTRA_COMPONENTS AndroidExtras) list(APPEND QT_EXTRA_COMPONENTS AndroidExtras)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -llog) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -llog)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# add pthread to the end of the library list on Linux # add pthread to the end of the library list on Linux
# this is only needed on Ubuntu # this is only needed on Ubuntu
# but shouldn't hurt on other Linux versions # but shouldn't hurt on other Linux versions
# in some builds we appear to be missing libz for some strange reason... # in some builds we appear to be missing libz for some strange reason...
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz -lpthread) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lz -lpthread)
# Test for ARM processor (Raspberry Pi) and add libGLESv2 if found # Test for ARM processor (Raspberry Pi) and add libGLESv2 if found
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv6l")
message (STATUS "Found ARM processor. Adding libGLESv2") message (STATUS "Found ARM processor. Adding libGLESv2")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lGLESv2) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lGLESv2)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif() endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -279,7 +301,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
) )
find_library(APP_SERVICES_LIBRARY ApplicationServices) find_library(APP_SERVICES_LIBRARY ApplicationServices)
find_library(HID_LIB HidApi) find_library(HID_LIB HidApi)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${HID_LIB}) LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${HID_LIB})
set(EXTRA_LIBS ${APP_SERVICES_LIBRARY}) set(EXTRA_LIBS ${APP_SERVICES_LIBRARY})
set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns) set(ICON_FILE ${CMAKE_SOURCE_DIR}/packaging/macosx/Subsurface.icns)
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
@ -298,7 +320,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE}) set(SUBSURFACE_PKG MACOSX_BUNDLE ${ICON_FILE})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lwsock32 -lws2_32) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lwsock32 -lws2_32)
remove_definitions(-DUNICODE) remove_definitions(-DUNICODE)
add_definitions(-mwindows -D_WIN32) add_definitions(-mwindows -D_WIN32)
endif() endif()
@ -340,9 +362,13 @@ if(NOT ANDROID)
endif() endif()
#set up the subsurface_link_libraries variable #set up the subsurface_link_libraries variable
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES}) LIST(APPEND 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)
@ -352,7 +378,7 @@ endif()
# hack to build successfully on LGTM # hack to build successfully on LGTM
if(DEFINED ENV{LGTM_SRC}) if(DEFINED ENV{LGTM_SRC})
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lgssapi_krb5 -lhttp_parser) LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lgssapi_krb5 -lhttp_parser)
endif() endif()
# include translations # include translations
@ -364,7 +390,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,26 +573,35 @@ 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)")
# this is really weird. We first try a plugin that ended up in the Qt install prefix
# then we try one that's in that odd broken install location that the qmake file results in (that includes the QT_INSTALL_PREFIX after our INSTALL_ROOT
# and finally, for fat binaries, we copy the one that's in the 'logical' spot under the INSTALL_ROOT
# this should cover all cases and always get us the correct library
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() install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
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
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
install(CODE "execute_process(COMMAND echo the following macdeployqt command will spew out a ton of harmless otool output parsing errors)")
endif()
install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})") install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
# 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)")

View File

@ -37,10 +37,16 @@ QNetworkReply* CloudStorageAuthenticate::backend(const QString& email,const QStr
request->setRawHeader("User-Agent", userAgent.toUtf8()); request->setRawHeader("User-Agent", userAgent.toUtf8());
request->setHeader(QNetworkRequest::ContentTypeHeader, "text/plain"); request->setHeader(QNetworkRequest::ContentTypeHeader, "text/plain");
reply = manager()->post(*request, qPrintable(payload)); reply = manager()->post(*request, qPrintable(payload));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(reply, &QNetworkReply::finished, this, &CloudStorageAuthenticate::uploadFinished);
connect(reply, &QNetworkReply::sslErrors, this, &CloudStorageAuthenticate::sslErrors);
connect(reply, &QNetworkReply::errorOccurred, this, &CloudStorageAuthenticate::uploadError);
#else
connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished())); connect(reply, SIGNAL(finished()), this, SLOT(uploadFinished()));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>))); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(uploadError(QNetworkReply::NetworkError))); SLOT(uploadError(QNetworkReply::NetworkError)));
#endif
return reply; return reply;
} }

View File

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

View File

@ -255,13 +255,20 @@ void uploadDiveLogsDE::uploadDives(const QString &filename, const QString &useri
reply = manager()->post(request, multipart); reply = manager()->post(request, multipart);
// connect signals from upload process // connect signals from upload process
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(reply, &QNetworkReply::finished, this, &uploadDiveLogsDE::uploadFinishedSlot);
connect(reply, &QNetworkReply::errorOccurred, this, &uploadDiveLogsDE::uploadErrorSlot);
connect(reply, &QNetworkReply::uploadProgress, this, &uploadDiveLogsDE::updateProgressSlot);
connect(&timeout, &QTimer::timeout, this, &uploadDiveLogsDE::uploadTimeoutSlot);
#else
connect(reply, SIGNAL(finished()), this, SLOT(uploadFinishedSlot())); connect(reply, SIGNAL(finished()), this, SLOT(uploadFinishedSlot()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(uploadErrorSlot(QNetworkReply::NetworkError))); SLOT(uploadErrorSlot(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this,
SLOT(updateProgressSlot(qint64, qint64))); SLOT(updateProgressSlot(qint64, qint64)));
connect(&timeout, SIGNAL(timeout()), this, SLOT(uploadTimeoutSlot())); connect(&timeout, SIGNAL(timeout()), this, SLOT(uploadTimeoutSlot()));
#endif
timeout.start(30000); // 30s timeout.start(30000); // 30s
} }

View File

@ -45,13 +45,19 @@ void uploadDiveShare::doUpload(bool selected, const QString &uid, bool noPublic)
reply = manager()->put(request, json_data); reply = manager()->put(request, json_data);
// connect signals from upload process // connect signals from upload process
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(reply, &QNetworkReply::finished, this, &uploadDiveShare::uploadFinishedSlot);
connect(reply, &QNetworkReply::errorOccurred, this, &uploadDiveShare::uploadErrorSlot);
connect(reply, &QNetworkReply::uploadProgress, this, &uploadDiveShare::updateProgressSlot);
connect(&timeout, &QTimer::timeout, this, &uploadDiveShare::uploadTimeoutSlot);
#else
connect(reply, SIGNAL(finished()), this, SLOT(uploadFinishedSlot())); connect(reply, SIGNAL(finished()), this, SLOT(uploadFinishedSlot()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(uploadErrorSlot(QNetworkReply::NetworkError))); SLOT(uploadErrorSlot(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this,
SLOT(updateProgressSlot(qint64, qint64))); SLOT(updateProgressSlot(qint64, qint64)));
connect(&timeout, SIGNAL(timeout()), this, SLOT(uploadTimeoutSlot())); connect(&timeout, SIGNAL(timeout()), this, SLOT(uploadTimeoutSlot()));
#endif
timeout.start(30000); // 30s timeout.start(30000); // 30s
} }

View File

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

View File

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

View File

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

View File

@ -107,12 +107,17 @@ void WebServices::updateProgress(qint64 current, qint64 total)
void WebServices::connectSignalsForDownload(QNetworkReply *reply) void WebServices::connectSignalsForDownload(QNetworkReply *reply)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(reply, &QNetworkReply::finished, this, &WebServices::downloadFinished);
connect(reply, &QNetworkReply::errorOccurred, this, &WebServices::downloadError);
connect(reply, &QNetworkReply::downloadProgress, this, &WebServices::updateProgress);
#else
connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished())); connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(downloadError(QNetworkReply::NetworkError))); this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this,
SLOT(updateProgress(qint64, qint64))); SLOT(updateProgress(qint64, qint64)));
#endif
timeout.start(30000); // 30s timeout.start(30000); // 30s
} }
@ -308,10 +313,14 @@ void DivelogsDeWebServices::startDownload()
body.addQueryItem("pass", ui.password->text().replace("+", "%2b")); body.addQueryItem("pass", ui.password->text().replace("+", "%2b"));
reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1()); reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1());
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(reply, &QNetworkReply::finished, this, &DivelogsDeWebServices::listDownloadFinished);
connect(reply, &QNetworkReply::errorOccurred, this, &DivelogsDeWebServices::downloadError);
#else
connect(reply, SIGNAL(finished()), this, SLOT(listDownloadFinished())); connect(reply, SIGNAL(finished()), this, SLOT(listDownloadFinished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(downloadError(QNetworkReply::NetworkError))); this, SLOT(downloadError(QNetworkReply::NetworkError)));
#endif
timeout.start(30000); // 30s timeout.start(30000); // 30s
} }

View File

@ -26,6 +26,8 @@ slots:
virtual void startDownload() = 0; virtual void startDownload() = 0;
virtual void startUpload() = 0; virtual void startUpload() = 0;
virtual void buttonClicked(QAbstractButton *button) = 0; virtual void buttonClicked(QAbstractButton *button) = 0;
virtual void downloadFinished() = 0;
virtual void downloadError(QNetworkReply::NetworkError error) = 0;
void downloadTimedOut(); void downloadTimedOut();
protected protected

View File

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

View File

@ -12,7 +12,7 @@
Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps) Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps)
#endif #endif
class MapLocationModel; #include "qt-models/maplocationmodel.h"
class MapLocation; class MapLocation;
struct dive_site; struct dive_site;

View File

@ -7,9 +7,17 @@
# find the directory above the sources - typically ~/src # find the directory above the sources - typically ~/src
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd ) DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd )
# install location of yourway-create-dmg # install location of create-dmg
# by default we assume it's next to subsurface in ~/src/yoursway-create-dmg # by default we assume it's next to subsurface in ~/src/yoursway-create-dmg
DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg
if [ ! -x $DMGCREATE ] ; then
# well, this app changed its github name, so it may be in a different directory now
DMGCREATE=${DIR}/create-dmg/create-dmg
if [ ! -x $DMGCREATE ] ; then
echo "Can't find working create-dmg, aborting"
exit 1
fi
fi
# same git version magic as in the Makefile # same git version magic as in the Makefile
# for the naming of volume and dmg we want the 3 digits of the full version number # for the naming of volume and dmg we want the 3 digits of the full version number
@ -18,7 +26,9 @@ VERSION=$(cd ${DIR}/subsurface; ./scripts/get-version linux)
# first build and install Subsurface and then clean up the staging area # first build and install Subsurface and then clean up the staging area
# make sure we didn't lose the minimum OS version # make sure we didn't lose the minimum OS version
rm -rf ./Subsurface.app rm -rf ./Subsurface.app
if [ -d /Developer/SDKs ] ; then if [ -d /Library/Developer/CommandLineTools/SDKs ] ; then
SDKROOT=/Library/Developer/CommandLineTools/SDKs
elif [ -d /Developer/SDKs ] ; then
SDKROOT=/Developer/SDKs SDKROOT=/Developer/SDKs
elif [ -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs ] ; then elif [ -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs ] ; then
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
@ -27,9 +37,10 @@ else
echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)" echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)"
exit 1; exit 1;
fi fi
BASESDK=$(ls $SDKROOT | grep "MacOSX10\.1.\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//") BASESDK=$(ls $SDKROOT | grep "MacOSX1.*\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//")
OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/"
export PKG_CONFIG_PATH=${DIR}/install-root/lib/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH=${DIR}/install-root/lib/pkgconfig:$PKG_CONFIG_PATH
cmake $OLDER_MAC_CMAKE . cmake $OLDER_MAC_CMAKE .
LIBRARY_PATH=${DIR}/install-root/lib make -j8 LIBRARY_PATH=${DIR}/install-root/lib make -j8
LIBRARY_PATH=${DIR}/install-root/lib make install LIBRARY_PATH=${DIR}/install-root/lib make install
@ -56,7 +67,8 @@ done
# ensure libpng and libjpeg inside the bundle are referenced in QtWebKit libraries # ensure libpng and libjpeg inside the bundle are referenced in QtWebKit libraries
QTWEBKIT=Subsurface.app/Contents/Frameworks/QtWebKit.framework/QtWebKit QTWEBKIT=Subsurface.app/Contents/Frameworks/QtWebKit.framework/QtWebKit
for i in libjpeg.8.dylib libpng16.16.dylib; do if [ -f $QTWEBKIT ] ; then
for i in libjpeg.8.dylib libpng16.16.dylib; do
OLD=$(otool -L ${QTWEBKIT} | grep $i | cut -d\ -f1 | tr -d "\t") OLD=$(otool -L ${QTWEBKIT} | grep $i | cut -d\ -f1 | tr -d "\t")
if [[ ! -z ${OLD} ]] ; then if [[ ! -z ${OLD} ]] ; then
# copy the library into the bundle and make sure its id and the reference to it are correct # copy the library into the bundle and make sure its id and the reference to it are correct
@ -67,7 +79,8 @@ for i in libjpeg.8.dylib libpng16.16.dylib; do
install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${QTWEBKIT} install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${QTWEBKIT}
install_name_tool -id @executable_path/../Frameworks/${SONAME} Subsurface.app/Contents/Frameworks/${SONAME} install_name_tool -id @executable_path/../Frameworks/${SONAME} Subsurface.app/Contents/Frameworks/${SONAME}
fi fi
done done
fi
# next, copy libssh2.1 # next, copy libssh2.1
# cp ${DIR}/install-root/lib/libssh2.1.dylib Subsurface.app/Contents/Frameworks # cp ${DIR}/install-root/lib/libssh2.1.dylib Subsurface.app/Contents/Frameworks

View File

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

View File

@ -49,6 +49,7 @@ PLATFORM=$(uname)
BTSUPPORT="ON" BTSUPPORT="ON"
DEBUGRELEASE="Debug" DEBUGRELEASE="Debug"
SRC_DIR="subsurface" SRC_DIR="subsurface"
ARCHS=""
# deal with all the command line arguments # deal with all the command line arguments
while [[ $# -gt 0 ]] ; do while [[ $# -gt 0 ]] ; do
@ -76,6 +77,11 @@ while [[ $# -gt 0 ]] ; do
# call this script with -build-deps # call this script with -build-deps
BUILD_DEPS="1" BUILD_DEPS="1"
;; ;;
-fat-build)
# build a fat binary for macOS
# ignored on other platforms
ARCHS="arm64 x86_64"
;;
-build-prefix) -build-prefix)
# instead of building in build & build-mobile in the current directory, build in <buildprefix>build # instead of building in build & build-mobile in the current directory, build in <buildprefix>build
# and <buildprefix>build-mobile; notice that there's no slash between the prefix and the two directory # and <buildprefix>build-mobile; notice that there's no slash between the prefix and the two directory
@ -90,6 +96,11 @@ while [[ $# -gt 0 ]] ; do
# is still available on Linux distros) # is still available on Linux distros)
BUILD_WITH_WEBKIT="1" BUILD_WITH_WEBKIT="1"
;; ;;
-build-with-map)
# Qt6 doesn't include QtLocation (as of Qt 6.3) - but you can build / install it from source.
# use this flag to force building googlemaps with Qt6
BUILD_WITH_MAP="1"
;;
-mobile) -mobile)
# we are building Subsurface-mobile # we are building Subsurface-mobile
# Note that this will run natively on the host OS. # Note that this will run natively on the host OS.
@ -126,7 +137,7 @@ while [[ $# -gt 0 ]] ; do
;; ;;
*) *)
echo "Unknown command line argument $arg" echo "Unknown command line argument $arg"
echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-src-dir <SUBSURFACE directory>] [-build-prefix <PREFIX>] [-build-with-webkit] [-mobile] [-desktop] [-downloader] [-both] [-all] [-create-appdir] [-release]" echo "Usage: build.sh [-no-bt] [-quick] [-build-deps] [-fat-build] [-src-dir <SUBSURFACE directory>] [-build-prefix <PREFIX>] [-build-with-webkit] [-build-with-map] [-mobile] [-desktop] [-downloader] [-both] [-all] [-create-appdir] [-release]"
exit 1 exit 1
;; ;;
esac esac
@ -165,10 +176,19 @@ if [ "$PLATFORM" = Darwin ] ; then
exit 1; exit 1;
fi fi
fi fi
if [ "$ARCHS" != "" ] ; then
# we do assume that the two architectures mentioned are x86_64 and arm64 .. that's kinda wrong
MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/ -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'"
MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk -arch arm64 -arch x86_64"
else
MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/"
MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
ARCHS=$(arch)
fi
# OpenSSL can't deal with multi arch build
MAC_OPTS_OPENSSL="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
echo "Using ${BASESDK} as the BASESDK under ${SDKROOT}" echo "Using ${BASESDK} as the BASESDK under ${SDKROOT}"
OLDER_MAC="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/"
if [[ ! -d /usr/include && ! -d "${SDKROOT}/MacOSX${BASESDK}.sdk/usr/include" ]] ; then if [[ ! -d /usr/include && ! -d "${SDKROOT}/MacOSX${BASESDK}.sdk/usr/include" ]] ; then
echo "Error: Xcode Command Line Tools are not installed" echo "Error: Xcode Command Line Tools are not installed"
echo "" echo ""
@ -330,7 +350,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
sed -i .bak 's/share\/pkgconfig/pkgconfig/' CMakeLists.txt sed -i .bak 's/share\/pkgconfig/pkgconfig/' CMakeLists.txt
mkdir -p build mkdir -p build
cd build cd build
cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \ cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
.. ..
make -j4 make -j4
@ -342,29 +362,46 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
bash ./buildconf bash ./buildconf
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" --with-darwinssl \ CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT" --with-darwinssl \
--disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp --disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp
make -j4 make -j4
make install make install
popd popd
# openssl doesn't support fat binaries out of the box
# this tries to hack around this by first doing an install for x86_64, then a build for arm64
# and then manually creating fat libraries from that
# I worry if there are issues with using the arm or x86 include files...???
./${SRC_DIR}/scripts/get-dep-lib.sh single . openssl ./${SRC_DIR}/scripts/get-dep-lib.sh single . openssl
pushd openssl pushd openssl
mkdir -p build for ARCH in $ARCHS; do
cd build mkdir -p build-$ARCH
if [ $(arch) == "arm64" ] ; then OS_ARCH=darwin64-arm64-cc ; else OS_ARCH=darwin64-x86_64-cc; fi cd build-$ARCH
../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" $OS_ARCH OS_ARCH=darwin64-$ARCH-cc
../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$MAC_OPTS_OPENSSL" $OS_ARCH
make depend make depend
# all the tests fail because the assume that openssl is already installed. Odd? Still thinks work # all the tests fail because the assume that openssl is already installed. Odd? Still things work
make -j4 -k make -j4 -k
make -k install make -k install
cd ..
done
if [[ $ARCHS == *" "* ]] ; then
# now manually add the binaries together and overwrite them in the INSTALL_ROOT
cd build-arm64
lipo -create ./libcrypto.a ../build-x86_64/libcrypto.a -output "$INSTALL_ROOT"/lib/libcrypto.a
lipo -create ./libssl.a ../build-x86_64/libssl.a -output "$INSTALL_ROOT"/lib/libssl.a
LIBSSLNAME=$(readlink libssl.dylib)
lipo -create ./$LIBSSLNAME ../build-x86_64/$LIBSSLNAME -output "$INSTALL_ROOT"/lib/$LIBSSLNAME
LIBCRYPTONAME=$(readlink libcrypto.dylib)
lipo -create ./$LIBCRYPTONAME ../build-x86_64/$LIBCRYPTONAME -output "$INSTALL_ROOT"/lib/$LIBCRYPTONAME
fi
popd popd
./${SRC_DIR}/scripts/get-dep-lib.sh single . libssh2 ./${SRC_DIR}/scripts/get-dep-lib.sh single . libssh2
pushd libssh2 pushd libssh2
mkdir -p build mkdir -p build
cd build cd build
cmake "$OLDER_MAC_CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE=$DEBUGRELEASE -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF .. cmake $MAC_CMAKE -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE=$DEBUGRELEASE -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ..
make -j4 make -j4
make install make install
popd popd
@ -387,7 +424,7 @@ if [[ "$LIBGITMAJ" -lt "1" && "$LIBGIT" -lt "26" ]] ; then
pushd libgit2 pushd libgit2
mkdir -p build mkdir -p build
cd build cd build
cmake "$OLDER_MAC_CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" -DBUILD_CLAR=OFF .. cmake $MAC_CMAKE -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" -DBUILD_CLAR=OFF ..
make -j4 make -j4
make install make install
popd popd
@ -411,7 +448,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
pushd libzip pushd libzip
mkdir -p build mkdir -p build
cd build cd build
cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \ cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
.. ..
make -j4 make -j4
@ -424,7 +461,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
bash ./bootstrap bash ./bootstrap
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT"
make -j4 make -j4
make install make install
popd popd
@ -434,18 +471,18 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
bash ./bootstrap.sh bash ./bootstrap.sh
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" --disable-examples CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT" --disable-examples
make -j4 make -j4
make install make install
popd popd
./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp ./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp
pushd libmtp pushd libmtp
patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch || true
echo 'N' | NOCONFIGURE="1" bash ./autogen.sh echo 'N' | NOCONFIGURE="1" bash ./autogen.sh
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$OLDER_MAC" ../configure --prefix="$INSTALL_ROOT" CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT"
make -j4 make -j4
make install make install
popd popd
@ -454,7 +491,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
pushd libftdi1 pushd libftdi1
mkdir -p build mkdir -p build
cd build cd build
cmake "$OLDER_MAC_CMAKE" -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \ cmake $MAC_CMAKE -DCMAKE_BUILD_TYPE="$DEBUGRELEASE" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROOT" \
.. ..
make -j4 make -j4
@ -484,7 +521,7 @@ if [ ! -f "$SRC"/${SRC_DIR}/libdivecomputer/configure ] ; then
autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer
autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer autoreconf --install "$SRC"/${SRC_DIR}/libdivecomputer
fi fi
CFLAGS="$OLDER_MAC -I$INSTALL_ROOT/include $LIBDC_CFLAGS" "$SRC"/${SRC_DIR}/libdivecomputer/configure --prefix="$INSTALL_ROOT" --disable-examples CFLAGS="$MAC_OPTS -I$INSTALL_ROOT/include $LIBDC_CFLAGS" "$SRC"/${SRC_DIR}/libdivecomputer/configure --prefix="$INSTALL_ROOT" --disable-examples
if [ "$PLATFORM" = Darwin ] ; then if [ "$PLATFORM" = Darwin ] ; then
# remove some copmpiler options that aren't supported on Mac # remove some copmpiler options that aren't supported on Mac
# otherwise the log gets very noisy # otherwise the log gets very noisy
@ -510,7 +547,7 @@ STATIC_LIBDC="$INSTALL_ROOT/$(grep ^libdir Makefile | cut -d/ -f2)/libdivecomput
cd "$SRC" cd "$SRC"
if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && [[ $QT_VERSION == 5* ]] ; then if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && ( [[ $QT_VERSION == 5* ]] || [ "$BUILD_WITH_MAP" = "1" ] ); then
# build the googlemaps map plugin # build the googlemaps map plugin
cd "$SRC" cd "$SRC"
@ -519,7 +556,14 @@ if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && [[ $QT_VERS
mkdir -p build mkdir -p build
mkdir -p J10build mkdir -p J10build
cd build cd build
if [ "$PLATFORM" = Darwin ] && [[ $QT_VERSION == 6* ]]; then
# since we are currently building QtLocation from source, we don't have a way to easily install
# the private headers... so this is a bit of a hack to get those for googlemaps...
# regardless of whether we do a fat build or not, let's do the 'native' build here
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS=$(arch) ../googlemaps.pro
else
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro $QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro
fi
# on Travis the compiler doesn't support c++1z, yet qmake adds that flag; # on Travis the compiler doesn't support c++1z, yet qmake adds that flag;
# since things compile fine with c++11, let's just hack that away # since things compile fine with c++11, let's just hack that away
# similarly, don't use -Wdata-time # similarly, don't use -Wdata-time
@ -528,7 +572,21 @@ if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && [[ $QT_VERS
cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile
fi fi
make -j4 make -j4
if [ "$PLATFORM" = Darwin ] && [[ $QT_VERSION == 6* ]] && [[ $ARCHS == *" "* ]] ; then
# we can't build fat binaries directly here, so let's do it in two steps
# above we build the 'native' binary, now build the other one
OTHERARCH=${ARCHS//$(arch)/}
OTHERARCH=${OTHERARCH// /}
mkdir -p ../build-$OTHERARCH
cd ../build-$OTHERARCH
$QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS=$OTHERARCH ../googlemaps.pro
make -j4
# now combine them into one .dylib
mkdir -p "$INSTALL_ROOT"/plugins/geoservices
lipo -create ./libqtgeoservices_googlemaps.dylib ../build/libqtgeoservices_googlemaps.dylib -output "$INSTALL_ROOT"/plugins/geoservices/libqtgeoservices_googlemaps.dylib
else
make install make install
fi
popd popd
fi fi

View File

@ -128,6 +128,13 @@ int main(int argc, char **argv)
void validateGL() void validateGL()
{ {
QString quickBackend = qgetenv("QT_QUICK_BACKEND"); QString quickBackend = qgetenv("QT_QUICK_BACKEND");
/* on macOS with Qt6 (maybe others), things only work with the software backend */
#if defined(Q_OS_MACOS) && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (quickBackend.isEmpty()) {
quickBackend = QStringLiteral("software");
qputenv("QT_QUICK_BACKEND", "software");
}
#endif
/* an empty QT_QUICK_BACKEND env. variable means OpenGL (default). /* an empty QT_QUICK_BACKEND env. variable means OpenGL (default).
* only validate OpenGL; for everything else print out and return. * only validate OpenGL; for everything else print out and return.
* https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations.html * https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations.html

View File

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