build-system: don't build against Qt6 by default

As some Linux distros start to ship both Qt5 and Qt6, it actually makes more
sense to build only against Qt6 when the user explicitly asks for it. Having it
preferred over Qt5 seems completely wrong in hind sight.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-04-23 10:29:05 -07:00
parent 36c991a1b8
commit 5a5188bc47
3 changed files with 23 additions and 2 deletions

View file

@ -42,7 +42,7 @@ jobs:
git reset --hard git reset --hard
cd .. cd ..
ls -l . subsurface subsurface/scripts ls -l . subsurface subsurface/scripts
bash -e -x subsurface/scripts/build.sh -desktop bash -e -x subsurface/scripts/build.sh -desktop -build-with-qt6
- name: test desktop build - name: test desktop build
run: | run: |

View file

@ -55,6 +55,9 @@ option(FTDISUPPORT "enable support for libftdi based serial" OFF)
# Options regarding What should we build on subsurface # Options regarding What should we build on subsurface
option(MAKE_TESTS "Make the tests" ON) option(MAKE_TESTS "Make the tests" ON)
# Option whether we should try to build against Qt6, if it is available
option(BUILD_WITH_QT6 "try to build against Qt6 (incomplete)" OFF)
SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable, MobileExecutable, or DownloaderExecutable") SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable, MobileExecutable, or DownloaderExecutable")
LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES "DesktopExecutable" "MobileExecutable" "DownloaderExecutable") LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES "DesktopExecutable" "MobileExecutable" "DownloaderExecutable")
SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES}) SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES})
@ -173,12 +176,19 @@ include_directories(.
${CMAKE_BINARY_DIR}/desktop-widgets ${CMAKE_BINARY_DIR}/desktop-widgets
) )
# decide what to do about Qt
# this is messy because we want to support older Qt5 versions, newer Qt5 versions,
# and Qt6 when enabled / available.
if(BUILD_WITH_QT6)
set(CHECK_QT6 "Qt6")
endif()
# figure out which version of Qt we are building against # figure out which version of Qt we are building against
# in theory this should get us all the variables set up correctly, but that # in theory this should get us all the variables set up correctly, but that
# ended up failing in subtle ways to do what was advertized; in the Qt5 case # ended up failing in subtle ways to do what was advertized; in the Qt5 case
# some of the variables didn't get set up, so we'll immediately call it again # some of the variables didn't get set up, so we'll immediately call it again
# for Qt5 # for Qt5
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets) find_package(QT NAMES ${CHECK_QT6} Qt5 REQUIRED COMPONENTS Core Widgets)
# right now there are a few things that don't work with Qt6 # right now there are a few things that don't work with Qt6
# let's disable them right here and remember our Qt version # let's disable them right here and remember our Qt version

View file

@ -96,6 +96,14 @@ 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-qt6)
# Qt6 is not enabled by default as there are a few issues still with the port
# - by default the Qt6 packages don't include QtLocation, so no maps (see below)
# - WebKit doesn't work with Qt6, so no printing or in-app user manual
# - there are a few other random bugs that we still find here and there
# So by default we only try to build against Qt5. This overwrites that
BUILD_WITH_QT6="1"
;;
-build-with-map) -build-with-map)
# Qt6 doesn't include QtLocation (as of Qt 6.3) - but you can build / install it from source. # 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 # use this flag to force building googlemaps with Qt6
@ -604,6 +612,9 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
else else
EXTRA_OPTS="-DNO_USERMANUAL=ON -DNO_PRINTING=ON" EXTRA_OPTS="-DNO_USERMANUAL=ON -DNO_PRINTING=ON"
fi fi
if [ "$BUILD_WITH_QT6" = "1" ] ; then
EXTRA_OPTS="$EXTRA_OPTS -DBUILD_WITH_QT6=ON"
fi
cd "$SRC"/${SRC_DIR} cd "$SRC"/${SRC_DIR}